-
Notifications
You must be signed in to change notification settings - Fork 68
feat(secrethub): Add compact subject to OpenID JWT claims #559
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
Open
hamir-suspect
wants to merge
6
commits into
main
Choose a base branch
from
has/secrethub/oidc-short-sub
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
80c8707
feat(secrethub): Add compact subject to OpenID JWT claims
hamir-suspect 4499aeb
fix(secrethub): failing tests
hamir-suspect edd7f9d
fix(secrethub): credo setup and tests
hamir-suspect 9dbe9a2
Merge branch 'main' into has/secrethub/oidc-short-sub
hamir-suspect 26708cf
Merge branch 'main' into has/secrethub/oidc-short-sub
hamir-suspect 4bb82d4
Merge branch 'main' into has/secrethub/oidc-short-sub
hamir-suspect File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -835,6 +835,7 @@ defmodule Secrethub.InternalGrpcApi.Test do | |||
assert Map.get(jwt.fields, "aud") == "https://testera.localhost" | ||||
assert Map.get(jwt.fields, "iss") == "https://testera.localhost" | ||||
assert Map.get(jwt.fields, "sub") == "project:front:pipeline:semaphore.yml" | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a nitpick, but that will make the tests better. Can we update the
|
||||
assert Map.get(jwt.fields, "sub2") == "testera:#{req.project_id}:::" | ||||
assert Map.get(jwt.fields, "prj") == req.project_name | ||||
assert Map.get(jwt.fields, "org") == req.org_username | ||||
refute Map.has_key?(jwt.fields, "https://aws.amazon.com/tags") | ||||
|
@@ -908,6 +909,7 @@ defmodule Secrethub.InternalGrpcApi.Test do | |||
assert Map.get(jwt.fields, "aud") == "https://testera.localhost" | ||||
assert Map.get(jwt.fields, "iss") == "https://testera.localhost" | ||||
assert Map.get(jwt.fields, "sub") == "project:front:pipeline:semaphore.yml" | ||||
assert Map.get(jwt.fields, "sub2") == "testera:#{req.project_id}:my-repo:branch:" | ||||
end | ||||
|
||||
test "it returns a signed token with filtered claims in on_prem mode" do | ||||
|
@@ -942,6 +944,7 @@ defmodule Secrethub.InternalGrpcApi.Test do | |||
|
||||
# Essential claims should be present | ||||
assert Map.get(jwt.fields, "sub") == "project:front:pipeline:semaphore.yml" | ||||
assert Map.get(jwt.fields, "sub2") == "testera:#{req.project_id}:my-repo:branch:" | ||||
assert Map.get(jwt.fields, "aud") == "https://testera.localhost" | ||||
assert Map.get(jwt.fields, "iss") == "https://testera.localhost" | ||||
assert_in_delta Map.get(jwt.fields, "exp") + req.expires_in, now, 5 | ||||
|
@@ -1022,8 +1025,8 @@ defmodule Secrethub.InternalGrpcApi.Test do | |||
} do | ||||
claim_config = | ||||
ClaimConfig.new( | ||||
name: "sub2", | ||||
description: "Subject identifier", | ||||
name: "custom_claim", | ||||
description: "Test custom claim", | ||||
is_active: true, | ||||
is_mandatory: true, | ||||
is_aws_tag: false, | ||||
|
@@ -1046,8 +1049,8 @@ defmodule Secrethub.InternalGrpcApi.Test do | |||
test "with empty org_id returns error", %{project_id: project_id, channel: channel} do | ||||
claim_config = | ||||
ClaimConfig.new( | ||||
name: "sub2", | ||||
description: "Subject identifier", | ||||
name: "custom_claim", | ||||
description: "Test custom claim", | ||||
is_active: true, | ||||
is_mandatory: true, | ||||
is_aws_tag: false, | ||||
|
@@ -1161,8 +1164,8 @@ defmodule Secrethub.InternalGrpcApi.Test do | |||
# Set up initial JWT configuration | ||||
claim_config = | ||||
ClaimConfig.new( | ||||
name: "sub2", | ||||
description: "Subject identifier", | ||||
name: "custom_claim", | ||||
description: "Test custom claim", | ||||
is_active: true, | ||||
is_mandatory: true, | ||||
is_aws_tag: false, | ||||
|
@@ -1221,8 +1224,8 @@ defmodule Secrethub.InternalGrpcApi.Test do | |||
project_id: "", | ||||
claims: [ | ||||
ClaimConfig.new( | ||||
name: "sub2", | ||||
description: "Subject identifier", | ||||
name: "custom_claim", | ||||
description: "Test custom claim", | ||||
is_active: true, | ||||
is_mandatory: true, | ||||
is_aws_tag: false, | ||||
|
@@ -1249,8 +1252,8 @@ defmodule Secrethub.InternalGrpcApi.Test do | |||
refute is_nil(response.project_id), "Expected project_id not to be nil" | ||||
|
||||
expected_claim = %{ | ||||
name: "sub2", | ||||
description: "Subject identifier", | ||||
name: "custom_claim", | ||||
description: "Test custom claim", | ||||
is_active: true, | ||||
is_mandatory: false, | ||||
is_aws_tag: false, | ||||
|
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.
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.
But you are using
:
as a separator.