Skip to content

ci(security): run the API secret scan unauthenticated - #234

Merged
Gregory91G merged 2 commits into
mainfrom
ci/trufflehog-api-unauthenticated
Jul 29, 2026
Merged

ci(security): run the API secret scan unauthenticated#234
Gregory91G merged 2 commits into
mainfrom
ci/trufflehog-api-unauthenticated

Conversation

@Gregory91G

@Gregory91G Gregory91G commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes the secrets (GitHub API) job, which failed on main immediately after #230 merged:

error running scan: fatal: error getting user:
GET https://api.github.com/user: 403 Resource not accessible by integration

Cause

TruffleHog's GitHub source calls GET /user to identify whose token it holds. GITHUB_TOKEN is an installation token and cannot read that endpoint, and there is no flag to skip the call — so GITHUB_TOKEN is unusable for this source, full stop.

This repository is public, so the scan needs no token at all. Measured unauthenticated: 8651 chunks in 8 seconds, the same coverage the authenticated run produced locally (8608 chunks), and 0 findings either way.

Why review did not catch it

The job is skipped on pull requests by design — it depends on API availability, so a transient outage must not colour a PR. That made the push to main its first real execution. The lesson is on me: a job that never runs in the PR that introduces it needs a manual dispatch before merge, not after.

Test plan

  • YAML parses, actionlint clean
  • Unauthenticated scan run for real against this repository — exit 0, 8651 chunks, 0 findings
  • Same fix applied to constructorfabric/insight, where the job has not merged yet, so the failure never reached its main
  • secrets (GitHub API) green on main — verified by this PR's own merge, since that is the only event that runs it

Refs constructorfabric/insight#2079

Summary by CodeRabbit

  • Chores
    • Updated automated secret scanning to run without GitHub authentication.
    • Continued scanning comments, wikis, and otherwise unreachable repository objects.
    • Preserved redacted reporting of scan results.

Fixes the job that failed on main right after #230 merged:
`403 Resource not accessible by integration` from `GET /user`.

TruffleHog's GitHub source calls `/user` to identify whose token it holds, and an
installation token cannot read that endpoint. There is no flag to skip the call, so
`GITHUB_TOKEN` is unusable for this source. This repository is public, so the scan
needs no token — measured unauthenticated: 8651 chunks in 8 seconds, the same
coverage the token-authenticated run produced, and 0 findings either way.

Caught by running it for real rather than by review: on pull requests this job is
skipped by design, so the first execution was the push to main.

Refs #231

Signed-off-by: Grigoriy Gogin <Grigoriy.Gogin@constructor.tech>
@Gregory91G
Gregory91G requested a review from a team as a code owner July 29, 2026 12:16
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Gregory91G, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a543ac3f-e59d-47dc-b550-a84084be6ec0

📥 Commits

Reviewing files that changed from the base of the PR and between 77ddaf7 and 3ff478c.

📒 Files selected for processing (3)
  • .github/workflows/docker.yml
  • .github/workflows/trivy.yml
  • .github/workflows/trufflehog.yml
📝 Walkthrough

Walkthrough

The secrets-api workflow scan now runs the TruffleHog GitHub API container without injecting GITHUB_TOKEN; the scan command and redacted reporting step remain unchanged.

Changes

TruffleHog scan configuration

Layer / File(s) Summary
Remove authenticated scan execution
.github/workflows/trufflehog.yml
The secrets-api job removes GITHUB_TOKEN injection from the TruffleHog container while retaining the existing scan and reporting steps.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: ktursunov, aleksdotbar, artifizer

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: running the GitHub API secret scan without authentication.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/trufflehog-api-unauthenticated

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Gregory91G added a commit that referenced this pull request Jul 29, 2026
Same fix as #234, carried here so this branch is self-consistent: GITHUB_TOKEN
cannot be used with TruffleHog's GitHub source, which calls GET /user and gets
403 for an installation token. The repository is public, so no token is needed.

Refs #231

Signed-off-by: Grigoriy Gogin <Grigoriy.Gogin@constructor.tech>
@Gregory91G Gregory91G self-assigned this Jul 29, 2026
Carries @cyberantonz's second review pass from constructorfabric/insight#2016 over
to this repository, where the same code runs.

The summary steps parsed every line with a bare `json.loads`, so one truncated
line would kill the report on a job that exists to report. Parsing is now guarded:
an unparsable line is counted, and a record without `DetectorName` is not a
finding and no longer inflates the count. Both counters print when non-zero, so
nothing is dropped silently.

Verified on a file with two real findings, one truncated line and one valid
non-finding record: exit 0, "1 unparsable line(s), 1 non-finding record(s)
skipped", 2 findings reported.

Comments lost the rationale and the measurements that would rot — why MEDIUM/LOW
was reverted, chunk counts, finding counts. What stayed is compressed to the
invariant a maintainer must not break: keep this scan unauthenticated, do not
switch to `--ignorefile`.

Refs #231

Signed-off-by: Grigoriy Gogin <Grigoriy.Gogin@constructor.tech>
@Gregory91G
Gregory91G merged commit 0a5cd05 into main Jul 29, 2026
18 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.

2 participants