Repository navigation
Conversation
Add the five credential families from prooflinedev#86 to TOKEN_SHAPES so a local patch that adds one is refused before upload, like the existing AWS, GitHub and Stripe rows. Azure is matched on the AccountKey= value of a connection string, and Azurite's published development key is not refused. Closes prooflinedev#86
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #86
What this adds
The local secret preflight now refuses a patch that adds any of the five credential families #86 lists, before any patch bytes leave the checkout:
AccountKey=followed by 88 base64 characters (the 64-byte key with its==padding)glpat-,gldt-orglrt-followed by 20+ token characters (personal access, deploy and runner tokens)npm_followed by 36 alphanumericshf_followed by 34 alphanumericspypi-AgEIcHlwaS5vcmc(the base64 macaroon header forpypi.org) followed by 50+ base64url charactersEach is a new
TOKEN_SHAPESrow, so it keeps the prefix-plus-minimum-body design and the existing message:local patch contains an Azure Storage account key at "appsettings.json":2 (new line); remove it before upload, or pass --allow-path for that exact path. The value is never printed.Design notes
AccountKey=<account-key>,AccountKey=${AZURE_STORAGE_KEY}or an empty key is not refused. Only a full-length base64 value is.devstoreaccount1's key is documented by Microsoft and appears in many test configs and docker-compose files, so refusing it would be a false positive.TokenShapegains apubliclist for bodies like this. It is empty for every other row, and a key differing from Azurite's by one character is still refused.has_tokennow takes theTokenShapeitself instead of its fields, so the public list travels with the row.Tests
credential_families_refuse_minimum_bodies_but_accept_short_or_invalid_onescovers the five new rows the same way it covers the old ones: a minimum-length body is refused, and one character short or an invalid final byte is accepted.azure_connection_strings_refuse_account_keys_but_accept_placeholdersandazurite_development_key_is_not_a_credentialcover the Azure-specific cases.cloud_and_registry_credentials_refuse_before_http(tests/local_patch.rs) runs the real binary against a loopback console. It writes each family into a typical file (appsettings.json,.gitlab-ci.yml,.npmrc,train.py,.pypirc) and checks thatproofline review --include-untrackedexits 1 with the file, line and kind, without the secret, makes no HTTP request, and leaves the index untouched.--allow-pathfor that exact path then uploads.All sample values are filler characters in the right shape, not real credentials.
Docs
README: one paragraph under "Reviews, history, and reruns" lists what the preflight refuses, including the new families and the Azurite exception.
Checks run locally (Rust 1.100.0, Linux x86_64)
cargo fmt --check: cleancargo clippy --locked --all-targets -- -D warnings: cleancargo test --locked: all suites pass (unit tests 74 passed, local_patch 16 passed, the rest unchanged)cargo deny checkis unaffected.Test output (local)