GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — CI: Perform a best-effort scan of the debug artifacts during release validation by henrymercer · Pull Request #3374 · github/codeql-action

Conversation

@henrymercer

@henrymercer henrymercer commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

Produce a best effort warning if sensitive environment variables are detected in debug artifacts. This is not reliable enough for production but the intent is that the test will run as part of release validation when the bundle update PR is opened.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Which use cases does this change impact?

Workflow types: n/a
Products: n/a

Environments:

  • Testing/None - This change does not impact any CodeQL workflows in production.

How did/will you validate this change?

  • Unit tests - I am depending on unit test coverage (i.e. tests in .test.ts files).
  • End-to-end tests - I am depending on PR checks (i.e. tests in pr-checks).

If something goes wrong after this change is released, what are the mitigation and rollback strategies?

  • Rollback - Change can only be disabled by rolling back the release or releasing a new version with a fix.

How will you know if something goes wrong after this change is released?

The CI check should fail if the artifact scan starts failing.

Are there any special considerations for merging or releasing this change?

  • No special considerations - This change can be merged at any time.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
henrymercer added 11 commits December 17, 2025 10:25
@henrymercer
Add artifact scanner
0c8bfea
@henrymercer
Add simple artifact scanner for tests only
5459b98
@henrymercer
Use artifact scanner in debug artifacts PR checks
f28848a
@henrymercer
Ensure .gz files are extracted too
f2ccf3b
@henrymercer
Add regression test for artifact scanner
488c1f1
@henrymercer
Slim down test debug artifacts
de17262
@henrymercer
Suppress debug logs for artifact scanner test
da77f9f
@henrymercer
Avoid logging each extract call
3b94cfe
@henrymercer
Verify using post step
faf6d35
@henrymercer
Merge branch 'main' into henrymercer/scan-debug-artifacts
6bc6217
@henrymercer
Bump timeout on Windows
3322491
Copilot AI review requested due to automatic review settings December 17, 2025 11:44
@henrymercer
henrymercer requested a review from a team as a code owner December 17, 2025 11:44
@github-actions github-actions Bot added the size/L May be hard to review label Dec 17, 2025
Copilot started reviewing on behalf of henrymercer December 17, 2025 11:45
View session
@henrymercer
Skip slow test on Windows
6b5763e
Copilot AI reviewed Dec 17, 2025
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a best-effort scan of debug artifacts to detect potential GitHub tokens before they are uploaded. The scan runs only in test mode and is designed to catch sensitive data leakage early during release validation, though it is explicitly not reliable enough for production use.

Key Changes:

  • New artifact-scanner.ts module that recursively scans files and archives for GitHub token patterns
  • Integration with debug artifact upload to scan artifacts when in test mode
  • Testing utilities updated to support optional console logging
  • GitHub workflow steps added to verify scan completion
  • Custom action to validate that the scan ran successfully

Reviewed changes

Copilot reviewed 10 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/artifact-scanner.ts New module implementing token pattern scanning with recursive archive extraction
src/debug-artifacts.ts Integrates artifact scanner before upload when in test mode
src/testing-utils.ts Adds optional logToConsole parameter to getRecordingLogger
src/artifact-scanner.test.ts Unit tests for the artifact scanner functionality
src/util.ts Adds isInTestMode() helper function
.github/workflows/*.yml Adds verification steps to test workflows
.github/actions/verify-debug-artifact-scan-completed/* Custom action to verify scan completion
lib/*.js Generated JavaScript from TypeScript compilation

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@henrymercer
Run testing Action using Node 24
7673a2d
esbena
esbena reviewed Dec 17, 2025
View reviewed changes

@esbena esbena left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I have skimmed the code. I don't think it warrants a deep review given its best-effort intentions.

I hoped more of this could have been offloaded to a library.

I worry a bit about the extract/scan/.../delete sequence and limited disk space, but since we are the creators of the asset, we are probably fine in practice. A streaming scan would be preferable.

Hacky solution proposal: pipe all assets through <source> | tar x...... | grep <patterns>. But if we already have something that works, then I can approve without it.


The changes to the generated files seem benign, but they are unexpected. Is that the norm due to non-determinism these days?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/artifact-scanner.ts

// Check if it's an archive file and recursively scan it
const fileName = path.basename(fullPath).toLowerCase();
const isArchive =

@esbena esbena Dec 17, 2025

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

have you looked at all extensions in our assets in practice?
Haven't we recently played around with something like .xz for instance?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@henrymercer henrymercer Dec 17, 2025

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

find <debug artifacts> -type f | sed 's/.*\.//' | sort | uniq -c | sort -rn
3284 gz
2872 dep
 222 js
 111 log
  52 h
  49 yml
  39 json
   9 qls
   8 zst
   8 zip
   4 trap
   4 set
   4 odep
   3 properties
   3 orig
   3 env
   3 args
   2 yaml
   2 s
   2 rb
   2 py
   2 manifest
   2 list
   2 link
   2 kt
   2 jsonl
   2 java
   2 go
   2 codeql-lock
   2 c

I pushed a commit to extract zstd archives too.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@henrymercer

henrymercer commented Dec 17, 2025

Copy link
Copy Markdown
Contributor Author

I hoped more of this could have been offloaded to a library.

For extracting archives, I wanted to use system utilities since this is only going to be run in CI. I'm open to suggestions if you have a library in mind to do the job here, but I think the implementation is fairly slim.

I worry a bit about the extract/scan/.../delete sequence and limited disk space, but since we are the creators of the asset, we are probably fine in practice. A streaming scan would be preferable.

If we start seeing failures, it would probably be a good idea to convert to a streaming scan, or ignore things like the source archive. I think since this is CI-only it doesn't necessarily make sense front-loading that work.

Hacky solution proposal: pipe all assets through <source> | tar x...... | grep <patterns>. But if we already have something that works, then I can approve without it.

There are some features like tracking the file in which the token was found, what type of token it was, and not relying on having bsdtar to extract zips. Once we add these, I think we're at the point where I'd rather maintain a JS program than a shell script :)

The changes to the generated files seem benign, but they are unexpected. Is that the norm due to non-determinism these days?

Unfortunately we are bundling this artifact scanner in order to run it before we upload debug artifacts in CI. It's behind the isInTestMode() check, which requires a specific environment variable to be set, but it is being included in the production artifacts.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@henrymercer
henrymercer force-pushed the henrymercer/scan-debug-artifacts branch from c2d74f5 to 1b34478 Compare December 17, 2025 15:21
@henrymercer
Extract zstd files too
ac6c41b
@henrymercer
henrymercer force-pushed the henrymercer/scan-debug-artifacts branch from 1b34478 to ac6c41b Compare December 17, 2025 15:34
esbena
esbena approved these changes Dec 18, 2025
View reviewed changes

@esbena esbena left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

👍🏻 Reasonable tradeoff between problem and implementation cost for now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@henrymercer
henrymercer merged commit 525b648 into main Dec 18, 2025
@henrymercer
henrymercer deleted the henrymercer/scan-debug-artifacts branch December 18, 2025 14:00
This was referenced Jan 12, 2026
Merge main into releases/v4 #3394
Merged
Merge releases/v4 into releases/v3 #3396
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@esbena esbena esbena approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size/L May be hard to review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@henrymercer @esbena
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.