Skip to content

Fix PR workflow perms#47

Merged
thrix merged 1 commit into
mainfrom
fix-pr-workflow-perms
Apr 16, 2026
Merged

Fix PR workflow perms#47
thrix merged 1 commit into
mainfrom
fix-pr-workflow-perms

Conversation

@thrix

@thrix thrix commented Apr 16, 2026

Copy link
Copy Markdown
Owner

The container workflow does not need permissions, we use a PAT to push to registry.

Summary by Sourcery

CI:

  • Update the container PR GitHub Actions workflow to request write access to packages for the build job.

Summary by Sourcery

CI:

  • Drop explicit packages: write permission from the container workflow and its Jinja template, relying instead on existing authentication.

@sourcery-ai

sourcery-ai Bot commented Apr 16, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR removes the explicit GitHub Actions job-level permissions: packages: write configuration from the container build workflow and its Jinja template, relying instead on the default permissions and an existing PAT-based push mechanism.

File-Level Changes

Change Details Files
Remove job-level packages: write permission from the container workflow to align with using a PAT for registry pushes.
  • Delete the explicit permissions block granting write access to packages from the container workflow YAML
  • Delete the same permissions block from the Jinja template used to generate the container workflow
.github/workflows/container.yml
.github/workflows/container.yml.j2

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/container-pr.yml" line_range="96-97" />
<code_context>
   build:
     needs: resolve
+
+    permissions:
+      packages: write
+
     uses: ./.github/workflows/container.yml
</code_context>
<issue_to_address>
**🚨 issue (security):** Revisit whether `packages: write` is the minimum required permission for this job.

This broad permission increases the blast radius if the workflow is abused. If the underlying `container.yml` only pulls images, `packages: read` should be sufficient. If write access is required (e.g., publishing images), ensure this job only runs in trusted contexts (no `pull_request_target`) and isn’t reused in workflows that shouldn’t have package write access.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/container-pr.yml Outdated
The `container` workflow does not need the permission,
we use a PAT for writing to the registry.

Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
@thrix thrix force-pushed the fix-pr-workflow-perms branch from 5d47fdf to 7f775ac Compare April 16, 2026 21:09

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The PR description says the container PR workflow should request write access to packages, but the diff removes permissions: packages: write entirely—please reconcile the intent with the actual change so it's clear whether this permission is still needed anywhere.
  • If the PAT is now solely responsible for registry access, consider adding a brief comment in the workflow near the login/push step indicating that permissions are intentionally omitted and PAT scopes are relied on instead, to avoid future confusion.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The PR description says the container PR workflow should request write access to packages, but the diff removes `permissions: packages: write` entirely—please reconcile the intent with the actual change so it's clear whether this permission is still needed anywhere.
- If the PAT is now solely responsible for registry access, consider adding a brief comment in the workflow near the login/push step indicating that permissions are intentionally omitted and PAT scopes are relied on instead, to avoid future confusion.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@thrix thrix merged commit bb97597 into main Apr 16, 2026
8 checks passed
@thrix thrix deleted the fix-pr-workflow-perms branch April 16, 2026 21:51
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.

1 participant