Skip to content

Add omitempty to Audience#422

Merged
N-lson merged 2 commits into
mainfrom
nelson/empty-audience
Jun 9, 2026
Merged

Add omitempty to Audience#422
N-lson merged 2 commits into
mainfrom
nelson/empty-audience

Conversation

@N-lson

@N-lson N-lson commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Audience is being initialized in the TFP as an empty string rather than null when no value is provided. This leads to it being attempted to be used in Octopus which can result in the following error:

Error: Error: Could not find matching identity for presented assertions. Assertions - Issuer: 'https://token.actions.githubusercontent.com/', Subject: 'repo:', Audience: ''

Fixes #338

@denys-octopus denys-octopus left a comment

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.

Looks good


type OIDCIdentity struct {
Audience string `json:"Audience"`
Audience string `json:"Audience,omitempty"`

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.

Note that this can potentially change behaviour of the endpoint if endpoint treats differently null and empty values.

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.

It does change the behaviour (Audience no longer gets set with an empty string value) but that's the intended result because the current behaviour results in the existing bug. I don't think anyone would be reliant on this behaviour, what do you think?

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.

I don't think so, but wanted to raise the question to confirm that you were aware of it :) 👍

@N-lson N-lson merged commit 1cfdae5 into main Jun 9, 2026
6 checks passed
@N-lson N-lson deleted the nelson/empty-audience branch June 9, 2026 04:20
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.

[BUG] OIDCIdentity incorrect field

2 participants