Skip to content

feat(charts): allow auto workflows to set own posixuid#1364

Open
JamesDoingStuff wants to merge 1 commit into
mainfrom
jg/posixuid-for-events
Open

feat(charts): allow auto workflows to set own posixuid#1364
JamesDoingStuff wants to merge 1 commit into
mainfrom
jg/posixuid-for-events

Conversation

@JamesDoingStuff
Copy link
Copy Markdown
Contributor

@JamesDoingStuff JamesDoingStuff commented Jun 2, 2026

AP-1110

I had to remove the pipe expressions from the JMESPath in the policy - they don't seem to work with the || operator. Possibly a kyverno bug, as they seem to behave as one would expect in the JMESPath tutorial/playground.

If identity-mapper changes related to AP-1140 are merged in before this, then that policy will need updating instead in a similar way to how workflow-label-clusterpolicy is here e.g.

context:
     - name: posixUidString
       variable:
         value: "{{`{{ request.userInfo.extra.\"workflows.diamond.ac.uk/posixuid\"[0] || request.object.metadata.labels.\"workflows.diamond.ac.uk/machine-uid\" }}`}}"

@JamesDoingStuff JamesDoingStuff self-assigned this Jun 2, 2026
@JamesDoingStuff JamesDoingStuff force-pushed the jg/posixuid-for-events branch 3 times, most recently from 7f729f9 to 4309ce9 Compare June 2, 2026 12:05
@JamesDoingStuff JamesDoingStuff marked this pull request as ready for review June 2, 2026 12:13
@JamesDoingStuff JamesDoingStuff force-pushed the jg/posixuid-for-events branch from 4309ce9 to 89bb3c6 Compare June 2, 2026 12:28
workflows.diamond.ac.uk/creator-posix-uid: '{{ . }}'
{{- else }}
workflows.diamond.ac.uk/creator-posix-uid: '{{ `{{ request.userInfo.extra | "workflows.diamond.ac.uk/posixuid" | [0] }}` }}'
workflows.diamond.ac.uk/creator-posix-uid: '{{ `{{ request.userInfo.extra."workflows.diamond.ac.uk/posixuid"[0] || machineuid }}` }}'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

checking I understand the safety reasoning here: it's impossible for a malicious user to set "workflows.diamond.ac.uk/machine-uid" themselves because "workflows.diamond.ac.uk/posixuid" is always set and is out of their control?

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.

Yes that was my thinking - I just tried running a workflow with the label set manually and the pod was still my UID rather than the machine one

@TBThomas56
Copy link
Copy Markdown
Contributor

Could be worth adding a validating rule that rejects workflows that carry a machine-uid label unless submitted by a trusted Service account? maybe the events metacontroller?

@JamesDoingStuff
Copy link
Copy Markdown
Contributor Author

@TBThomas56 I like that idea. The fact that we create the EventSources (which are where the machine-uids are defined) combined with the logic @davehadley pointed out should mean that it's already impossible to create a job with any old account, but it can't hurt to have a fail-safe like that. Would you be happy if I merge this as-is and then add that in once #1366 is done?

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.

3 participants