Skip to content

feat(obs): the PII boundary is enforced in flight, not trusted (P22) - #507

Merged
athvin merged 1 commit into
mainfrom
bm/telemetry-p22-attr-allowlist
Nov 5, 2026
Merged

athvin merged 1 commit into
mainfrom
bm/telemetry-p22-attr-allowlist

Conversation

@athvin

@athvin athvin commented Nov 5, 2026

Copy link
Copy Markdown
Owner

What

§10.4 is the one prohibition this system has: telemetry carries identifiers
and counts, never attribute values
. Three things already upheld it:

  • sql_span has no parameter argument, so there is nowhere to put a bind value
  • er_span::attr declares three names Pii::Never
  • sql_span_pii.rs fails the build if product code names one

All three are about what the code does. None of them is a boundary.

This adds one: a transform/pii_allowlist processor whose keep_keys drops
every span attribute not named. An allowlist, so an attribute nobody
anticipated does not ship merely because nobody thought to forbid it.
Fail-closed by construction — forgetting an attribute loses a field rather
than leaking one, which is the right way round for an engine whose payload is
names and addresses. A denylist has the opposite failure mode.

It sits before tail_sampling, which reads attributes (the
ui-interactions policy keys on er.action), and both precede batch, which
would otherwise hand the sampler trace fragments. A test asserts that ordering
rather than leaving it to whoever next edits the pipeline list.

The list was measured, not derived

source found
scan of every span macro in the workspace 37 names
a real exported Parquet file from the dev collector 8 more

The eight are what tracing-opentelemetry adds on its own: busy_ns,
idle_ns, thread.*, code.*, target. Keeping only the 37 would have
silently dropped the CPU-versus-wall-time split, which is among the most
useful things on a stage span — and the symptom would have been a field nobody
could find, with the code right and the deploy green.

That is the cost of a fail-closed allowlist, and it is why the values file says
to look there first when an attribute goes missing.

The gate, and what it caught

collector_allowlist.rs asserts three things:

  1. every span attribute the Rust emits survives the allowlist
  2. no Pii::Never name is admitted by it
  3. the processor precedes sampling

It immediately found service.name and service.version, which init.rs
sets as fields on the process span — distinct from the resource attributes of
the same names. Without the gate the process span would have lost its own
identity while the resource kept it, which is the confusing half of a drop.

It reads both spellings of a span field: a bare er.foo = … and the
{ attr::FOO } = … form sql_span uses. Missing the second would have made it
blind to exactly the attributes that matter most.

Its honest limit is in its own docs: SDK-added attributes appear in no span
macro, so nothing can derive them, and a dependency bump that renames one will
drop it again with no test failing. Re-measure after a bump.

Verification

Gate observed failing (er.statement removed from the list) before being
trusted. make check → exit 0.

🤖 Generated with Claude Code

§10.4 is the one prohibition this system has: telemetry carries identifiers
and counts, never attribute values. Three things already upheld it in code —
`sql_span` has no parameter argument so there is nowhere to put a bind value,
`er_span::attr` declares three names `Pii::Never`, and `sql_span_pii.rs`
fails the build if product code names one. All three are about what the code
does. None of them is a boundary.

This is the layer underneath: a `transform/pii_allowlist` processor whose
`keep_keys` drops every span attribute not named. An ALLOWLIST, so an
attribute nobody anticipated does not ship merely because nobody thought to
forbid it. Fail-closed by construction — forgetting an attribute loses a
field rather than leaking one, which is the right way round for an engine
whose payload is names and addresses. A denylist has the opposite failure
mode.

It sits BEFORE `tail_sampling`, which reads attributes — the `ui-interactions`
policy keys on `er.action` — and both precede `batch`, which would otherwise
hand the sampler trace fragments. A test asserts that ordering rather than
leaving it to whoever next edits the pipeline list.

## The list was measured, not derived

A scan of every span macro in the workspace found 37 names. Reading a REAL
exported Parquet file from the dev collector found eight more that
`tracing-opentelemetry` adds on its own: `busy_ns`, `idle_ns`, `thread.*`,
`code.*` and `target`. Keeping only the 37 would have silently dropped the
CPU-versus-wall-time split, which is among the most useful things on a stage
span — and the symptom would have been a field nobody could find, with the
code right and the deploy green.

That is the cost of a fail-closed allowlist and it is why the values file says
to look there first when an attribute goes missing.

## The gate, and what it caught

`collector_allowlist.rs` asserts three things: every span attribute the Rust
emits survives the allowlist, no `Pii::Never` name is admitted by it, and the
processor precedes sampling.

It immediately found `service.name` and `service.version`, which `init.rs`
sets as FIELDS on the process span — distinct from the resource attributes of
the same names. Without the gate the process span would have lost its own
identity while the resource kept it, which is the confusing half of a drop.

