Skip to content

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#7

Merged
justinkumpe merged 1 commit intomainfrom
alert-autofix-1
Feb 13, 2026
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#7
justinkumpe merged 1 commit intomainfrom
alert-autofix-1

Conversation

@justinkumpe
Copy link
Member

@justinkumpe justinkumpe commented Feb 13, 2026

Potential fix for https://github.com/kumpeapps/git-quickops/security/code-scanning/1

In general, the fix is to add a permissions block that grants only the scopes this workflow needs. Because it uploads release assets using softprops/action-gh-release, it requires contents: write. Other steps either use repository contents (which are covered by contents) or external services (VS Code Marketplace via a PAT), and don’t need other GitHub scopes.

The best minimal fix without changing functionality is to add a workflow-level permissions block right after the name (or before on:) in .github/workflows/publish.yml. This block should specify contents: write, which implicitly allows reading contents as well. No other permissions are necessary from the shown code. No additional imports or dependencies are needed since this is just YAML configuration.

Concretely, in .github/workflows/publish.yml, after line 1 (name: Publish to VS Code Marketplace), insert:

permissions:
  contents: write

leaving the rest of the workflow unchanged.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Summary by Sourcery

CI:

  • Add a workflow-level permissions block to the VS Code Marketplace publish workflow limiting access to contents: write.

…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@justinkumpe justinkumpe marked this pull request as ready for review February 13, 2026 17:45
@sourcery-ai
Copy link

sourcery-ai bot commented Feb 13, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Sets explicit, minimal GitHub Actions workflow permissions for the VS Code Marketplace publish workflow to satisfy code scanning requirements while preserving existing behavior.

Sequence diagram for publish workflow using scoped contents write permissions

sequenceDiagram
  participant GitHub
  participant WorkflowPublish as Workflow_publish_yml
  participant GHToken as GITHUB_TOKEN_contents_write
  participant GitHubAPI as GitHub_Contents_API

  GitHub->>WorkflowPublish: Trigger on release published
  WorkflowPublish->>GHToken: Request token with contents write
  GHToken-->>WorkflowPublish: Scoped token issued
  WorkflowPublish->>GitHubAPI: Upload release assets using token
  GitHubAPI-->>WorkflowPublish: Confirm assets uploaded
Loading

File-Level Changes

Change Details Files
Add a minimal workflow-level permissions block to the publish workflow so it only requests contents write access.
  • Insert a workflow-level permissions section directly after the workflow name.
  • Grant contents: write so the release upload step can modify repository contents while avoiding broader permissions.
  • Leave all existing triggers, jobs, and steps in the workflow unchanged.
.github/workflows/publish.yml

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


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.

@justinkumpe justinkumpe disabled auto-merge February 13, 2026 18:00
@justinkumpe justinkumpe added the bug Something isn't working label Feb 13, 2026
@justinkumpe justinkumpe added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit 79b439f Feb 13, 2026
5 checks passed
@justinkumpe justinkumpe deleted the alert-autofix-1 branch February 13, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant