Skip to content

Fix dependency review workflow for Dependabot PRs#85

Merged
dvasilas merged 6 commits intomainfrom
fix/dependency-review-dependabot
Mar 31, 2026
Merged

Fix dependency review workflow for Dependabot PRs#85
dvasilas merged 6 commits intomainfrom
fix/dependency-review-dependabot

Conversation

@dvasilas
Copy link
Copy Markdown
Contributor

@dvasilas dvasilas commented Mar 20, 2026

  • Checkout PR head commit: pull_request_target checks out the base branch by default. We need to pass ref to actions/checkout so the review can analyze PR's changes
  • Allow Dependabot as bot actor: claude-code-action rejects bot-initiated triggers by default; add dependabot[bot] to allowed_bots
  • Fix plugin marketplace URL: claude-code-action validates that marketplace URLs end with .git
  • Configure git credentials for private repos* Accept an optional GIT_ACCESS_TOKEN secret so yarn can install private Scality dependencies and the action can clone the private agent-hub plugin marketplace

@dvasilas dvasilas marked this pull request as ready for review March 20, 2026 14:51
@dvasilas dvasilas requested a review from a team as a code owner March 20, 2026 14:51
Copy link
Copy Markdown
Contributor

@tcarmet tcarmet left a comment

Choose a reason for hiding this comment

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

I haven't check but on the skills make sure it knows that the setup is done via pull_request_target instead of pull_request

contents: read
pull-requests: write
id-token: write
checks: read
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.

Do we need this one?

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 gives the agent permission to read the CI status.
Without it the agent reported CI status: Could not be verified due to API permissions. Confirm CI is green before merging.
With it it is CI status: Several checks still in progress at time of review. No failures observed. because the workflow runs early 🤷

Copy link
Copy Markdown
Contributor

@tcarmet tcarmet Mar 23, 2026

Choose a reason for hiding this comment

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

Ok now I'm even more confused, because it should be actions: read

But actually, knowing how github works checks is technically a lower level api of actions so it works.

I would recommend just changing to actions: read if that's ok, it should work the same and makes more sense for a human like me.

Copy link
Copy Markdown
Contributor Author

@dvasilas dvasilas Mar 24, 2026

Choose a reason for hiding this comment

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

I tried it, but I got CI status: Unable to query (permissions); verify CI is green before merging
https://github.com/scality/scuba/pull/407#pullrequestreview-3997059964

So I will revert it for now.
(we could maybe instruct the agent which API to use? 🤔 )

Copy link
Copy Markdown
Contributor Author

@dvasilas dvasilas Mar 24, 2026

Choose a reason for hiding this comment

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

Well now it says CI status: Could not be verified due to API permissions. Recommend confirming CI is green before merging. even after I reverted. Not sure what happened.

It could be that the agent tries to check different things in different runs. I added both permissions.

@dvasilas dvasilas force-pushed the fix/dependency-review-dependabot branch from 134c5a3 to c76c385 Compare March 23, 2026 08:10
@dvasilas
Copy link
Copy Markdown
Contributor Author

dvasilas commented Mar 23, 2026

I haven't check but on the skills make sure it knows that the setup is done via pull_request_target instead of pull_request

@tcarmet what do you have in mind that the skill must be aware of?

The skill reads the codebase in the PR branch (I think) because the workflow checks out github.event.pull_request.head.sha

@dvasilas dvasilas requested a review from tcarmet March 23, 2026 08:35
@tcarmet
Copy link
Copy Markdown
Contributor

tcarmet commented Mar 23, 2026

I haven't check but on the skills make sure it knows that the setup is done via pull_request_target instead of pull_request

@tcarmet what do you have in mind that the skill must be aware of?

The skill reads the codebase in the PR branch (I think) because the workflow checks out github.event.pull_request.head.sha

@dvasilas ignore my comment, I think at some point I saw a comment of Nico saying to create a skill to ease the setup of this actions in a repo (so a skill to setup a skill 😂) so I thought it existed, but it doesn't so ignore me :D

description: GCP region for Vertex AI
ACTIONS_APP_PRIVATE_KEY:
required: false
description: Private key for the GitHub App used to access private repositories
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.

In my example I setted up as a vars you said it worked so great, but double check if it's best to send it as a input

Suggested change
description: Private key for the GitHub App used to access private repositories
description: Private key for the GitHub App used to access private repositories
inputs:
ACTIONS_APP_ID:
required: false
description: <add description>