It reads both spellings of a span field: a bare `er.foo = …` and the
`{ attr::FOO } = …` form `sql_span` uses. Missing the second would have made
it blind to exactly the attributes that matter most.

Its honest limit is recorded in its own docs: SDK-added attributes appear in
no span macro, so nothing can derive them, and a dependency bump that renames
one will drop it again with no test failing. Re-measure after a bump.

make check exit 0.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit d4dae45 into main Nov 5, 2026
39 checks passed
@athvin
athvin deleted the bm/telemetry-p22-attr-allowlist branch November 5, 2026 13:52
athvin added a commit that referenced this pull request Nov 5, 2026
* fix(ci): a platform-only change merges green and never deploys

`deploy.yml` fires only on `workflow_run: [images]`, and `images` only runs
when something that goes INTO an image changes. So a commit touching just
`infra/k8s/**` builds nothing, `images` never runs, and this workflow never
fires — while `obs_up.sh`, which applies those values, lives inside the deploy
job. The result is a change that merges green and is simply never applied.

Found by merging the collector's PII attribute allowlist (#507): committed,
green, and absent from the cluster. Masked until then because every earlier
observability change rode along with a Rust commit that did build an image,
which carried the YAML with it.

So `push` to main, filtered to `infra/k8s/**` and `scripts/obs_up.sh`.

A `paths:` filter is safe HERE and nowhere near the gates. `deploy` is not a
required status check — the required set is the twelve rust, frontend and
infra contexts — so a filtered run that never reports blocks nothing. On
`rust.yml` or `frontend.yml` the same filter would block every PR forever,
which is why those use the `detect`-job pattern instead. The header says so,
because the two cases look identical and are opposite.

`DEPLOY_SHA` falls back to `github.sha`, which on the `push` path IS the
pushed commit rather than a moving branch tip — correct here for the same
reason it is wrong on the `workflow_run` path. The hazard that comment warns
about is reading a branch tip, not the variable.

One subtlety: a platform-only commit has no image of its own, so the digest
step reuses the newest in ECR. That is already handled, but it emitted a
`::warning::` whose whole purpose is catching a build that should have run and
did not. Firing it on every platform-only deploy would teach the reader to
ignore the annotation and cost exactly that signal, so the expected case is
now a `::notice::` and the suspicious one stays a warning.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(skills): regenerate required-checks for the new deploy trigger

`required-checks.md` tabulates each job's `if:` condition, so adding the
`push` path to deploy-dev is a two-file change by design — the reference
cannot drift from what the workflows actually gate on.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
athvin pushed a commit that referenced this pull request Nov 8, 2026
…es paths

#587's push trigger was added to fix a cause that was misdiagnosed — the real
reason #507 never deployed was cancel-in-progress, fixed by #599 and this
file's queueing. The trigger never fired on a platform-only commit and only
raced image builds on mixed commits, leaving noise-red deploy runs on main.
Removed with PLATFORM_ONLY and the notice fork; the header now carries the
correct diagnosis. deploy is reachable only through images, so images.yml's
push paths gain scripts/ci/deploy-*.sh (the hole the removal would open) and
deploy_reachability.rs holds all five surfaces in the required test context —
both directions observed failing under mutation.
athvin pushed a commit that referenced this pull request Nov 8, 2026
…es paths

#587's push trigger was added to fix a cause that was misdiagnosed — the real
reason #507 never deployed was cancel-in-progress, fixed by #599 and this
file's queueing. The trigger never fired on a platform-only commit and only
raced image builds on mixed commits, leaving noise-red deploy runs on main.
Removed with PLATFORM_ONLY and the notice fork; the header now carries the
correct diagnosis. deploy is reachable only through images, so images.yml's
push paths gain scripts/ci/deploy-*.sh (the hole the removal would open) and
deploy_reachability.rs holds all five surfaces in the required test context —
both directions observed failing under mutation.
athvin added a commit that referenced this pull request Nov 8, 2026
…mages paths (#661) (#899)

* wip: claim #661 — remove deploy.yml's misdiagnosed push trigger

* fix(ci): remove deploy.yml's misdiagnosed push trigger; gate the images paths

#587's push trigger was added to fix a cause that was misdiagnosed — the real
reason #507 never deployed was cancel-in-progress, fixed by #599 and this
file's queueing. The trigger never fired on a platform-only commit and only
raced image builds on mixed commits, leaving noise-red deploy runs on main.
Removed with PLATFORM_ONLY and the notice fork; the header now carries the
correct diagnosis. deploy is reachable only through images, so images.yml's
push paths gain scripts/ci/deploy-*.sh (the hole the removal would open) and
deploy_reachability.rs holds all five surfaces in the required test context —
both directions observed failing under mutation.

* style: cargo fmt

* style: clippy map_or

* chore(skills): regenerate required-checks for the deploy condition

* chore(skills): regenerate post-merge reference for the deploy trigger change

---------

Co-authored-by: bmoore813 <[email protected]>
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.

2 participants