Skip to content

Remove the JFrog npm credentials at the end of each CI job that writes them - #2351

Merged
anton-107 merged 2 commits into
mainfrom
anton/deco-29705-jfrog-rc-cleanup
Nov 24, 2026
Merged

anton-107 merged 2 commits into
mainfrom
anton/deco-29705-jfrog-rc-cleanup

Conversation

@anton-107

@anton-107 anton-107 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Why

configure-npm.sh writes the JFrog access token into ~/.npmrc and appends it to ~/.yarnrc.yml. Nothing removed those files. If a runner were reused, the token would outlive its job (and be readable by later jobs from other refs), and ~/.yarnrc.yml would grow by one block per job. This follows #2291 and #2334, which mask the JFrog token in the logs.

Changes

Every job that runs configure-npm.sh now ends with an if: always() step that runs rm -f ~/.npmrc ~/.yarnrc.yml, so the files go away when the job fails or is cancelled too. On main that covers push.yml, unit-tests.yml (Linux and Windows), create-build-artifacts.yml and release-pr.yml. The script's header notes that its callers need this step.

I did not move the config to $RUNNER_TEMP. npm would honour NPM_CONFIG_USERCONFIG, but Yarn Berry can't be pointed at another file. In the vendored Yarn (3.2.1 on main, 4.18.1 on release/3.x), the user config is join(os.homedir(), rcFilename). YARN_RC_FILENAME is only a file name joined to each directory, and setting it would also make Yarn skip the repository's own .yarnrc.yml (yarnPath, plugins, nodeLinker). The cleanup step is inline rather than a script so it still runs when checkout fails.

Are the runners ephemeral?

Probably yes, but this is strong circumstantial evidence, not a documented guarantee:

  • On the last 60 runs, 104 jobs ran on databricks-protected-runner-group. Each had a different runner name (linux-ubuntu-latest-1002083886, …887, windows-server-latest-1002200933, …), with a counter that only goes up and no name used twice. That is the naming GitHub uses for its hosted larger runners, which get a new VM for every job.
  • In "Set up job" (for example the main push run 45216700396), the runner provisioner is "Hosted Compute Agent" and the VM image is a custom ubuntu-22-04-crowdstrike-image. That means a GitHub-hosted runner with a custom image, not a self-hosted runner.
  • The IT Confluence page "Github Hosted Runners (Managed by IT)" describes these groups as GitHub-hosted runners that IT manages. I found no page that says outright that this group is ephemeral. An internal supply-chain audit lists "Verify ephemeral configuration" for this group as an open item.

The cleanup does not depend on the answer. It protects against a runner being reused, or the group changing later, at the cost of one rm per job.

Tests

  • shellcheck .github/scripts/*.sh .github/scripts/tests/*.sh passes.
  • bash .github/scripts/tests/secret-masking.sh passes.
  • I ran configure-npm.sh twice with a fake token in a temporary HOME. .yarnrc.yml then held two npmRegistryServer blocks, which shows the growth. Running the cleanup command removed both files.
  • This PR's CI is the real test: the jobs that install from JFrog must still pass, and each should now end with a successful "Remove JFrog npm credentials" step.

This pull request and its description were written by Isaac.

configure-npm.sh writes the JFrog access token into ~/.npmrc and appends
it to ~/.yarnrc.yml. Nothing removed them, so on a reused runner the token
would outlive its job and ~/.yarnrc.yml would keep growing. Each job that
runs the script now ends with an `if: always()` step that removes both
files.

Yarn reads its user config only from the home folder (YARN_RC_FILENAME is
a file name joined to each directory, and it renames the project's
.yarnrc.yml too), so moving the config to $RUNNER_TEMP is not possible.

Co-authored-by: Isaac <no-reply@databricks.com>
@rugpanov

Copy link
Copy Markdown
Contributor

🤖 Integration tests ❌ failed for b60d6851.
View run

@anton-107
anton-107 marked this pull request as ready for review November 24, 2026 15:51
@github-actions

Copy link
Copy Markdown
Contributor

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/vscode

Inputs:

  • PR number: 2351
  • Commit SHA: 1428ef2d66c06b9d6ac139d6a4361b8ebd149ae5

Checks will be approved automatically on success.

@anton-107
anton-107 merged commit 1041b00 into main Nov 24, 2026
8 checks passed

This branch was previously deployed

1 inactive deployment
test-trigger-is — 1428ef2d Deployed Nov 24, 2026 by anton-107 via Trigger Tests #2606
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.

3 participants