Skip to content

Azure DevOps token source and validator#54667

Merged
strideynet merged 19 commits intomasterfrom
strideynet/azure-devops-source-and-validator
May 13, 2025
Merged

Azure DevOps token source and validator#54667
strideynet merged 19 commits intomasterfrom
strideynet/azure-devops-source-and-validator

Conversation

@strideynet
Copy link
Copy Markdown
Contributor

@strideynet strideynet commented May 9, 2025

Part of #38852

As per: #54341

Depends on #54658

Introduces core implementation for the token source and for the token validator, as well as workload id join attrs.

No backport labels or changelog as all stacked PRs will be backported together.

Comment thread lib/azuredevops/token_validator.go Outdated
"strings"
"time"

"github.com/coreos/go-oidc/v3/oidc"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All my bonusly points if you use zitadel/oidc/v3 instead !!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done - I've omitted caching JWKS across joins for now since I figure it'll make more sense to put that in once more than 1 join method uses the new zitadel package.

@strideynet strideynet marked this pull request as ready for review May 12, 2025 13:03
@strideynet strideynet requested review from boxofrad and timothyb89 May 12, 2025 13:03
@github-actions github-actions bot requested review from rudream and ryanclark May 12, 2025 13:04
@strideynet strideynet added the no-changelog Indicates that a PR does not require a changelog entry label May 12, 2025
Comment thread lib/azuredevops/azuredevops.go Outdated
Comment thread lib/azuredevops/token_validator.go Outdated
@strideynet strideynet force-pushed the strideynet/azure-devops-protos-validation branch from a8e1d45 to 7972945 Compare May 13, 2025 12:03
Comment thread go.mod
github.com/ghodss/yaml v1.0.0
github.com/go-git/go-git/v5 v5.16.0
github.com/go-jose/go-jose/v3 v3.0.4
github.com/go-jose/go-jose/v4 v4.0.5
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we be thinking about moving all uses of go-jose/v3 to go-jose/v4?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I used go-jose v4 in the tests here since that is what was being used indirectly by the Zitadel OIDC package.

As for if we ought to migrate more fully - it looks like v4 mostly included breaking changes to make it harder to footgun common JWT vulnerabilities (https://github.com/go-jose/go-jose/releases/tag/v4.0.0) - most of these should be pretty easy to adopt. I don't think there's any rush though since they seem to be still releasing new patches for v3.

Comment thread lib/azuredevops/token_validator.go Outdated
Comment thread lib/azuredevops/token_validator.go Outdated
Comment thread lib/azuredevops/token_validator.go Outdated
Base automatically changed from strideynet/azure-devops-protos-validation to master May 13, 2025 12:45
strideynet and others added 5 commits May 13, 2025 13:49
@strideynet strideynet force-pushed the strideynet/azure-devops-source-and-validator branch from f45bfb1 to 75be296 Compare May 13, 2025 12:50
@strideynet strideynet enabled auto-merge May 13, 2025 13:03
@strideynet strideynet added this pull request to the merge queue May 13, 2025
Merged via the queue into master with commit 943b3c1 May 13, 2025
45 checks passed
@strideynet strideynet deleted the strideynet/azure-devops-source-and-validator branch May 13, 2025 13:31
strideynet added a commit that referenced this pull request May 14, 2025
* Initial impl of token source

* Add initial token validator implementation

* add join attrs for azure devops

* Switch to Zitadel OIDC

* Embed zoidc.TokenClaims into main IDTokenClaims struct

* Add notes on caching

* Expand concept of token validator

* Start hacking on test suite

* JoinAttrs method

* Fix TestIDTokenValidator_Validate suite

* Update OIDC doc to match real one

* Add TestIDTokenSource

* go mod tidy

* rearrange go.mod

* fix  query params

* RepositoryReference -> RepositoryRef

* Switch to azuredevops

* Adjust struct init

* Update lib/azuredevops/token_validator.go

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
strideynet added a commit that referenced this pull request May 15, 2025
* Initial impl of token source

* Add initial token validator implementation

* add join attrs for azure devops

* Switch to Zitadel OIDC

* Embed zoidc.TokenClaims into main IDTokenClaims struct

* Add notes on caching

* Expand concept of token validator

* Start hacking on test suite

* JoinAttrs method

* Fix TestIDTokenValidator_Validate suite

* Update OIDC doc to match real one

* Add TestIDTokenSource

* go mod tidy

* rearrange go.mod

* fix  query params

* RepositoryReference -> RepositoryRef

* Switch to azuredevops

* Adjust struct init

* Update lib/azuredevops/token_validator.go

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request May 16, 2025
* Azure DevOps token source and validator (#54667)

* Initial impl of token source

* Add initial token validator implementation

* add join attrs for azure devops

* Switch to Zitadel OIDC

* Embed zoidc.TokenClaims into main IDTokenClaims struct

* Add notes on caching

* Expand concept of token validator

* Start hacking on test suite

* JoinAttrs method

* Fix TestIDTokenValidator_Validate suite

* Update OIDC doc to match real one

* Add TestIDTokenSource

* go mod tidy

* rearrange go.mod

* fix  query params

* RepositoryReference -> RepositoryRef

* Switch to azuredevops

* Adjust struct init

* Update lib/azuredevops/token_validator.go

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* go mod tidy

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Indicates that a PR does not require a changelog entry size/lg

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants