Skip to content

Add Veles secret detector and validator for Replicate API tokens#2216

Open
cherry-bisht wants to merge 1 commit into
google:mainfrom
cherry-bisht:veles-add-replicate-api-token
Open

Add Veles secret detector and validator for Replicate API tokens#2216
cherry-bisht wants to merge 1 commit into
google:mainfrom
cherry-bisht:veles-add-replicate-api-token

Conversation

@cherry-bisht

Copy link
Copy Markdown

Summary

Adds a new Veles secret-scanning plugin for Replicate API tokens (prefix
r8_ followed by 37 characters from [A-Za-z0-9_-]).

  • Detector (veles/secrets/replicateapitoken): uses the shared
    simpletoken helper to match r8_[A-Za-z0-9_-]{37}.
  • Validator: confirms liveness via GET https://api.replicate.com/v1/account
    with the token in the Authorization header using Replicate's Token
    scheme (not Bearer) — HTTP 200 → valid, 401 → invalid.

Changes

  • New package veles/secrets/replicateapitoken (Secret type, detector,
    validator) with detector and validator unit tests, including an acceptance
    test and a case covering -/_ in the token body.
  • binary/proto/scan_result.proto: new SecretData.ReplicateAPIToken message
    and replicate_api_token oneof field; regenerated scan_result.pb.go.
  • binary/proto/secret.go: proto ↔ struct conversions for the new type.
  • Registered the detector and validator in the extractor and enricher
    list.go files.
  • Documented the new type in docs/supported_inventory_types.md.

Testing

  • go build ./..., go vet, gofmt clean.
  • go test ./veles/secrets/replicateapitoken/... ./binary/proto/... and the
    list packages — all pass.
  • Verified end-to-end with the scalibr CLI against a file containing a
    sample token: detection produces SecretData.replicate_api_token, and the
    validator correctly reaches api.replicate.com and classifies the token.

Adds a new secret-scanning plugin for Replicate API tokens (prefix `r8_`
followed by 37 characters from [A-Za-z0-9_-]). The detector uses the shared
simpletoken helper; the validator confirms liveness via a GET request to the
Replicate account endpoint (https://api.replicate.com/v1/account) with the
token in the Authorization header using the "Token" scheme: HTTP 200 ->
valid, 401 -> invalid.

- New package veles/secrets/replicateapitoken: Secret type, detector,
  validator, and detector/validator unit tests (including an acceptance test).
- Proto: new SecretData.ReplicateAPIToken message and replicate_api_token
  oneof field, with conversions in binary/proto/secret.go.
- Registers the detector and validator in the extractor and enricher lists.
- Documents the new type in docs/supported_inventory_types.md.
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