cdxgen icon indicating copy to clipboard operation
cdxgen copied to clipboard

Add canary fixtures for internal package names in every ecosystem

Open prabhu opened this issue 2 weeks ago • 3 comments

The fixture matrix above, each case with its README.md and expect.json. Covers R1, R2 and the inputs for R8. Done when every row has its fixtures, a script checks that every name listed as internal in an expect.json either contains cdxcanary or belongs to the look-alike set, every host listed as trusted is under corp.invalid, and the look-alike responses are recorded with their source URLs.

Things that can go wrong

  • Real names in fixtures. Canary names use the cdxcanary token and the reserved .invalid top-level domain, so a failing test leaks nothing real. Fixtures that test look-alike collisions use public names declared as internal and recorded responses, never live registries.
  • Aliases. An npm alias such as "billing": "npm:@acme/[email protected]" puts billing in node_modules and @acme/billing in the lockfile. Both are checked, and a match on either is a match.
  • Go case encoding. Proxy URLs write uppercase letters as ! plus the lowercase letter, so git.acme.corp/Billing appears as git.acme.corp/!billing. The URL decoder must undo that before matching. cdx-purl lowercases golang paths and splits /v2 into the name, so the matcher must rejoin namespace and name.

Plan

https://github.com/cdxgen/.github/blob/16db3843748dd931f6ca02c2aa13d918bcfdfdac/plans/internal-packages-corpus.md

This issue is task T1 in plans/internal-packages-corpus.md. The terms, the pattern grammar, the policy levels and the full list of edge cases are in plans/internal-packages.md.

prabhu avatar Nov 14 '26 11:11 prabhu

Hi @prabhu,

I would like to work on #4831 (Task T1: adding the canary fixtures, README.md / expect.json files, and the fixture validation script across ecosystems).

I will review plans/internal-packages-corpus.md, plans/internal-packages.md, and the repository's CONTRIBUTING.md guidelines first to ensure all canary tokens (cdxcanary), trusted hosts (corp.invalid), look-alike recorded responses, and edge cases (npm aliases, Go ! case encoding, etc.) strictly match the specification before opening the PR.

rishitha2625 avatar Nov 16 '26 20:11 rishitha2625

@rishitha2625, thank you for your message. These corpuses are usually kept in the maintainers local machine for faster agentic iteration. If you would like to help, could you help with testing and reviews? This discussion has some ideas https://github.com/cdxgen/cdxgen/discussions/4781

prabhu avatar Nov 16 '26 22:11 prabhu

Thank you for letting me know, @prabhu! That makes sense. I'll check out discussion #4781 and see where I can help with testing and reviewing the upcoming changes.

rishitha2625 avatar Nov 17 '26 09:11 rishitha2625