Repository navigation
Add login --add-scope to keep the stored sign-in's scopes - #69
Open
sunilmehta-si wants to merge 1 commit into
Open
sunilmehta-si wants to merge 1 commit into
sunilmehta-si wants to merge 1 commit into
Conversation
`proofline login --scope` replaces the default scopes, so adding one scope meant retyping every scope of the current sign-in. The scan refusal printed such a command with a fixed list, and following it dropped any other scope the sign-in held, such as analytics:read or org:configure. `--add-scope SCOPE` asks for the scopes of the sign-in stored for the console, even an expired one, plus the named scopes, and starts from the defaults when nothing is stored. It prints the full list before the browser opens and cannot be combined with `--scope`. The scan refusal now suggests `proofline login --add-scope scans:request`, which asks for the same scopes as before when nothing is stored.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Who this helps
Anyone signed in with
proofline loginwho needs one more scope. Scans needscans:request, exports needanalytics:read, and configuration needssetup:writeandorg:configure, while the default sign-in has none of them.Today
--scopereplaces the defaults, so adding one scope means retyping every scope the sign-in already holds. The CLI's own hint makes this worse. When a scan is refused for a missing scope, it prints:Someone who followed the configuration or export instructions earlier loses
setup:write,org:configureoranalytics:readby running it, and only finds out when the next command is refused.What this adds
proofline login --add-scope SCOPE(repeatable) asks for the scopes of the sign-in stored for that console plus the scopes you name:The scan refusal now suggests
proofline login --add-scope scans:request.Decisions
--scopeor to plainlogin. Both keep their current meaning, so scripts, the installer and the documented sign-in commands behave as before.--add-scope scans:requestasks for exactly the list the old hint did.--add-scopeconflicts with--scope. Combining "replace" and "add" has no obvious meaning, so clap refuses it.config::LOGIN), which the installer, the agent setup message and two tests use as the canonical first sign-in. It could suggest--add-scopetoo when a stored sign-in lacks a configuration scope. I kept this change small and can do that next if you want.How I verified it
cargo fmt --checkandcargo clippy --locked --all-targets -- -D warningsare clean.cargo test --locked --no-fail-fast: everything passes exceptagent_install::unattended_registration_preserves_settings_and_uses_the_installed_binary, which fails the same way on an unmodifiedmainon macOS (/var/...vs/private/var/...).--scopeconflict. The scan test now pins the new hint./auth/device/codeand/auth/device/tokenthat logs the requested scopes and approves them:login --scope reviews:read --scope findings:read --scope reviews:request --scope analytics:readreviews:read findings:read reviews:request analytics:readlogin --add-scope scans:requestreviews:read findings:read reviews:request analytics:read scans:requestlogin --scope scans:request(the old hint, for comparison)scans:requestlogin --add-scope scans:requestwith nothing storedreviews:read findings:read reviews:request scans:requestlogin --scope a --add-scope bthe argument '--scope <SCOPE>' cannot be used with '--add-scope <SCOPE>'proofline statusshowed the same scopes after each sign-in, andproofline logoutremoved the test entries afterwards.