Skip to content

fix: SecretStr for the OAuth token, gitleaks 8.30.1 in CI, bare y0_ token rule - #611

Merged
bim-ba merged 3 commits into
mainfrom
fix/secret-token-gitleaks
Nov 19, 2026
Merged

bim-ba merged 3 commits into
mainfrom
fix/secret-token-gitleaks

Conversation

@bim-ba

@bim-ba bim-ba commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Summary

src/ycli/yandex/status/oauth_models.py   TokenResponse.access_token: str -> SecretStr  (#579, option 2)
src/ycli/yandex/status/cli.py            device flow reads it with get_secret_value()
.github/workflows/ci.yml                 gitleaks-action: GITLEAKS_VERSION 8.30.1 (= pre-commit; was the action's 8.24.3)
.gitleaks.toml                           defaults + rule yandex-oauth-token: y0_[A-Za-z0-9_-]{40,}

Evidence

  • Before: repr(TokenResponse(access_token="tok-abc")) showed the token; a bare y0_ token passed gitleaks.
    After:
    • test_a_token_response_does_not_show_the_token_in_its_repr and the repr assertion in test_poll_token_success pass; uv run pytest -> 8144 passed, 5 skipped, coverage 100.00%.
    • gitleaks 8.30.1 with seeded fakes in a scratch directory outside the repo (57-char y0_ token): default config -> no leaks; new config -> 3 findings, all yandex-oauth-token, in the curl header, the JSON value and the plain-text file; a file with the repo-style short literals (y0_abcdefgh, y0_ + 30) -> not caught.
    • New config over the whole working tree: no leaks found. The existing y0_ literals in the repo are 8-33 characters. Full-history scan was not completed (about 15 CPU-minutes of work, stopped); the three commits of this PR are clean.
    • The input name GITLEAKS_VERSION ("no v prefix") is from the action README at the pinned SHA e0c47f4f. The action picks .gitleaks.toml up from the repo root through the gitleaks CLI; not exercised here, CI will show it.

Merge Danger

Door: two-way

Blast Radius: CI secret scan

A new gitleaks version and a new rule can surface findings in history on the first CI run; the gitleaks check is required.

🤖 Generated with Claude Code

bim-ba and others added 3 commits November 19, 2026 02:08
access_token was a plain str, so repr, a traceback or a log line showed
the token. It is a SecretStr now; the device flow reads it with
get_secret_value().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The action pinned 8.24.3 while .pre-commit-config.yaml runs 8.30.1, so a
secret could pass one gate and fail the other. GITLEAKS_VERSION is the
action's documented input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The default rules do not know the y0_ token shape, so a token pasted
without a key name passed both gates. One rule on top of the defaults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bim-ba

bim-ba commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

мержи

@bim-ba
bim-ba merged commit 40180d2 into main Nov 19, 2026
12 of 13 checks passed
@bim-ba
bim-ba deleted the fix/secret-token-gitleaks branch November 19, 2026 19:45

This branch had an error being deployed

1 failed deployment
yandex-e2e — 66213303 Deployed Nov 19, 2026 by bim-ba via prepare #761
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.

1 participant