`upload-sarif` fails with `Resource not accessible by integration`
BeginnerTroubleshootingSAST, SCA and secrets scanning in CI
Answer
Likely causes → The GITHUB_TOKEN lacks security-events: write, often because the org default is read-only, or the run is from a fork.
Diagnose → Check the workflow's permissions: block and the run's "Set up job" log, which lists granted permissions.
Fix →
permissions:
contents: read
security-events: write
For fork PRs, upload from a workflow_run workflow instead of granting write to untrusted code.
Prevent → Declare least-privilege permissions: per job in every workflow.
More on SAST, SCA and secrets scanning in CI
gitleaks fails the PR on `tests/fixtures/fake_rsa.pem` and `testdata/aws_creds.json`, which only contain dummy valuesBeginnergitleaks passes locally but the CI job reports 40 old leaks nobody touched in this PRIntermediate`fatal: ambiguous argument 'origin/main..HEAD': unknown revision` in the secrets-scan stepBeginnerSemgrep flags `subprocess.run(cmd, shell=True)` in a script where `cmd` is a hard-coded constantBeginnerSemgrep in CI reports findings in `node_modules/`, `vendor/` and minified `dist/*.js`BeginnerSemgrep job takes 35 minutes and gets killed with `exit code 137`Intermediate