Skip to Content
HeyBug docs
CI

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:

  1. 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.

  2. Never expose HEYBUG_TOKEN to a fork. Don't use pull_request_target to check out and run fork code with secrets. For pull request workflows, skip forks:

    if: github.event.pull_request.head.repo.full_name == github.repository

    With 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.

  3. Pass the token to one step only. Set HEYBUG_TOKEN in the env of the step that runs heybug, 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.

ScopeAllows
run:testsStart a run and wait for the result
read:testsRead 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: 7

Screenshots 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_TOKEN is set only on the step that needs it.
  • The token has only run:tests and read:tests.
  • Tests run against seeded data, not real data.
  • Artifacts expire after 7 days on main.

On this page