Add JWT-SVID audience policy fields to Entry type - #84
Closed
srikalyan wants to merge 1 commit into
Closed
Conversation
Adds support for per-audience JWT-SVID policy configuration: New JWTSVIDAudiencePolicy enum with three modes: - DEFAULT (0): No JTI, caching enabled - AUDITABLE (1): JTI included, caching enabled - UNIQUE (2): JTI included, caching disabled New Entry fields: - jwt_svid_default_audience_policy: Default policy for audiences not in map - jwt_svid_audience_policies: Per-audience policy overrides New EntryMask fields for update operations.
srikalyan
requested review from
MarcosDY,
amartinezfayo,
evan2645,
rturner3 and
sorindumitru
as code owners
December 26, 2025 05:45
srikalyan
added a commit
to srikalyan/spire
that referenced
this pull request
Dec 26, 2025
This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire-plugin-sdk: https://github.com/spiffe/spire-plugin-sdk/pull/113
srikalyan
added a commit
to srikalyan/spire
that referenced
this pull request
Dec 26, 2025
This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514
This was referenced Dec 26, 2025
srikalyan
added a commit
to srikalyan/spire
that referenced
this pull request
Mar 9, 2026
This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514
srikalyan
added a commit
to srikalyan/spire
that referenced
this pull request
Apr 16, 2026
This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514
srikalyan
added a commit
to srikalyan/spire
that referenced
this pull request
Apr 16, 2026
This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514
sorindumitru
left a comment
Member
There was a problem hiding this comment.
Would you mind repointing this PR against the next branch? That's where changes go in first. We cherry-pick them to main once we make a release which includes the changes
2 tasks
srikalyan
added a commit
to srikalyan/spire
that referenced
this pull request
Apr 21, 2026
This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514
Contributor
Author
|
Superseded by #95, which implements the simpler design discussed in spiffe/spire#6514 (single bool jwt_svid_include_jti inside AdditionalAttributes). Closing. |
srikalyan
added a commit
to srikalyan/spire
that referenced
this pull request
May 20, 2026
This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514
srikalyan
added a commit
to srikalyan/spire
that referenced
this pull request
May 26, 2026
This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514 Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com>
srikalyan
added a commit
to srikalyan/spire
that referenced
this pull request
May 26, 2026
This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514 Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com>
srikalyan
added a commit
to srikalyan/spire
that referenced
this pull request
May 26, 2026
This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514 Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com>
srikalyan
added a commit
to srikalyan/spire
that referenced
this pull request
May 27, 2026
This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514 Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com>
angabini
pushed a commit
to angabini/spire
that referenced
this pull request
May 27, 2026
…iffe#6514) * Add JWT-SVID audience policy configuration with JTI claim support (spiffe#6043) Introduces per-audience JWT-SVID policy configuration to control JTI (JWT ID) claim inclusion and agent-side caching behavior. New JWTSVIDAudiencePolicy enum with three modes: - DEFAULT (0): No JTI, caching enabled (backwards compatible) - AUDITABLE (1): JTI included, caching enabled - UNIQUE (2): JTI included, caching disabled Features: - Per-entry default policy via jwt_svid_default_audience_policy - Per-audience overrides via jwt_svid_audience_policies map - "Most restrictive wins" for multi-audience tokens - Database schema v24 with entry_audience_policies table - Agent cache bypass for UNIQUE policy Note: API SDK and CLI integration will follow in a separate commit after spire-api-sdk is updated. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Add CLI and entry conversion support for JWT-SVID audience policies This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514 Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Bump spire-api-sdk to merged JTI commit (PR spiffe#95) Replaces local-path replace directive with the merged upstream SDK pseudo-version so CI can resolve the new jwt_svid_include_jti field from the public module proxy. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Persist AdditionalAttributes through entry update mask The updateEntry mask translation in the entry v1 service was missing the AdditionalAttributes field, so masked updates targeting that field were silently dropped before reaching the datastore. Map the input mask bit through and add coverage for both the honored and ignored cases. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Preserve sibling AdditionalAttributes on partial CLI entry update The protobuf AdditionalAttributes message has no per-field mask, so a CLI update that set only one of -disableX509SVIDPrefetch or -jwtSVIDIncludeJTI would clobber the unset sibling bit with its zero value. Track each flag's set state independently and, when exactly one is supplied (and -data is not in use), fetch the existing entry to merge the unspecified bit before BatchUpdateEntry. GetEntry failures short-circuit before any update is attempted. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Address review feedback for JWT-SVID JTI claim - pkg/server/api/svid/v1/service.go: add explicit nil check for GetAdditionalAttributes() before reading JwtSvidIncludeJti; add test cases covering nil attrs, JTI false, and JTI true paths. - pkg/server/credtemplate/builder.go: return error from jti UUID generation instead of panicking via uuid.Must; encode the 16 random bytes as base64url for a more compact claim value. - cmd/spire-server/cli/entry/update.go: gate the existing-entry fetch on a single additionalAttributesSet flag, then merge each AdditionalAttributes field individually so unspecified flags preserve the existing value. - pkg/agent/manager/manager_test.go: add TestFetchJWTSVIDWithJTIBypassesCache proving JwtSvidIncludeJti bypasses both the cache read and write. - pkg/server/api/entry_test.go: only add JwtSvidIncludeJti: true in TestReadOnlyEntryClone; revert unintended prefetch change. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Clone existing AdditionalAttributes on partial CLI entry update Switch mergeAdditionalAttributes to proto.Clone the existing message and override only fields explicitly set on the command line. This preserves unknown fields and any future AdditionalAttributes the binary does not know about, so the merge does not need editing when new fields are added. Also harden the agent's bypassCache read with a nil-safe chained getter. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> --------- Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com>
MikeZappa87
pushed a commit
to MikeZappa87/spire
that referenced
this pull request
May 29, 2026
…iffe#6514) * Add JWT-SVID audience policy configuration with JTI claim support (spiffe#6043) Introduces per-audience JWT-SVID policy configuration to control JTI (JWT ID) claim inclusion and agent-side caching behavior. New JWTSVIDAudiencePolicy enum with three modes: - DEFAULT (0): No JTI, caching enabled (backwards compatible) - AUDITABLE (1): JTI included, caching enabled - UNIQUE (2): JTI included, caching disabled Features: - Per-entry default policy via jwt_svid_default_audience_policy - Per-audience overrides via jwt_svid_audience_policies map - "Most restrictive wins" for multi-audience tokens - Database schema v24 with entry_audience_policies table - Agent cache bypass for UNIQUE policy Note: API SDK and CLI integration will follow in a separate commit after spire-api-sdk is updated. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Add CLI and entry conversion support for JWT-SVID audience policies This commit adds support for the new JWT-SVID audience policy configuration in the SPIRE server CLI and entry conversion logic: CLI changes: - Add -jwtSVIDDefaultAudiencePolicy flag for default audience policy - Add -jwtSVIDAudiencePolicy flag for per-audience policy configuration - Update entry create, update, and show commands to handle new fields - Add AudiencePolicyFlag custom type for parsing audience:policy pairs Entry conversion: - Add JwtSvidDefaultAudiencePolicy and JwtSvidAudiencePolicies to EntryToProto and ProtoToEntry conversion functions - Add audiencePolicyToInternal helper for enum conversion Policy options: default, auditable, unique - default: No JTI claim, caching enabled (current behavior) - auditable: JTI claim included, caching enabled - unique: JTI claim included, caching disabled (unique tokens) Part of spiffe#6043 NOTE: Only merge after these dependent PRs are merged: - spire-api-sdk: spiffe/spire-api-sdk#84 - spire: spiffe#6514 Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Bump spire-api-sdk to merged JTI commit (PR spiffe#95) Replaces local-path replace directive with the merged upstream SDK pseudo-version so CI can resolve the new jwt_svid_include_jti field from the public module proxy. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Persist AdditionalAttributes through entry update mask The updateEntry mask translation in the entry v1 service was missing the AdditionalAttributes field, so masked updates targeting that field were silently dropped before reaching the datastore. Map the input mask bit through and add coverage for both the honored and ignored cases. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Preserve sibling AdditionalAttributes on partial CLI entry update The protobuf AdditionalAttributes message has no per-field mask, so a CLI update that set only one of -disableX509SVIDPrefetch or -jwtSVIDIncludeJTI would clobber the unset sibling bit with its zero value. Track each flag's set state independently and, when exactly one is supplied (and -data is not in use), fetch the existing entry to merge the unspecified bit before BatchUpdateEntry. GetEntry failures short-circuit before any update is attempted. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Address review feedback for JWT-SVID JTI claim - pkg/server/api/svid/v1/service.go: add explicit nil check for GetAdditionalAttributes() before reading JwtSvidIncludeJti; add test cases covering nil attrs, JTI false, and JTI true paths. - pkg/server/credtemplate/builder.go: return error from jti UUID generation instead of panicking via uuid.Must; encode the 16 random bytes as base64url for a more compact claim value. - cmd/spire-server/cli/entry/update.go: gate the existing-entry fetch on a single additionalAttributesSet flag, then merge each AdditionalAttributes field individually so unspecified flags preserve the existing value. - pkg/agent/manager/manager_test.go: add TestFetchJWTSVIDWithJTIBypassesCache proving JwtSvidIncludeJti bypasses both the cache read and write. - pkg/server/api/entry_test.go: only add JwtSvidIncludeJti: true in TestReadOnlyEntryClone; revert unintended prefetch change. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> * Clone existing AdditionalAttributes on partial CLI entry update Switch mergeAdditionalAttributes to proto.Clone the existing message and override only fields explicitly set on the command line. This preserves unknown fields and any future AdditionalAttributes the binary does not know about, so the merge does not need editing when new fields are added. Also harden the agent's bypassCache read with a nil-safe chained getter. Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com> --------- Signed-off-by: Srikalyan Swayampakula <srikalyansswayam@gmail.com>
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.
Summary
Adds support for per-audience JWT-SVID policy configuration to the Entry type.
New JWTSVIDAudiencePolicy enum with three modes:
New Entry fields:
jwt_svid_default_audience_policy: Default policy for audiences not explicitly configuredjwt_svid_audience_policies: Map of audience → policy for per-audience overridesNew EntryMask fields:
jwt_svid_default_audience_policyjwt_svid_audience_policiesRelated
This SDK change supports the SPIRE server implementation in spiffe/spire#6514
Fixes spiffe/spire#6043