Skip to content

Harden multiline secret masking and redact debug key output - #12

Merged
MFHellscapes merged 3 commits into
mainfrom
copilot/andreijiroh-devfix-secret-redaction
Nov 7, 2026
Merged

MFHellscapes merged 3 commits into
mainfrom
copilot/andreijiroh-devfix-secret-redaction

Conversation

Copilot AI commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

core.setSecret masking is not consistently reliable for multiline secrets in GitHub Actions debug mode, which can expose sensitive values (notably private keys). This change reduces leakage risk by strengthening masking behavior and removing raw key material from debug logs.

  • Masking hardening for multiline secrets

    • Added a dedicated maskSecretValue() helper in action.js.
    • Registers multiple mask variants for each secret:
      • original value
      • normalized newline form
      • escaped \n form
      • each non-empty line for multiline values
    • Replaced direct core.setSecret(value) usage with this helper where decrypted values are masked.
  • Debug-log redaction of input key

    • Masks opts.key as early as possible.
    • Replaced debug serialization of raw options with a redacted key field ("[REDACTED]"), preventing accidental key disclosure in RUNNER_DEBUG/ACTIONS_STEP_DEBUG scenarios.
  • README: explicit known limitation + mitigation

    • Added a “Known limitations” section documenting GitHub runner multiline redaction edge cases in debug mode.
    • Added operational guidance: avoid debug logging for sensitive multiline secrets, avoid logging secret values, rotate exposed secrets.
  • Bundled runtime alignment

    • Regenerated dist/index.js (+ sourcemap) so distributed action behavior matches source updates.
function maskSecretValue(secretValue) {
  const normalized = secretValue.replace(/\r\n/g, "\n");
  const candidates = new Set([
    secretValue,
    normalized,
    normalized.replace(/\n/g, "\\n"),
  ]);
  normalized.split("\n").filter(Boolean).forEach((line) => candidates.add(line));
  candidates.forEach((candidate) => core.setSecret(candidate));
}

Copilot AI balanced review requested due to automatic review settings November 7, 2026 14:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d5e9ff3b-dae1-4eb5-9b5b-06276cfe28a5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Co-authored-by: ajhalili2006 <34998342+ajhalili2006@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 7, 2026 14:56
Copilot AI changed the title [WIP] Fix secret redaction for multiline values in debug mode Harden multiline secret masking and redact debug key output Nov 7, 2026
Copilot AI requested a review from ajhalili2006 November 7, 2026 14:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

In debug mode, dotenvx logs decrypted values before their masks are registered, exposing secrets in the logs.

1 open issue

Review effort: Balanced

Comment thread action.js Resolved
Co-authored-by: ajhalili2006 <34998342+ajhalili2006@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 7, 2026 15:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues for the secret-masking and logging safeguard changes.

1 open issue

Review effort: Balanced

@ajhalili2006
ajhalili2006 marked this pull request as ready for review November 7, 2026 15:28

@ajhalili2006 ajhalili2006 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.

LGTMing this agent-authored patch

@MFHellscapes MFHellscapes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@ajhalili2006 on the line here, had to do the LGTMing also via this one rather than bypassing the push rules.

@MFHellscapes
MFHellscapes merged commit 0ac31ac into main Nov 7, 2026
13 of 15 checks passed
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.

Secret redaction don't always reliably work on multiline values in debug mode

4 participants