CI security
A CI workflow that calls HeyBug holds a token and talks to your app.
A CI workflow that calls HeyBug holds a token and talks to your app. Three things keep that safe: fork rules, small token scopes and short artifact retention.
Fork pull requests
Workflows triggered by deployment_status run on the base repository. They get your repository secrets, even when the pull request came from a fork. A stranger can open a fork pull request, change the code that gets deployed, and have your workflow run with HEYBUG_TOKEN in its environment.
Do these three things:
-
Require approval for fork pull requests. In the repository settings, open Actions, then General, and choose "Require approval for all outside collaborators" for fork pull request workflows. Read the change before you approve it.
-
Never expose
HEYBUG_TOKENto a fork. Don't usepull_request_targetto check out and run fork code with secrets. For pull request workflows, skip forks:if: github.event.pull_request.head.repo.full_name == github.repositoryWith
deployment_status, only test deployments for branches in your own repository, and keep the job free of steps that run code from the pull request with the token set. -
Pass the token to one step only. Set
HEYBUG_TOKENin theenvof the step that runsheybug, not at the top of the workflow, and never print it. GitHub masks secrets in logs, but derived values (such as a base64 copy) are not masked.
Dependabot pull requests also get a restricted secret set. Either add HEYBUG_TOKEN to the Dependabot secrets, or skip them with github.actor != 'dependabot[bot]'.
If a token may have leaked, revoke it in the HeyBug settings and create a new one. A revoked token stops working at once.
Token scopes
Give a CI token only what it needs.
| Scope | Allows |
|---|---|
run:tests | Start a run and wait for the result |
read:tests | Read run results, cases and artifacts |
A CI token needs these two and nothing else. It can't change projects, members, billing or other tokens. Use one token per repository, so you can revoke one without breaking the rest, and name it after the repository.
Artifact retention
Runs keep screenshots, traces and logs. Suggested retention:
- 7 days for runs on your main branch. It covers a release cycle and bounds storage.
- Pull request runs: 7 days at most, and shorter if you can live with that. Most teams don't need them after the pull request is merged.
If you also upload the summary file as a GitHub artifact, set the same limit:
- uses: actions/upload-artifact@v4
if: always()
with:
name: heybug-summary
path: heybug-summary.json
retention-days: 7Screenshots can show real user data if a test ran against production data. Test against seeded data, as in Preview recipes, and keep retention short.
Checklist
- Fork pull requests need approval.
-
HEYBUG_TOKENis set only on the step that needs it. - The token has only
run:testsandread:tests. - Tests run against seeded data, not real data.
- Artifacts expire after 7 days on main.