feat(auth): OAuth profiles with --profile flag and auth subcommands - #72
Conversation
Add OAuth login flow (PKCE, custom app, ready token), per-profile credential storage at ~/.direct-cli/auth.json (0600/0700), profile-aware resolver, top-level --profile, and `direct auth login/list/use/status` commands. Profile isolation prevents mixing with base YANDEX_DIRECT_TOKEN/LOGIN. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@claude review. Focus on critical issues: bugs, security vulnerabilities, logical errors, data loss risks, performance problems. Do NOT nitpick style, naming conventions, minor formatting, or subjective preferences — only flag issues that could break functionality or cause real harm in production. |
|
Claude finished @axisrow's task in 3m 9s —— View job PR Review: feat(auth): OAuth profiles with --profile flag and auth subcommandsTasks:
Critical Issues1. Token file permissions race condition (Security —
|
Replace non-atomic path.write_text() + deferred chmod with tempfile + os.replace() to prevent race window where token file is world-readable and protect against data loss on interrupted writes. Also remove unused parse_ids import in advideos.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Issues #1 and #2 (security race condition + non-atomic write) fixed in commit 76619ca — now uses
|
|
@claude review. Focus on critical issues: bugs, security vulnerabilities, logical errors, data loss risks, performance problems. Do NOT nitpick style, naming conventions, minor formatting, or subjective preferences — only flag issues that could break functionality or cause real harm in production. |
|
Claude finished @axisrow's task in 2m 40s —— View job PR Review: feat(auth): OAuth profiles with --profile flag and auth subcommandsTasks:
Status of Previously Reported IssuesFixed in 76619ca — confirmed correct: Remaining Critical Issue
|
When a profile is explicitly selected (--profile flag or active profile from auth.json) but not found in the store, raise ClickException with the descriptive error message instead of silently falling through to env-based credentials. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@claude review. Focus on critical issues: bugs, security vulnerabilities, logical errors, data loss risks, performance problems. Do NOT nitpick style, naming conventions, minor formatting, or subjective preferences — only flag issues that could break functionality or cause real harm in production. |
|
Claude finished @axisrow's task in 3m 8s —— View job PR Review: feat(auth): OAuth profiles with --profile flag and auth subcommandsTasks:
Status of All Previously Reported IssuesAll three critical issues are confirmed fixed and correct:
No New Critical Issues FoundChecked all paths thoroughly:
Minor Testing Note (not blocking)There is no end-to-end CLI-runner test for the c7d0931 fix itself: Summary: All previously reported critical and medium issues are correctly fixed. No new critical issues found. This PR is clean from a security, correctness, and data-loss perspective. |
Summary
direct auth login/list/use/statuswith OAuth PKCE, custom-app and ready-token flows.YANDEX_DIRECT_TOKEN_<SUFFIX>env) and top-level--profileflag.~/.direct-cli/auth.jsonwith0600/0700permissions; active profile triggers early credential resolution.Test plan
pytest tests/test_auth_oauth.py tests/test_cli.py tests/test_comprehensive.py -v— 57 passedflake8 direct_cli tests— cleanblack --check direct_cli tests— cleandirect auth login --oauth-token y0_… --profile sandbox→direct auth list→direct --profile sandbox campaigns get🤖 Generated with Claude Code