Skip to content

ci(template): verify lockfile uses only public npm registry#444

Merged
MarioCadenas merged 3 commits into
mainfrom
package-check
Jun 12, 2026
Merged

ci(template): verify lockfile uses only public npm registry#444
MarioCadenas merged 3 commits into
mainfrom
package-check

Conversation

@MarioCadenas

@MarioCadenas MarioCadenas commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

What

Adds a required CI check that fails if template/package-lock.json resolves any dependency from a non-public registry.

Why

The template/ directory is the app scaffold shipped to users via databricks apps init, and its package-lock.json pins exactly where each dependency is fetched from (the resolved field on every package entry). If a private/internal registry (Artifactory, JFrog, GitHub Packages, Verdaccio, an internal mirror) ever leaks into that lockfile — for example because it was regenerated on a machine with a custom .npmrc — scaffolded apps would either fail npm install (no access) or silently pull from a non-public source.

Today the lockfile is clean (1003 resolved entries, all https://registry.npmjs.org/), but nothing enforced it. This check closes that gap.

How

New tools/check-template-lock-registry.ts (follows the existing check-template-deps.ts pattern):

  • Iterates the packages map of template/package-lock.json (lockfileVersion 3) and requires every resolved URL to be https:// with host registry.npmjs.org. Entries without resolved (root + workspace/link) are skipped. The single https+host rule also rejects non-registry sources like git+ssh://, file:, and http://.
  • If template/.npmrc is ever added (none exists today), flags any private registry=/scoped-registry line or _authToken= line; absence is handled silently.

Wired as a new step in the existing required lint_and_typecheck job, next to check-template-deps, so it runs on every PR and blocks merge.

Verification

  • Happy path: current lockfile → exit 0.
  • Injected JFrog URL and git+ssh:// entry → both flagged, exit 1.
  • Private .npmrc registry=/_authToken= flagged; legitimate @scope:registry=https://registry.npmjs.org/ not flagged → exit 1.
  • Missing .npmrc → exit 0, no error.
  • Biome clean.
image

Add a required CI check that fails if template/package-lock.json resolves
any dependency from a non-public registry. The template ships to users via
`databricks apps init`, so a private/internal registry leaking into the
lockfile (e.g. from a regen on a machine with a custom .npmrc) would break or
silently redirect `npm install` in scaffolded apps.

The new tools/check-template-lock-registry.ts requires every `resolved` URL to
be https on registry.npmjs.org (which also rejects git/file/http sources) and,
if a template/.npmrc is ever added, flags private registry/auth lines. Wired
into the existing lint_and_typecheck job next to check-template-deps.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas MarioCadenas requested a review from a team as a code owner June 12, 2026 09:11
Temporarily points clsx and lucide-react resolved URLs at
npm-proxy.dev.databricks.com to confirm the new
check-template-lock-registry CI step fails. Reverted immediately after.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Restores clsx and lucide-react resolved URLs to registry.npmjs.org after
confirming the check-template-lock-registry CI step failed as expected.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>

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

LGTM

@MarioCadenas MarioCadenas merged commit c7d93d2 into main Jun 12, 2026
9 checks passed
@MarioCadenas MarioCadenas deleted the package-check branch June 12, 2026 10:30
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.

2 participants