Skip to content

feat: redact replication-log secrets + bump core for registry deploy auth#287

Draft
kriszyp wants to merge 6 commits into
mainfrom
kris/registry-deploy-auth
Draft

feat: redact replication-log secrets + bump core for registry deploy auth#287
kriszyp wants to merge 6 commits into
mainfrom
kris/registry-deploy-auth

Conversation

@kriszyp

@kriszyp kriszyp commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

Harper-pro half of the private-registry deploy-by-reference feature (deploy_component package=npm:@org/app@1.2.3 against a private npm registry). The token-handling core change lives in HarperFast/harper#1158 — this PR bumps the core submodule to it and adds the harper-pro-side defense-in-depth redaction.

  • replication/logRedaction.ts (new): redactOperationForLog() masks top-level token/key/password/hdbAuthHeader and nested registryAuth[].token before an operation is written to a debug log. Returns the same object reference when there is nothing sensitive, so the common (no-secret) path allocates nothing.
  • Wired into the two replication debug-log sites:
    • replicator.ts — guarded by logger.logsAtLevel('debug') (module-namespace logger, so the redaction call only runs when debug logging is on).
    • replicationConnection.tslogger.debug?.(…) short-circuits when debug is off, so no separate guard needed.
  • core submoduleea0d9e9ce (the registry-auth feature + its review fixes).
  • @harperfast/rocksdb-js^1.4.2 (package.json + lockfile).

Purpose

The registry token must never persist or be exposed on a data-plane node — not in the package reference, harperdb-config.yaml, the hdb_deployment row, logs, or replication. The core PR strips the token from the replicated operation; this PR closes the logging surface as a second, independent layer (the token can't leak via a debug-level operation dump even if an upstream strip is ever missed).

Where to focus

  • logRedaction.ts correctness — confirm the masked-key set is complete and the nested registryAuth[].token walk matches the contract shape registryAuth: [{ registry, token, scope? }]. The no-allocation fast-path (same-ref return when nothing sensitive) is the one bit of cleverness worth a look.
  • rocksdb-js ^1.4.2 root bump — this rides along because the core pointer advances ~14 commits to current main, which depends on rocksdb-js 1.4.2 (now the latest dist-tag); syncing the harper-pro root + lockfile avoids a resolved-version skew between core and the integrated build. Called out by the Codex pre-review; bundled here deliberately rather than as a separate PR.

Notes

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a log redaction utility to mask sensitive fields, such as SSH keys, passwords, and registry tokens, in replicated or forwarded operations before they are written to debug logs. It also updates the @harperfast/rocksdb-js dependency and adds corresponding unit tests. Feedback on the changes suggests optimizing the redaction logic for registryAuth arrays to avoid eagerly cloning the operation object when no tokens are present, thereby preserving the zero-allocation fast-path.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread replication/logRedaction.ts
@claude

claude Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Reviewed; no blockers found.

@kriszyp kriszyp marked this pull request as ready for review June 8, 2026 12:59
@kriszyp kriszyp requested a review from a team as a code owner June 8, 2026 12:59
@kriszyp kriszyp removed the request for review from a team June 8, 2026 14:47

@cb1kenobi cb1kenobi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

kriszyp and others added 6 commits June 9, 2026 21:17
Adds redactOperationForLog to mask SSH keys, passwords, auth headers, and
deploy_component registryAuth tokens before the replication send/receive paths
log operations at debug. Defense-in-depth: the origin strips registryAuth before
replicating, so the token should never reach peers, but any forwarding path that
logs the operation is now masked. Bumps core to 719c6128d (transient
private-registry auth for deploy_component).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Picks up the core fixes for scope-less default-registry routing and inherited
npm userconfig preservation in the transient registry-auth deploy path.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- logRedaction.ts: only clone the operation for registryAuth when an entry
  actually carries a token, so operations without sensitive data keep the
  zero-allocation fast path (addresses gemini review). Behavior unchanged when
  a token is present.
- Bump core submodule to 1a231963f (transient registryAuth token-handling
  hardening: immediate req strip, cleanup try/catch, double-write guard).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Bump core submodule to 9d46b36 (kris/registry-deploy-auth-core merged with
main) so harper-pro builds/tests against the now-green main, which fixes the
Format Check, the #1114 resync-idempotency unit tests, and the upgrade-fixture
integration breakage that were failing on the prior main.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Bump core to 4e90560 (newline guard on registry/token + in-memory token clear).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Picks up the merge of origin/main into the core branch (urlPath #1113
alongside registryAuth), keeping the integrated harper-pro PR building
against current core.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@kriszyp kriszyp force-pushed the kris/registry-deploy-auth branch from 574fcfb to 7f4d0a1 Compare June 10, 2026 03:20
@kriszyp kriszyp added this to the v5.2 milestone Jun 11, 2026
@kriszyp kriszyp marked this pull request as draft June 11, 2026 15:20
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