Skip to content

fix(security): remove the hardcoded Cloudflare token — use wrangler OAuth - #32

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/remove-hardcoded-cloudflare-token
Aug 6, 2026
Merged

fix(security): remove the hardcoded Cloudflare token — use wrangler OAuth#32
hyperpolymath merged 1 commit into
mainfrom
fix/remove-hardcoded-cloudflare-token

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

deploy-repos.sh exported a live CLOUDFLARE_API_TOKEN on line 5, in a public repository, and in git history.

The token was never necessary

This is a local developer script — it runs wrangler against $HOME/Documents/hyperpolymath-repos, not in CI. wrangler login (OAuth) covers it completely: the session lives in ~/.config/.wrangler/, no long-lived credential exists at all, and it is revocable from the dashboard.

The token existed because export TOKEN=… needs no setup step and OAuth needs one. The cheapest option at authoring time became a published credential — and it survived because nothing scanned this repository until yesterday.

So this deletes rather than relocates it. There is nothing to move into a secret store, because nothing needs a secret.

What is kept, and why

The account id is not a secret. Cloudflare treats it as an ordinary identifier and it appears in dashboard URLs. It earns its place because this login can see more than one account. A comment now says so — so nobody "tidies" it into a secret store, and nobody reintroduces the token beside it.

Also switched deno run -A npm:wranglerbunx wrangler, per the Bun-over-Deno ruling. Both runtimes are installed locally; one-word change.

The allowlist deliberately does not cover source or scripts

.gitleaks.toml handles the four remaining findings, all benign:

  • telegram-bot/deno.lock — content-addressed integrity hashes
  • telegram-bot/README.md, NEXT-STEPS.md — setup docs describing where a bot token goes
  • avow-lib/ffi/zig/src/example.zig — carries the literal .token = "abc123def456..." next to the comment // Would be real token

Verified in both directions:

findings
with the allowlist 0
after re-introducing a token into deploy-repos.sh 1 — still caught

That second row is the one that matters. An allowlist that reopened the exact hole this repository just had would be worse than having no scanner.

⚠ The exposed token must still be revoked

Removing it from the file does not un-publish it. It has been readable by anyone for as long as this repo has been public, and public repos are continuously scraped.

Dashboard → My Profile → API Tokens → delete it. No replacement is needed once wrangler login has been run once.

Companion to #31 (which adds the scanner that found this). Merging both leaves the repo scanned and clean.

🤖 Generated with Claude Code

…Auth

deploy-repos.sh exported a live CLOUDFLARE_API_TOKEN on line 5, in a PUBLIC
repository, and in git history.

THE TOKEN WAS NEVER NECESSARY. This is a local developer script — it runs
wrangler against $HOME/Documents/hyperpolymath-repos, not in CI. `wrangler
login` (OAuth) covers it completely: the session lives in ~/.config/.wrangler/,
no long-lived credential exists, and it is revocable from the dashboard. The
token existed because `export TOKEN=...` needs no setup step and OAuth needs
one. The cheapest option at authoring time became a published credential.

So this deletes rather than relocates it. There is nothing to move to a
secret store, because nothing needs a secret.

The account id on the next line is KEPT and is not a secret: Cloudflare treats
it as an ordinary identifier and it appears in dashboard URLs. It earns its
place because this login can see more than one account. A comment now says so,
so nobody "tidies" it into a secret and nobody reintroduces the token beside it.

Also switched `deno run -A npm:wrangler` to `bunx wrangler`, per the
Bun-over-Deno ruling. Both runtimes are installed; this is a one-word change.

Added .gitleaks.toml for the four remaining findings, all benign: deno.lock
integrity hashes, two setup docs describing where a bot token goes, and an
example carrying the literal `.token = "abc123def456..."` next to the comment
`// Would be real token`.

The exclusions are deliberately narrow and NOTHING in source or scripts is
suppressed. VERIFIED in both directions: findings go to 0, and re-introducing
a token into deploy-repos.sh is still caught. An allowlist that reopened the
hole this repository just had would be worse than no scanner.

⚠ THE EXPOSED TOKEN MUST STILL BE REVOKED. It has been public; removing it
from the file does not un-publish it. Dashboard → My Profile → API Tokens.
No replacement is needed once wrangler login is done.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

Automatic reviews are paused because your trial's included automatic processing has been used for this period. Upgrade now, or comment "Gitar review" to run a review anytime.
Learn more

Code Review ✅ Approved

Removes the hardcoded Cloudflare API token from the deployment script in favor of wrangler OAuth authentication, and updates the runner command from Deno to Bun. No issues found.

Auto-approved and auto-merge armed: No blocking issues found.
Please see Auto-approve Docs for details on setting custom approval criteria. — merges when pipeline and required approvals pass.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Important

Your trial ends in 4 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.

Was this helpful? React with 👍 / 👎 | Gitar

@gitar-bot

gitar-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

⚠️ Gitar auto-approved this PR but could not enable auto-merge: auto-merge is disabled for this repository — enable "Allow auto-merge" in the repository settings.

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitar has auto-approved this PR and enabled auto-merge (configure)

@gitar-bot gitar-bot Bot added the gitar-approved Added by Gitar label Aug 6, 2026
@hyperpolymath
hyperpolymath merged commit 9f7c3d2 into main Aug 6, 2026
14 of 17 checks passed
@hyperpolymath
hyperpolymath deleted the fix/remove-hardcoded-cloudflare-token branch August 6, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gitar-approved Added by Gitar

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant