Skip to content

Preflight Azure Storage, GitLab, npm, Hugging Face and PyPI credentials - #139

Draft
faddat wants to merge 1 commit into
prooflinedev:mainfrom
faddat:preflight-more-credential-families
Draft

faddat wants to merge 1 commit into
prooflinedev:mainfrom
faddat:preflight-more-credential-families

Conversation

@faddat

@faddat faddat commented Dec 2, 2026

Copy link
Copy Markdown

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:

Kind (as named in the refusal) Match
an Azure Storage account key AccountKey= followed by 88 base64 characters (the 64-byte key with its == padding)
a GitLab token glpat-, gldt- or glrt- followed by 20+ token characters (personal access, deploy and runner tokens)
an npm token npm_ followed by 36 alphanumerics
a Hugging Face token hf_ followed by 34 alphanumerics
a PyPI token pypi-AgEIcHlwaS5vcmc (the base64 macaroon header for pypi.org) followed by 50+ base64url characters

Each is a new TOKEN_SHAPES row, 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

  • Azure matches the key value, not the field. A connection string with AccountKey=<account-key>, AccountKey=${AZURE_STORAGE_KEY} or an empty key is not refused. Only a full-length base64 value is.
  • Azurite's published development key is not refused. 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. TokenShape gains a public list 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_token now takes the TokenShape itself instead of its fields, so the public list travels with the row.
  • Row order is unchanged for existing families, so no existing refusal changes its kind.

Tests

  • credential_families_refuse_minimum_bodies_but_accept_short_or_invalid_ones covers 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_placeholders and azurite_development_key_is_not_a_credential cover 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 that proofline review --include-untracked exits 1 with the file, line and kind, without the secret, makes no HTTP request, and leaves the index untouched. --allow-path for 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: clean
  • cargo clippy --locked --all-targets -- -D warnings: clean
  • cargo test --locked: all suites pass (unit tests 74 passed, local_patch 16 passed, the rest unchanged)
  • No dependency changes, so cargo deny check is unaffected.

Test output (local)

cargo fmt --check                                   -> clean
cargo clippy --locked --all-targets -- -D warnings  -> Finished, no warnings
cargo test --locked                                 -> every suite "test result: ok"
  unittests (lib)                 74 passed (incl. 5 preflight tests, 2 new)
  tests/local_patch.rs            16 passed (incl. cloud_and_registry_credentials_refuse_before_http)
  agent_install, completions, contract, hooks, http, mcp, sarif, scan, update: ok

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

No deployments
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.

Local secret preflight doesn't recognise Azure storage keys, GitLab, npm, Hugging Face or PyPI tokens

1 participant