fix(egress): randomize canary secret env name
This commit is contained in:
@@ -37,9 +37,10 @@ query, headers, body). But the content-based strong tier only matches
|
||||
## Goals / Success Criteria
|
||||
|
||||
1. Each launched bottle has a unique canary token in the agent's environment
|
||||
(`BOT_BOTTLE_CANARY`) and the egress sidecar's environment
|
||||
(`EGRESS_TOKEN_CANARY`). Any outbound appearance of the canary blocks the
|
||||
request with reason `"canary token"`.
|
||||
under a randomized `WORD_WORD_SECRET` env var name. The egress sidecar gets
|
||||
the same env var and registers that exact name through
|
||||
`BOT_BOTTLE_SENSITIVE_PREFIXES`. Any outbound appearance of the canary
|
||||
blocks the request as a known-secret match.
|
||||
2. `scan_known_secrets` accepts a `sensitive_prefixes` parameter (default:
|
||||
`("EGRESS_TOKEN_",)`). `scan_outbound` reads
|
||||
`BOT_BOTTLE_SENSITIVE_PREFIXES` from `environ` and merges those prefixes
|
||||
@@ -77,18 +78,20 @@ query, headers, body). But the content-based strong tier only matches
|
||||
```
|
||||
Egress.prepare()
|
||||
canary = secrets.token_urlsafe(32)
|
||||
EgressPlan(canary=canary, ...)
|
||||
canary_env = <random WORD_WORD_SECRET>
|
||||
EgressPlan(canary=canary, canary_env=canary_env, ...)
|
||||
|
||||
Docker compose render:
|
||||
sidecar env: EGRESS_TOKEN_CANARY=<canary> ← scanned by existing known-secrets detector
|
||||
agent env: BOT_BOTTLE_CANARY=<canary> ← visible to agent as a "secret"
|
||||
sidecar env: <canary_env>=<canary>
|
||||
sidecar env: BOT_BOTTLE_SENSITIVE_PREFIXES=<canary_env>
|
||||
agent env: <canary_env>=<canary> ← visible to agent as a "secret"
|
||||
|
||||
macos-container launch: same literals added to sidecar + agent env entries
|
||||
```
|
||||
|
||||
`EGRESS_TOKEN_CANARY` matches the `EGRESS_TOKEN_` prefix already scanned by
|
||||
`scan_known_secrets`, so no detector code changes are required for canary
|
||||
detection — only the injection path.
|
||||
The sidecar uses `BOT_BOTTLE_SENSITIVE_PREFIXES` to make the random canary env
|
||||
name part of the existing `scan_known_secrets` detector without adding a
|
||||
manifest schema field.
|
||||
|
||||
### Broadened known-value scanning
|
||||
|
||||
|
||||
Reference in New Issue
Block a user