Skip to content

Commit f883f60

Browse files
author
stlc-bot
committed
feat(api-keys): enforce scoped API key permissions (#1038)
Stainless-Generated-From: f48749e
1 parent b48d886 commit f883f60

4 files changed

Lines changed: 20 additions & 16 deletions

File tree

‎src/context/dev/types/monitor_create_response.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,11 @@ class Webhook(BaseModel):
253253
secret: Optional[str] = None
254254
"""Signing secret used to verify webhook authenticity.
255255
256-
Each delivery includes an `X-Context-Signature: t=<unix>,v1=<hmac>` header,
257-
where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret.
258-
Recompute it with a constant-time compare and reject stale timestamps to prevent
259-
replay. Generated by the API; cannot be set by clients.
256+
Omitted unless the API key has monitors:write permission or full access. Each
257+
delivery includes an `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the
258+
HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it
259+
with a constant-time compare and reject stale timestamps to prevent replay.
260+
Generated by the API; cannot be set by clients.
260261
"""
261262

262263

‎src/context/dev/types/monitor_list_response.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,11 @@ class DataWebhook(BaseModel):
254254
secret: Optional[str] = None
255255
"""Signing secret used to verify webhook authenticity.
256256
257-
Each delivery includes an `X-Context-Signature: t=<unix>,v1=<hmac>` header,
258-
where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret.
259-
Recompute it with a constant-time compare and reject stale timestamps to prevent
260-
replay. Generated by the API; cannot be set by clients.
257+
Omitted unless the API key has monitors:write permission or full access. Each
258+
delivery includes an `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the
259+
HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it
260+
with a constant-time compare and reject stale timestamps to prevent replay.
261+
Generated by the API; cannot be set by clients.
261262
"""
262263

263264

‎src/context/dev/types/monitor_retrieve_response.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,11 @@ class Webhook(BaseModel):
253253
secret: Optional[str] = None
254254
"""Signing secret used to verify webhook authenticity.
255255
256-
Each delivery includes an `X-Context-Signature: t=<unix>,v1=<hmac>` header,
257-
where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret.
258-
Recompute it with a constant-time compare and reject stale timestamps to prevent
259-
replay. Generated by the API; cannot be set by clients.
256+
Omitted unless the API key has monitors:write permission or full access. Each
257+
delivery includes an `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the
258+
HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it
259+
with a constant-time compare and reject stale timestamps to prevent replay.
260+
Generated by the API; cannot be set by clients.
260261
"""
261262

262263

‎src/context/dev/types/monitor_update_response.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,11 @@ class Webhook(BaseModel):
253253
secret: Optional[str] = None
254254
"""Signing secret used to verify webhook authenticity.
255255
256-
Each delivery includes an `X-Context-Signature: t=<unix>,v1=<hmac>` header,
257-
where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret.
258-
Recompute it with a constant-time compare and reject stale timestamps to prevent
259-
replay. Generated by the API; cannot be set by clients.
256+
Omitted unless the API key has monitors:write permission or full access. Each
257+
delivery includes an `X-Context-Signature: t=<unix>,v1=<hmac>` header, where the
258+
HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it
259+
with a constant-time compare and reject stale timestamps to prevent replay.
260+
Generated by the API; cannot be set by clients.
260261
"""
261262

262263

0 commit comments

Comments
 (0)