Skip to content

Normalize cooldown package PURL overrides#201

Merged
andrew merged 2 commits into
mainfrom
fix-197-cooldown-scoped-purls
Jul 18, 2026
Merged

Normalize cooldown package PURL overrides#201
andrew merged 2 commits into
mainfrom
fix-197-cooldown-scoped-purls

Conversation

@andrew

@andrew andrew commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Per-package cooldown overrides keyed by PURL were matched by exact string equality, so pkg:npm/@typescript/typescript-darwin-arm64 in config never matched the %40-encoded key the npm handler builds at runtime.

Both sides now go through the same PURL canonicalisation: config keys are parsed and re-serialised, and handlers build lookup keys via a helper that calls Normalize() on the constructed PURL. This also makes case-insensitive ecosystems behave sensibly, so pkg:pypi/Django and pkg:pypi/django refer to the same override.

When two config keys normalize to the same package, the canonical form wins; invalid PURLs are left as written.

Fixes #197

andrew added 2 commits July 13, 2026 17:11
NormalizedPackages runs config keys through purl.Parse().String(), which
applies per-type rules like lowercasing pypi names. The handler side was
building lookup keys with MakePURLString, which does not, so a config
entry for pkg:pypi/Django would be normalized to pkg:pypi/django and
never match the runtime key pkg:pypi/Django.

Route both sides through the same canonical form: a new
canonicalPackagePURL helper calls Normalize() on the constructed PURL
before stringifying, and all cooldown IsAllowed call sites use it.
@andrew
andrew merged commit 0a3b9e5 into main Jul 18, 2026
8 checks passed
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.

Cooldown cannot be configured for package with @ in the name

1 participant