Harden update-search workflow to prevent GitHub App token leakage - #96
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the scheduled “update-search” GitHub Actions workflow for the Jekyll site by eliminating a credential-persistence path and adding defensive checks to prevent symlink-based token exfiltration when importing search_db.json from the external comphy-search repository.
Changes:
- Disable persisted git credentials during checkout (
persist-credentials: false) to avoid leaving the GitHub App token in the repo’s git config. - Validate the imported
comphy-search/search_db.json(exists, not a symlink, valid JSON viajq empty) before copying. - Push via an explicit HTTPS URL containing the short-lived App token at push-time instead of relying on checkout-persisted credentials.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
actions/checkoutand relied on the checkout to persist credentials, which allowed a malicious symlinkedsearch_db.jsonfrom an external repo to dereference and leak the token into a committed file.Description
persist-credentials: falseto theactions/checkoutstep.test -f, asserting it is not a symlink withtest ! -L, and confirming it is valid JSON withjq emptybefore copying.cp --no-dereferenceto avoid following symlinks when copyingcomphy-search/search_db.jsonintoassets/js/search_db.json.https://x-access-token:${APP_TOKEN}@github.com/${GITHUB_REPOSITORY}.git) instead of relying on credentials persisted by checkout.Testing
./scripts/lint-check.shand the script completed successfully.search_db.jsonand confirming the workflow steps block the copy); the simulation output showed the symlinked file was blocked.Codex Task