Skip to content
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

Expose SkipExpiryCheck OIDC Config Option in Verifier #1271

Merged
merged 2 commits into from Jul 13, 2023

Conversation

priyawadhwa
Copy link
Contributor

This PR exposes some oidc config options allowed by the go-oidc library that we use, specifically SkipExpiryCheck.

It updates the LRU cache for verifiers to include both the verifier and the config in the cache, so that Verifier A with a normal config can be distinguished from Verifier A with a config with SkipExpiryCheck set

@priyawadhwa priyawadhwa changed the title WIP: Expose SkipExpiryCheck OIDC Config Option in Verifier Expose SkipExpiryCheck OIDC Config Option in Verifier Jul 11, 2023
@codecov
Copy link

codecov bot commented Jul 11, 2023

Codecov Report

Merging #1271 (a821199) into main (b55b6ba) will increase coverage by 0.21%.
The diff coverage is 65.45%.

@@            Coverage Diff             @@
##             main    #1271      +/-   ##
==========================================
+ Coverage   58.01%   58.23%   +0.21%     
==========================================
  Files          50       50              
  Lines        3013     3031      +18     
==========================================
+ Hits         1748     1765      +17     
+ Misses       1113     1110       -3     
- Partials      152      156       +4     
Impacted Files Coverage Δ
pkg/identity/authorize.go 0.00% <0.00%> (ø)
pkg/config/config.go 74.23% <51.51%> (+4.20%) ⬆️
pkg/identity/github/issuer.go 62.50% <66.66%> (ø)
pkg/identity/base/issuer.go 88.46% <100.00%> (ø)
pkg/identity/buildkite/issuer.go 62.50% <100.00%> (ø)
pkg/identity/email/issuer.go 62.50% <100.00%> (ø)
pkg/identity/gitlabcom/issuer.go 62.50% <100.00%> (ø)
pkg/identity/issuerpool.go 100.00% <100.00%> (ø)
pkg/identity/kubernetes/issuer.go 62.50% <100.00%> (ø)
pkg/identity/spiffe/issuer.go 62.50% <100.00%> (ø)
... and 2 more

... and 2 files with indirect coverage changes

Signed-off-by: Priya Wadhwa <priya@chainguard.dev>
Signed-off-by: Priya Wadhwa <priya@chainguard.dev>

type Issuer interface {
// Match checks if this issuer can authenticate tokens from a given issuer URL
Match(ctx context.Context, url string) bool

// Authenticate ID token and return Principal on success. The ID token's signature
// is verified in the call -- invalid signature must result in an error.
Authenticate(ctx context.Context, token string) (Principal, error)
Authenticate(ctx context.Context, token string, opts ...config.InsecureOIDCConfigOption) (Principal, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm, this is what you are calling within your code, correct? Just wanted to understand why we need options propagated to all of the issuers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! We have a custom issuer which requires this option to be passed in.

// Look up our fixed issuer verifiers
v, ok := fc.verifiers[issuerURL]
if ok {
return v, true
for _, c := range v {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a use case that needs to be handled? What's the case when you'd have a configuration that specifies both skipping the expiration and not skipping the expiration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah, so our custom issuer does have this use case. Not sure if I can give more details though 😅

@haydentherapper haydentherapper merged commit 0972dcc into sigstore:main Jul 13, 2023
13 checks passed
@priyawadhwa priyawadhwa deleted the oidc-config branch July 13, 2023 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants