-
Notifications
You must be signed in to change notification settings - Fork 56
feat: Add --oauth-force-oob
CLI option
#667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this! A couple of nitpicks 🙂
sigstore/_cli.py
Outdated
@@ -221,6 +221,12 @@ def _add_shared_oidc_options( | |||
default=os.getenv("SIGSTORE_OIDC_ISSUER", DEFAULT_OAUTH_ISSUER_URL), | |||
help="The OpenID Connect issuer to use (conflicts with --staging)", | |||
) | |||
group.add_argument( | |||
"--oidc-disable-default-browser", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this flag name might be a little ambiguous: what it's doing is forcing the OOB flow, which is conceptually untied to the "default" browser. It's also doing an OAuth2 flow, so I think we should emphasize that rather than OIDC (OIDC refers to the "shape" of the claims that come out of the flow).
What do you think about --oauth-no-browser
or --oauth-force-oob
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I have a slight preference for the latter, since it'll be consistent with the environment suggestion below. But either is fine IMO; your call.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed --oauth-force-oob
, even though I think prepending --oidc-xxx
wold be more consistent with other commands if it's under the oidc group. Lmk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's a little inconsistent, but IMO it's worth it for the compatibility/symmetry with the existing flag.
There might be a better section to put this under; I'll take a look.
JFYI: This will also require a |
/gcbrun |
LGTM behaviorally!
|
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
/gcbrun |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @laurentsimon!
I need one of the other maintainers to approve as well, but this will be included in the 2.0 series.
--oidc-disable-default-browser
CLI option--oauth-force-oob
CLI option
/gcbrun |
/gcbrun |
/gcbrun |
/gcbrun |
I have no clue why the macOS and Windows CIs are getting stuck here. Maybe some kind of bad runner state? Nothing in this PR itself should vary between platforms. |
Weirdly, both seem to hang at around the same test: Windows:
macOS:
I'll do some more digging later. |
I wonder if these are waiting for user input... perhaps we need to add a reasonable timeout around any flows that wait for user input? |
Yeah, that was my guess, although it's a mystery to me why they'd block on these platforms and not on the Linux CI. I think a timeout around user input makes sense, in places we can enforce it (e.g. |
This was indeed a silly blocking thing; should be fixed with d6052c9. |
Signed-off-by: William Woodruff <william@trailofbits.com>
/gcbrun |
How was this passing on linux? E.g. https://github.com/sigstore/sigstore-python/actions/runs/5204665487/jobs/9412771815 |
I think it probably passed because we're not being specific enough about which Looking at it more closely, I'm not 100% sure what branch this test was originally intended to cover -- @jleightcap do you remember what your intent with this was? |
It looks like it was probably meant to catch this: sigstore-python/sigstore/oidc.py Lines 361 to 364 in d610255
I'll add a proper exception message there and assert on it. My guess is that the Linux CI was passing because |
Signed-off-by: William Woodruff <william@trailofbits.com>
/gcbrun |
Tests are passing with the new match, so that confirms that the Linux CI was coincidentally entering the OOB flow (whereas Windows and macOS weren't, probably because both have a browser installed). |
Adresses comment #665 (comment)