Leaked-token alerts from GitHub secret scanning.
const url = 'https://api.opdns.io/v1/webhooks/token-leak';const options = { method: 'POST', headers: { 'Github-Public-Key-Identifier': 'example', 'Github-Public-Key-Signature': 'example', 'Content-Type': 'application/json' }, body: '[{"token":"opdns_exampleexampleexampleexampleexampleexampleexample","type":"opdns_api_token","url":"https://github.com/octo/repo/blob/abc/config.env","source":"content"}]'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.opdns.io/v1/webhooks/token-leak \ --header 'Content-Type: application/json' \ --header 'Github-Public-Key-Identifier: example' \ --header 'Github-Public-Key-Signature: example' \ --data '[ { "token": "opdns_exampleexampleexampleexampleexampleexampleexample", "type": "opdns_api_token", "url": "https://github.com/octo/repo/blob/abc/config.env", "source": "content" } ]'GitHub secret scanning partner endpoint. GitHub posts the
matches of the opdns_ token pattern it found in public code. The
raw body must carry a valid ECDSA P-256 SHA-256 signature
(Github-Public-Key-Signature, base64 ASN.1) made with the key named by
Github-Public-Key-Identifier, one of the keys GitHub publishes at
https://api.github.com/meta/public_keys/secret_scanning. Every live API
token found is revoked at once, its owner gets a security notice by
email and the organisation’s audit log records token.leaked (actor
github-secret-scanning, meta: token name, url, source). The answer
lists the tokens revoked as true_positive, by the hex SHA-256 of the
token; tokens that are not ours or were already revoked are left out.
Public (the signature is the authentication) and rate limited per
client IP; 404 when the deployment turned the webhook off.
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
[ { "token": "opdns_exampleexampleexampleexampleexampleexampleexample", "type": "opdns_api_token", "url": "https://github.com/octo/repo/blob/abc/config.env", "source": "content" }]Responses
Section titled “Responses”Processed; the tokens revoked.
object
Hex SHA-256 of the reported token.
Example
[ { "token_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", "token_type": "opdns_api_token", "label": "true_positive" }]Malformed request.
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/bad_request", "title": "Bad Request", "status": 400, "code": "bad_request", "detail": "We couldn't read the request because its JSON isn't valid (unexpected end of JSON input). Please fix it and try again.", "request_id": "5f2c9a0e7b1d4c38"}Not authenticated.
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/unauthenticated", "title": "Unauthorized", "status": 401, "code": "unauthenticated", "detail": "You're not signed in, or your sign-in has ended. Please sign in again to continue.", "request_id": "5f2c9a0e7b1d4c38"}Not found (also for resources of another organisation).
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/not_found", "title": "Not Found", "status": 404, "code": "not_found", "detail": "We couldn't find that. It may have been deleted, or the link may be wrong.", "request_id": "5f2c9a0e7b1d4c38"}Rate limited (rate_limited). For an API token, the organisation’s plan rate is spent until RateLimit-Reset.
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/rate_limited", "title": "Too Many Requests", "status": 429, "code": "rate_limited", "detail": "Too many requests in a short time. Please wait a moment, then try again.", "request_id": "5f2c9a0e7b1d4c38", "retry_after": 6}Headers
Section titled “Headers”On every response to an API token: the organisation’s plan rate, requests per one-minute window (api_requests_per_minute).
On every response to an API token: the requests left to the organisation in the current window.
On every response to an API token: seconds until the current window ends and the count resets.
On every response to an API token: the quota policy, <limit>;w=60.
GitHub’s signing keys could not be read (internal); GitHub retries.
object
Stable machine code.
object
Seconds, repeating the Retry-After header (rate limits, offline nodes).
The plan limit a plan_limit problem hit.
object
The plan’s value of the limit.
Where to move to a larger plan.
The scope the API token lacked (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/internal", "title": "Service Unavailable", "status": 503, "code": "internal", "detail": "the secret scanning signing keys could not be read; retry later", "request_id": "5f2c9a0e7b1d4c38"}