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 that 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). The signature must use the key
that Github-Public-Key-Identifier names, one of the keys that GitHub
publishes at https://api.github.com/meta/public_keys/secret_scanning. The API
revokes every live API token that GitHub found immediately. Its owner gets a
security notice by email, and the audit log of the organization records
token.leaked (actor github-secret-scanning, meta: token name, url, source).
The answer lists the revoked tokens as true_positive, by the hex SHA-256 of
the token. It leaves out tokens that are not ours or that were already revoked.
Public (the signature is the authentication) and rate limited per client IP.
Answers 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 body lists the revoked tokens.
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, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/bad_request", "title": "Bad Request", "status": 400, "code": "bad_request", "detail": "The JSON in the request is not valid (unexpected end of JSON input). Correct the JSON and try again.", "request_id": "5f2c9a0e7b1d4c38"}Not authenticated.
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/unauthenticated", "title": "Unauthorized", "status": 401, "code": "unauthenticated", "detail": "You are not signed in, or your sign-in ended. Sign in again to continue.", "request_id": "5f2c9a0e7b1d4c38"}Not found (also for resources of another organization).
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/not_found", "title": "Not Found", "status": 404, "code": "not_found", "detail": "We did not find that. The link is wrong, or the item no longer exists.", "request_id": "5f2c9a0e7b1d4c38"}Rate limited (rate_limited). For an API token, the organization used all of the rate of its plan until RateLimit-Reset.
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/rate_limited", "title": "Too Many Requests", "status": 429, "code": "rate_limited", "detail": "You sent too many requests in a short time. Wait a moment, then try again.", "request_id": "5f2c9a0e7b1d4c38", "retry_after": 6}Headers
Section titled “Headers”On every response to an API token: the rate of the plan of the organization, in requests per one-minute window (api_requests_per_minute).
On every response to an API token: the requests left to the organization in the current window.
On every response to an API token: the seconds until the current window ends and the count resets.
On every response to an API token: the quota policy, <limit>;w=60.
The API failed to read the GitHub signing keys (internal). GitHub tries again.
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (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"}