Skip to content

fix(identity): the trail can say who ran the agent, and configuring it works - #206

Merged
blitzcrieg1 merged 1 commit into
masterfrom
feat/operator-attribution
Oct 2, 2026
Merged

blitzcrieg1 merged 1 commit into
masterfrom
feat/operator-attribution

Conversation

@blitzcrieg1

Copy link
Copy Markdown
Owner

Closes #168.

The bug, and a worse one under it

Every event recorded the operator as local. The issue blamed the orchestrator's fallback, but the hook was the bigger problem: it hardcoded "operator_id": "local" in 24 payloads, and external.py keeps any value a client sends. So AGENTMETRY_OPERATOR_ID never reached a single hook event, even when it was set. On the maintainer's machine, with it set in .env, 2,620 of the last 3,761 hook events say local. The other 1,141 carried no initiator, so the orchestrator filled in the setting.

A trail that is hash-chained and publicly anchored could prove a record wasn't altered, and couldn't say who it was about.

Where identity is resolved

In the hook, because the hook runs as the developer inside their agent. A fleet orchestrator runs as a Windows service, so resolving there (the issue's proposed scope) would attribute every developer's work to the service account.

  • core/operator_identity.py, stdlib only, so the hook loads no pydantic for it (hooks: the hook costs 730ms, and 210ms of it is importing pydantic to read env vars #171). AGENTMETRY_OPERATOR_ID, else the OS account. On Windows that's CORP\jdoe for a domain or Entra account, and bare jdoe for a local one (a local account's machine name is dropped). It never raises.
  • The hook stamps operator: {id, source} in post_ingest, at capture, so a spooled event keeps the account that captured it.
  • ExternalIngestBody.operator is declared, so pydantic doesn't drop it.

Precedence on the orchestrator (run_context.resolve_operator)

# Source Recorded as
1 ID the developer configured, reported by the hook hook_configured
2 AGENTMETRY_OPERATOR_ID on the orchestrator (admin override) orchestrator_configured
3 OS account the hook ran as hook_os
4 ID a client sent without saying how client
5 The orchestrator's own account orchestrator_os
6 Nothing local / default

initiator.operator_source is additive, so the schema stays 1.2.0. Legacy local from hooks up to 0.9.0 counts as not stated. A client that sends source: "orchestrator_os" is recorded as client: a test checks that a caller's claim is never labelled as the recorder's own.

The README claim this changes

The README said "Ingest takes no identity from the caller", and test_ingest_body_takes_no_identity_from_the_caller banned any user-shaped field. Machine identity is still never taken from the caller: no host_id or fleet_id field, and the receiver stamps both. That's unchanged and still tested.

The person now has to come from the capture side, so the paragraph now says ingest takes one claim about the person, labelled as one. The old sentence was already slightly untrue: initiator.operator_id was caller-supplied all along, and the test only checked top-level field names. The test now allows exactly operator, and fails if a second identity field appears.

Also fixed

  • Disposition (triage) events had decided_by: "" with nothing configured. The disposition CLI sends the account running it, and the event falls back to the resolved operator.
  • Evidence packs use the resolved operator, not settings.operator_id or "local".
  • conftest.py now isolates operator_id, and the hook's once-per-process cache, so a developer's .env can't change test results.

Privacy

Account names now reach the trail and forwarded events, where there used to be a constant. The changelog says so plainly. Setting AGENTMETRY_OPERATOR_ID to a pseudonym keeps them out of a SIEM. Nothing reads another vendor's credential store, per the "What NOT to do" section of #168.

Not in scope

This is attribution by claim: a key holder can claim any operator, as they can already inject any event. Making it provable on a fleet is per-host signing (enterprise #1), sequenced after a pilot conversation.

Verification

  • pytest -q: 1375 passed, 1 skipped (32 new in test_operator_attribution.py, including the issue's two acceptance tests: a fresh install no longer records local, and a configured ID wins)
  • ruff check agentmetry tests: clean
  • benchmark: all cases behaved as recorded
  • ruleset fingerprint 15846a0915769d4a, unchanged. No frozen file reads identity; the rules only use actor_type.

🤖 Generated with Claude Code

…t works

Every event recorded the operator as `local` (#168). Worse than the issue
said: the hook hardcoded "operator_id": "local" in twenty-four payloads and
the orchestrator keeps any value a client sends, so AGENTMETRY_OPERATOR_ID
never reached a single hook event even when set. On the maintainer's
machine, with it set, 2,620 of the last 3,761 hook events said `local`.

The hook now resolves the account, because it runs as the developer and a
fleet orchestrator runs as a service account: AGENTMETRY_OPERATOR_ID, else
the OS account, domain-qualified on Windows. Stamped at capture, so a
spooled event keeps the account that captured it. The resolver is
stdlib-only, so it adds no pydantic to the hook (#171).

The orchestrator resolves in order: the developer's configured id, its own
AGENTMETRY_OPERATOR_ID as an admin override, the hook's OS account, an
unlabelled client id, its own account, `local`. Legacy `local` from hooks
up to 0.9.0 counts as not stated. initiator.operator_source records who
resolved it (additive, schema stays 1.2.0), and a client cannot get its
claim labelled as the recorder's own.

The README said ingest takes no identity from the caller, and a test
enforced it by top-level field name. Machine identity is still never taken
from the caller. The person now is, as a labelled claim, and the README
says so. initiator.operator_id was caller-supplied all along; the test
could not see a nested field.

Triage records had the same hole: decided_by was empty with nothing
configured. The disposition CLI now sends the account running it.

Account names now reach the trail and forwarded events. Set
AGENTMETRY_OPERATOR_ID to a pseudonym to keep them out of a SIEM. Nothing
reads another vendor's credential store. Fingerprint unchanged
(15846a0915769d4a).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@blitzcrieg1
blitzcrieg1 merged commit 096f245 into master Oct 2, 2026
10 checks passed
@blitzcrieg1
blitzcrieg1 deleted the feat/operator-attribution branch October 2, 2026 15:58
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

identity: every event says operator_id "local", so the trail cannot say who ran the agent

1 participant