Skip to content

feat: pass through zero data retention opt-in (CMD_ZDR) - #8

Merged
JoshRob297 merged 1 commit into
mainfrom
feat/zdr-passthrough
Oct 31, 2026
Merged

JoshRob297 merged 1 commit into
mainfrom
feat/zdr-passthrough

Conversation

@JoshRob297

Copy link
Copy Markdown
Owner

Context

Command Code exposes zero data retention as the request header x-cmd-zdr: 1, the same opt-in its CLI reads from CMD_ZDR=1. The plugin did not forward it, so plugin users could not ask for ZDR even though the CLI can.

Change

  • New src/hooks/zdr.ts: isZdrEnabled() (strict === "1") and applyZdrHeader().
  • CMD_ZDR=1 -> every request to the strict Command Code host carries x-cmd-zdr: 1.
  • Opt-in absent -> any caller-supplied x-cmd-zdr (any casing) is stripped, so a session that never asked for ZDR cannot emit the flag by accident.
  • Applied only when the parsed hostname is an allowed Command Code host; a lookalike that only shares /provider/v1/... in its path is never touched.
  • README/README.es/CHANGELOG updated; version 1.0.7.

Verify

  • bun test: 94 pass, 3 skip, 0 fail (new tests/zdr.test.ts covers set, strip, casing, no-lookalike, and the plugin hook path).
  • bunx tsc --noEmit: clean.

Remote verification pending

The ZDR header is accepted by the Provider API per the Command Code docs (CMD_ZDR=1); live verification with the current key is pending merge.

Command Code exposes ZDR as x-cmd-zdr: 1, the same opt-in its CLI reads
from CMD_ZDR=1. Mirror it for plugin users and strip any caller-supplied
header when the opt-in is absent, so a session that never asked for ZDR
cannot emit the flag by accident. Applied on the strict Command Code host
only, never on a lookalike that merely shares the request path.
@JoshRob297
JoshRob297 marked this pull request as ready for review October 31, 2026 18:28
@JoshRob297
JoshRob297 merged commit a29694c into main Oct 31, 2026
1 check passed
@JoshRob297
JoshRob297 deleted the feat/zdr-passthrough branch October 31, 2026 18:28
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.

1 participant