Skip to content

[LOW] Redact HMAC secrets from inspect output - #390

Merged
grosser merged 1 commit into
grosser:masterfrom
OskarEichler:codex/security-redact-hmac-secret
Sep 3, 2026
Merged

[LOW] Redact HMAC secrets from inspect output#390
grosser merged 1 commit into
grosser:masterfrom
OskarEichler:codex/security-redact-hmac-secret

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary

Redact Parallel::Serializer::Hmac's authentication secret from normal Ruby inspect output.

Security impact

The HMAC secret protects worker-pipe Marshal frames from forgery. Ruby's default object inspection includes every instance variable, so logging or debugging the serializer currently discloses the full secret and removes that protection for anyone who can read the output.

Baseline:

#<Parallel::Serializer::Hmac:0x... @inner=Marshal, @secret="secret-marker-0123456789012345">
secret_in_inspect=true

Patched:

#<Parallel::Serializer::Hmac @inner=Marshal, @secret=[REDACTED]>

The inner serializer remains visible for diagnostics. Deliberate Ruby reflection can still read instance variables; this change only closes accidental disclosure through the standard inspection path.

Verification

  • Deterministic marker-secret repro confirms the marker is absent and [REDACTED] is present.
  • Existing serializer suite: 11 examples, 0 failures.
  • Broader safe existing selection: 154 examples, 0 failures, 7 existing pending.
  • Ruby syntax, targeted RuboCop, gem build, and git diff --check pass.
  • No tests were changed.

Compatibility

No runtime serialization behavior or public method signature changes. Code comparing the exact debug string will see the intended redaction.

@grosser

grosser commented Sep 3, 2026

Copy link
Copy Markdown
Owner

that's a bit far-fetched since afaik nobody uses this but 🤷

@grosser
grosser merged commit fd824df into grosser:master Sep 3, 2026
4 checks passed
@grosser

grosser commented Sep 6, 2026

Copy link
Copy Markdown
Owner

this and all previous are now in 2.2.0

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