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 — Update scripts to read tokens more securely by henrymercer · Pull Request #3908 · github/codeql-action

Conversation

@henrymercer

@henrymercer henrymercer commented May 15, 2026

Copy link
Copy Markdown
Contributor

Also allow specifying tokens using an environment variable. This improves security.

Sorry, something went wrong.

Uh oh!

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

All reactions
henrymercer added 2 commits May 15, 2026 14:53
@henrymercer
Read token from stdin in sync-checks.ts
2a02de1
Also allow specifying the token using an environment variable.
@henrymercer
Update update-release-branch.py to take token from stdin
93c8a9e
Copilot AI review requested due to automatic review settings May 15, 2026 13:56
@henrymercer
henrymercer requested a review from a team as a code owner May 15, 2026 13:56
@github-actions github-actions Bot added the size/M Should be of average difficulty to review label May 15, 2026
Copilot started reviewing on behalf of henrymercer May 15, 2026 13:57
View session
@henrymercer henrymercer changed the title Update scripts to read tokens from stdin Update scripts to read tokens more securely May 15, 2026
Copilot AI reviewed May 15, 2026
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 improves credential handling for repository maintenance scripts by avoiding passing GitHub tokens via command-line arguments, and instead supporting token retrieval from stdin and environment variables.

Changes:

  • pr-checks/sync-checks.ts now resolves tokens via --token-stdin or GH_TOKEN/GITHUB_TOKEN (with unit tests for the resolution logic).
  • update-release-branch.py now reads tokens from GH_TOKEN/GITHUB_TOKEN, and the update-release-branch workflow exports GITHUB_TOKEN into the script environment.
  • Contributor documentation for regenerating required checks is updated to reflect the new token passing approach.
Show a summary per file
File Description
pr-checks/sync-checks.ts Add token resolution via stdin/env and update CLI parsing to use --token-stdin.
pr-checks/sync-checks.test.ts Add unit tests covering stdin/env token resolution and failure cases.
CONTRIBUTING.md Update instructions to use --token-stdin and/or GH_TOKEN/GITHUB_TOKEN.
.github/workflows/update-release-branch.yml Export GITHUB_TOKEN so update-release-branch.py can authenticate via env var.
.github/update-release-branch.py Switch authentication to read token from environment variables (removing CLI token usage).

Copilot's findings

Comments suppressed due to low confidence (1)

pr-checks/sync-checks.ts:305

  • options here is the raw parseArgs().values object (with a "token-stdin" property) but is then passed around as Options. This works today because tokenStdin is optional and unused elsewhere, but it’s easy to accidentally start reading options.tokenStdin later and get undefined. Consider constructing a properly shaped Options object (including tokenStdin: options["token-stdin"]) and passing that through the rest of the script.
  // Find the check runs for the specified `ref` that we will later set as the required checks
  // for the main and release branches.
  const checkInfos = await getChecksFor(options, client, options.ref);
  const checkNames = new Set(checkInfos.map((info) => info.context));
  • Files reviewed: 5/5 changed files
  • Comments generated: 2

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread pr-checks/sync-checks.ts
Comment on lines +46 to +52
async function readTokenFromStdin(): Promise<string> {
let token = "";
process.stdin.setEncoding("utf8");
for await (const chunk of process.stdin) {
token += chunk;
}
return token.trim();
Comment thread .github/update-release-branch.py Resolved

Uh oh!

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

mbg
mbg approved these changes May 15, 2026
View reviewed changes
@henrymercer
henrymercer added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit 2365a46 May 15, 2026
230 checks passed

Uh oh!

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

@henrymercer
henrymercer deleted the henrymercer/token-stdin branch May 15, 2026 15:07
This was referenced May 22, 2026
Merge main into releases/v4 #3927
Merged
Merge releases/v4 into releases/v3 #3929
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
@mbg mbg mbg approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

size/M Should be of average difficulty 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 @mbg
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.