If thats the case then change the vars.ACTIONS_APP_ID to inputs.ACTIONS_APP_ID

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.

Done.

@dvasilas
Copy link
Copy Markdown
Contributor Author

I haven't check but on the skills make sure it knows that the setup is done via pull_request_target instead of pull_request

@tcarmet what do you have in mind that the skill must be aware of?
The skill reads the codebase in the PR branch (I think) because the workflow checks out github.event.pull_request.head.sha

@dvasilas ignore my comment, I think at some point I saw a comment of Nico saying to create a skill to ease the setup of this actions in a repo (so a skill to setup a skill 😂) so I thought it existed, but it doesn't so ignore me :D

Oh I see. It doens't exist yet, but I plan to build one.

steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Security note: This workflow is called via workflow_call, so the trigger depends on the caller. If the caller uses pull_request_target, checking out github.event.pull_request.head.sha means untrusted PR code is checked out in a context with write permissions (pull-requests: write).

The risk is mitigated here because:
- yarn install uses --ignore-scripts
- No run: steps execute code from the checked-out repo
- claude-code-action reads but doesn't execute repo files

Consider adding a comment in the workflow noting this security trade-off, so future contributors don't add run: steps that source repo files after checkout.

— Claude Code

@claude
Copy link
Copy Markdown

claude bot commented Mar 24, 2026

LGTM — solid set of fixes for Dependabot support. One minor note:

- Security trade-off with head SHA checkout (line 40): checking out the PR head in a workflow that may run via pull_request_target means untrusted code is present with write permissions. Currently mitigated by --ignore-scripts and no repo-code execution in run: steps, but worth a comment in the YAML for future maintainers.

Review by Claude Code

@claude
Copy link
Copy Markdown

claude bot commented Mar 24, 2026

LGTM

The changes are well-structured:
- Checking out PR head via SHA (not ref) is the safe approach for pull_request_target callers
- --ignore-scripts on yarn install is a good security hardening
- GitHub App token generation for private repos follows the standard pattern
- allowed_bots and .git URL fix are correct
- New inputs/secrets are all optional, so no downstream breakage

Review by Claude Code

@claude
Copy link
Copy Markdown

claude bot commented Mar 24, 2026

LGTM

Review by Claude Code

@scality scality deleted a comment from claude bot Mar 31, 2026
@scality scality deleted a comment from claude bot Mar 31, 2026
@scality scality deleted a comment from claude bot Mar 31, 2026
@scality scality deleted a comment from claude bot Mar 31, 2026
@scality scality deleted a comment from claude bot Mar 31, 2026
@scality scality deleted a comment from claude bot Mar 31, 2026
@scality scality deleted a comment from claude bot Mar 31, 2026
Add optional ACTIONS_APP_ID input and ACTIONS_APP_PRIVATE_KEY secret
to generate a GitHub App token for accessing private org repositories
during dependency installation.
Add checks:read and actions:read permissions required for
CI status verification.
Set up Node.js explicitly before yarn install with a configurable
version (default 22). Add --ignore-scripts to yarn install to prevent
execution of arbitrary postinstall scripts from dependency bumps.
@dvasilas dvasilas force-pushed the fix/dependency-review-dependabot branch from 6c138a0 to 9561dbf Compare March 31, 2026 07:34
pull-requests: write
id-token: write
checks: read
actions: read
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The added checks: read and actions: read permissions aren't used by any of the new steps in this PR (token generation, git config, Node.js setup). If claude-code-action requires them, consider adding a YAML comment explaining why — otherwise remove them to keep least-privilege.

— Claude Code

@claude
Copy link
Copy Markdown

claude bot commented Mar 31, 2026

Solid set of fixes. One minor item:

  • checks: read and actions: read permissions added without clear justification from the new steps
    • If claude-code-action needs them, add a comment explaining why; otherwise remove to maintain least-privilege

Everything else looks good — head SHA checkout for pull_request_target, --ignore-scripts on yarn, GitHub App token generation, allowed_bots, and the .git suffix fix are all correct.

Review by Claude Code

@dvasilas dvasilas merged commit 1980d17 into main Mar 31, 2026
9 checks passed
@dvasilas dvasilas deleted the fix/dependency-review-dependabot branch March 31, 2026 07:44
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.

2 participants