Skip to content

Conversation

dereknola
Copy link
Member

Proposed Changes

Rework trivy scanning on PR to be more secure:

  • First stage is triggered by a label scan-with-trivy applied to a PR. This must be done by a k3s-io member with write access. It compiles the k3s image within a unprivileged pull-request context
  • Second workflow follows after that success with a privileged workflow that can write the results back to the PR as a comment and remove the scan-with-trivy label. This eliminates the chance of a bad actor using make as a way to inject malicious code inside a privileged context.

Types of Changes

CI Change

Verification

See dereknola#31 on my personal fork

Testing

Linked Issues

User-Facing Change


Further Comments

Signed-off-by: Derek Nola <derek.nola@suse.com>
@dereknola dereknola requested a review from a team as a code owner July 7, 2025 22:19
@dereknola dereknola changed the title Move to more secure split trivy workflow based on labels, not comments Move to more secure trivy workflow based on labels, not comments Jul 7, 2025
@cwayne18
Copy link
Member

cwayne18 commented Jul 8, 2025

love this, thank you

@dereknola dereknola merged commit c3a4c8d into k3s-io:master Jul 8, 2025
2 checks passed
@dereknola dereknola deleted the secure_trivy branch July 8, 2025 16:12
dereknola added a commit to dereknola/k3s that referenced this pull request Jul 11, 2025
dereknola added a commit to dereknola/k3s that referenced this pull request Jul 11, 2025
dereknola added a commit to dereknola/k3s that referenced this pull request Jul 11, 2025
dereknola added a commit to dereknola/k3s that referenced this pull request Jul 11, 2025
dereknola added a commit that referenced this pull request Jul 11, 2025
* Move to more secure split trivy workflow based on labels, not comments (#12592)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Add basic fuzz test

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Add retry around common timeout for hardened docker test (#12601)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Remove ghcr build cache (#12602)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Migrate K3s Release Artifacts to GHA (#12606)

Signed-off-by: Derek Nola <derek.nola@suse.com>

---------

Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola added a commit that referenced this pull request Jul 11, 2025
* Move to more secure split trivy workflow based on labels, not comments (#12592)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Add basic fuzz test

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Add retry around common timeout for hardened docker test (#12601)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Remove ghcr build cache (#12602)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Migrate K3s Release Artifacts to GHA (#12606)

Signed-off-by: Derek Nola <derek.nola@suse.com>

---------

Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola added a commit that referenced this pull request Jul 11, 2025
* Move to more secure split trivy workflow based on labels, not comments (#12592)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Add basic fuzz test

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Add retry around common timeout for hardened docker test (#12601)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Remove ghcr build cache (#12602)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Migrate K3s Release Artifacts to GHA (#12606)

Signed-off-by: Derek Nola <derek.nola@suse.com>

---------

Signed-off-by: Derek Nola <derek.nola@suse.com>
dereknola added a commit that referenced this pull request Jul 11, 2025
* Move to more secure split trivy workflow based on labels, not comments (#12592)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Add basic fuzz test

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Add retry around common timeout for hardened docker test (#12601)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Remove ghcr build cache (#12602)

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Migrate K3s Release Artifacts to GHA (#12606)

Signed-off-by: Derek Nola <derek.nola@suse.com>

---------

Signed-off-by: Derek Nola <derek.nola@suse.com>
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.

4 participants