Skip to content

Register credentials extracted from proxy configuration as secrets #2930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

mbg
Copy link
Member

@mbg mbg commented Jun 12, 2025

This will cause the credentials extracted from the proxy configurations to subsequently be masked in the Actions log, reducing the probability of accidental leakage.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@Copilot Copilot AI review requested due to automatic review settings June 12, 2025 12:01
@mbg mbg requested a review from a team as a code owner June 12, 2025 12:01
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Registers credentials extracted from proxy configurations as GitHub Actions secrets to prevent accidental leakage in logs.

  • Imports @actions/core and invokes core.setSecret on any extracted password or token.
  • Mirrors the secret-masking logic in the compiled JavaScript output.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/start-proxy.ts Imported @actions/core and added core.setSecret calls for password/token
lib/start-proxy.js Added secret registration logic in the compiled start-proxy.js
Comments suppressed due to low confidence (1)

src/start-proxy.ts:69

  • Consider adding unit tests to verify that core.setSecret is called when credentials include a password or token, ensuring secrets are properly masked in logs.
if (e.password !== undefined) {

@@ -63,6 +65,14 @@

const out: Credential[] = [];
for (const e of parsed) {
// Mask credentials to reduce change of accidental leakage in logs.
if (e.password !== undefined) {
core.setSecret(e.password);

Check failure

Code scanning / CodeQL

Untrusted data passed to external API with additional heuristic sources High Experimental

Call to @actions/core.setSecret() [param 0] with untrusted data from
e.password
.
Copy link
Member Author

Choose a reason for hiding this comment

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

This looks like a FP to me.

@mbg mbg force-pushed the mbg/start-proxy/mask-tokens branch from dba74ad to bbab102 Compare June 12, 2025 12:16
@redsun82 redsun82 closed this Jun 12, 2025
@redsun82 redsun82 reopened this Jun 12, 2025
@@ -63,6 +65,14 @@ export function getCredentials(

const out: Credential[] = [];
for (const e of parsed) {
// Mask credentials to reduce chance of accidental leakage in logs.
if (e.password !== undefined) {

Choose a reason for hiding this comment

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

Consider testing for null as well to guard against future changes. Better safe than sorry in these cases...

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't disagree, but we don't seem to check for null anywhere else (including elsewhere here where we inspect other members of the same JSON object).

I think we can do a much better job at validating the JSON value we get in general (e.g. check that it actually is an array, rather than just assuming it), but that may be a larger chunk of work. I am not sure if it makes sense to change this one now and not the others - what do you think?

Choose a reason for hiding this comment

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

Hmm, good question. I was about to write that it is probably more important to be consistent and make a sweep later with proper validation.

But: What is the impact if the structure of the JSON changes and makes our assumptions false in other places vs. here? In other places something might just crash, which we can hopefully detect and fix, but here we risk leaking secrets.

Your call though, as I haven't looked at the other places, and don't know the severity of the potential leak...

@mbg mbg merged commit 2847b7f into main Jun 16, 2025
528 of 539 checks passed
@mbg mbg deleted the mbg/start-proxy/mask-tokens branch June 16, 2025 09:59
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.

4 participants