Skip to content

Conversation

@landongrindheim
Copy link
Member

All of our TypeScript builds have failed in this project because we check to see if the dist/ directory matches what is in the pull request. Dependabot will open a pull request with changes to the manifest/lock files, but it won't build the dependencies. By building them and committing, we should be able to pass the check we're enforcing.

Note: I'm using [dependabot skip] in the commit message as it will allow Dependabot to rebase/recreate changes. Without that, the PR will be left open (and new changes will not be proposed).

All of our TypeScript builds have failed in this project because we
check to see if the `dist/` directory matches what is in the pull
request. Dependabot will open a pull request with changes to the
manifest/lock files, but it won't build the dependencies. By building
them and committing, we should be able to pass the check we're
enforcing.

Note: I'm using `[dependabot skip]` in the commit message as it will
allow Dependabot to rebase/recreate changes. Without that, the PR will
be left open (and new changes will not be proposed).
@segiddins
Copy link
Contributor

The issue here is that it runs arbitrary, unreviewed code in a trusted context (with GH tokens that have escalated permissions). For this to be safe, it needs to be split into multiple jobs. Anything running arbitrary code needs to have restricted permissions (e.g. no write), and that job can save the updated output as an artifact that a dependent job can download and then push, so long as the dependent job doesn't execute any code from the dependencies in the updated package.json

The commit stage requires access to GITHUB_TOKEN, which has  elevated
permissions. `npm run build` has the potential to run scripts that
execute arbitrary code, so we need to ensure that step does not have
access to GITHUB_TOKEN.
`npm run all` ran tests and linting. That behavior is fine, but a
failure in this step due to those concerns would be misleading.
@landongrindheim
Copy link
Member Author

@segiddins Can you take another look? I've split the workflows to guard ensure GITHUB_TOKEN isn't available when running npm scripts, and updated the actor check to prevent spoofing.

Co-authored-by: Samuel Giddins <segiddins@segiddins.me>
@landongrindheim
Copy link
Member Author

@segiddins @colby-swandale I don't have merge rights in this repo. Could one of you take care of that? 🙇

@segiddins segiddins merged commit 651f998 into rubygems:main Aug 15, 2025
9 of 13 checks passed
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