Repository navigation
Opt-in hashed client IP (client.address_hash), stacked on #51 - #52
Merged
Merged
Conversation
OpenTelemetry puts the client's IP address and port, the raw user agent, the machine's id and addresses, and the command line and its owner on every server span and on the resource. Redaction kept them (none looks like a secret) and nothing in Autter reads them. One list (runtime-core identifying.ts, mirrored in adapters/python redact.py and otlp-ingester identifying.ts, parity through test-vectors/redaction.json) is now dropped: - runtime-node: at export from span, event and link attributes and the span and metric resources, also with redactAttributes: false; - Python adapter: in RedactingSpanExporter (also with redact=False) and on init_tracing()'s resource; - otlp-ingester: on arrival for traces, logs (attributes and structured body keys) and metric resources, so plain OTel senders and old SDKs are covered. service.instance.id, host.name, process.pid, process.runtime.*, os.type and host.arch are kept. keepIdentifyingAttributes / keep_identifying_attributes / AUTTER_KEEP_IDENTIFYING_ATTRIBUTES keep them (true or a list; needed on both SDK and ingester), and dropAttributes / drop_attributes / AUTTER_DROP_ATTRIBUTES drop more keys such as host.name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hashClientIp (runtime-node), hash_client_ip (Python adapter) and AUTTER_HASH_CLIENT_IP (SDKs and ingester), with a secret salt (AUTTER_CLIENT_IP_SALT, 16+ characters), add client.address_hash: HMAC-SHA256 of the normalised client address, 32 hex characters. The raw address is still dropped. - Source order: client.address, http.client_ip, then on server spans the socket peer (net.peer.ip, network.peer.address, net.sock.peer.addr). - Normalisation: first list entry, port, brackets and zone id removed, IPv6 compressed and lower-cased, IPv4-mapped IPv6 read as IPv4. - Off by default. On without a usable salt: nothing hashed, one warning, never an unsalted hash. The salt is never logged or exported. - The ingester hashes only spans and log records without a hash and never re-hashes one. - Shared vectors (test-vectors/redaction.json, clientIpHash) checked by runtime-core, runtime-node, the Python adapter and the ingester. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…attributes # Conflicts: # CHANGELOG.md # adapters/python/autter_tracing.py
… into fix/hash-client-ip # Conflicts: # adapters/python/autter_tracing.py
…erged here) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
sagnik11
changed the base branch from
fix/drop-identifying-attributes
to
main
November 14, 2026 23:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #51 (base branch
fix/drop-identifying-attributes). Merge #51 first. GitHub then retargets this PR tomain.What was wrong
#51 drops the client IP address from every span. That is the right default, but it also takes away any way to count distinct clients. This PR adds an opt-in keyed hash of the address.
What changed
When hashing is on, the client's address is exported only as
client.address_hash. The value is HMAC-SHA256 of the normalised address under a secret salt, cut to the first 32 hex characters (128 bits). The raw address is still dropped.@autter/runtime-node:hashClientIp: true(salt fromAUTTER_CLIENT_IP_SALT) orhashClientIp: { salt }. It also works throughregisterAutter.init_tracing(hash_client_ip=True, client_ip_salt=...)orRedactingSpanExporter(..., hash_client_ip=, client_ip_salt=).AUTTER_HASH_CLIENT_IP=truewithAUTTER_CLIENT_IP_SALT.client.address, thenhttp.client_ip(both filled fromX-Forwarded-For/Forwardedbehind a proxy), then the socket peer (net.peer.ip,network.peer.address,net.sock.peer.addr). The socket peer is read on server spans only: behind a proxy it is the proxy, and on a client span it is the server being called.clientIpHashsection intest-vectors/redaction.json(normalisation, source order, hashes) is checked by all four test suites.client.address_hash. A hash sent by an SDK is stored as it is and never hashed again. It logs at startup whether hashing is on, never the salt.docs/ARCHITECTURE.md,docs/INTEGRATIONS.mdand the CHANGELOG all say that a hashed IP is still pseudonymous personal data in some readings of privacy law, and that the salt is a secret.Where the salt comes from
Only from an explicit setting: the option, or
AUTTER_CLIENT_IP_SALT. There is no derived default.The ingester has one salt for all the projects it serves. The README says that on a shared ingester those hashes are comparable across projects to whoever can read all of them, and recommends hashing in the SDK with a per-project salt.
How to test
node --test packages/runtime-core/test/client-ip.test.mjs(afternpm run build -w @autter/runtime-core)cd packages/runtime-node && node --test test/client-ip-hash.test.mjs. This runs child processes with real HttpInstrumentation andX-Forwarded-For, and covers: off by default,{ salt }, env together withredactAttributes: false, no salt (exactly one warning, nothing hashed), a hash already on the span kept, no hash on client spans, and the salt never on the wire or on stderr.cd packages/otlp-ingester && npx tsx --test src/client-ip-hash.test.ts. This covers the vectors, the filter, and a real Python Flask protobuf export through the ingester with and without a salt.python3 -m unittest discover -s adapters/python -v(test_client_ip_hash.py).Not covered
client.address_hashyet.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.