Skip to content

SEC-974: security: redact secret variable value in Variable#toJSON serialization - #1429

Open
MrRobotBaguette wants to merge 1 commit into
developfrom
security/SEC-974-redact-secret-variable-tojson
Open

SEC-974: security: redact secret variable value in Variable#toJSON serialization#1429
MrRobotBaguette wants to merge 1 commit into
developfrom
security/SEC-974-redact-secret-variable-tojson

Conversation

@MrRobotBaguette

Copy link
Copy Markdown
Collaborator

Summary

Variable has no toJSON override, so serialization falls through to PropertyBase.toJSON and emits the value field verbatim — including for variables flagged secret: true, leaking secrets in plaintext (CWE-312). Certificate#toJSON already redacts; Variable did not. Linked Jira: SEC-974.

Fix

  • lib/collection/variable.js: add Variable.prototype.toJSON that builds via PropertyBase.toJSON(this) and _.unset(obj, 'value') when obj.secret === true, mirroring the Certificate#toJSON idiom.

⚠️ Breaking-change caveat (please confirm before merge)

This changes the public SDK serialization contract: a secret variable round-tripped through toJSON()new Variable(...) now loses its value. Treat as semver-major with a CHANGELOG/migration note; add a unit test asserting secret redaction. Redaction is gated on secret === true — values not flagged secret are still serialized (matches the flag contract).

Test plan

  • node --check clean
  • Reviewer: npm test + add a secret-redaction unit test

Linked Jira: SEC-974

Generated by the `security-patch-generation` skill. Reviewer owns the merge.

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