-
Notifications
You must be signed in to change notification settings - Fork 0
Add tests for supply-chain verification endpoints and platform claim flows #110
Copy link
Copy link
Open
Description
Problem
We shipped significant new functionality without tests:
Backend (auths-cloud/crates/auths-registry-server)
GET /v1/packages/:eco/:name/versions— version-level signing dataGET /v1/packages/:eco/:name/health— signing continuity / gap detectionGET /v1/badges/:eco/:name— SVG badge with health statusGET /v1/packages/:eco/:name/timeline— machine-readable timelineGET /v1/packages/top-unsigned— leaderboard endpointverify_npm_token_proof()— npm token + signature verificationverify_pypi_claim_proof()— PyPI signed claim verification- Proof dispatch logic in
add_platform_claim()(npm-token: / pypi-claim: / gist prefix routing) - Namespace claim rejection without verified platform claim (
validation.rs) - Input validation:
validate_ecosystem()andvalidate_package_name()
Backend (auths/crates)
resolve_verified_platform_context()inauths-infra-http— fetches verified claims from registryclaim_npm_identity()inauths-sdk— npm claim workflowclaim_pypi_identity()inauths-sdk— PyPI claim workflowHttpNpmAuthProvider::verify_token()— npm whoami verification- Namespace claim security: CLI no longer accepts
--github-usernameflag
Frontend (auths-hub)
signing-health-card.tsx— 5 status variantssignature-timeline.tsx— gap detection visualizationbadge-embed.tsx— copy-paste snippetsplatform-passport.tsx— verified/ghost card statespackage-client.tsx— full page integration with health, timeline, badgedashboard-client.tsx— consolidated home/explore with leaderboardfetchPackageHealth(),fetchPackageVersions(),fetchTopUnsigned()— API functionsusePackageHealth(),usePackageVersions(),useTopUnsigned()— React Query hooks- Global search namespace matching
Priority test cases
P1 — security-critical:
- Namespace claim rejected when no verified platform claim exists
-
validate_ecosystem()rejects unknown ecosystems (returns 400) -
validate_package_name()rejects path traversal attempts -
verify_npm_token_proof()rejects mismatched username/token -
verify_pypi_claim_proof()rejects invalid Ed25519 signatures -
verify_pypi_claim_proof()rejects claim DID mismatch - Proof dispatch correctly routes npm-token: / pypi-claim: / gist prefixes
P2 — correctness:
- Health endpoint:
signature_gapdetected when unsigned version follows signed version - Health endpoint:
partially_signedonly when all unsigned versions predate signed ones - Health endpoint:
all_signedwhen every version has valid signer - Health endpoint:
unsignedwhen zero attestations - Versions endpoint: version extracted from
package_nameviasplit_part - Versions endpoint: cursor-based pagination
- Badge SVG: correct colors for each health status
- Badge SVG: XML escaping prevents injection
- Top-unsigned endpoint: filters by ecosystem, sorted by downloads
P3 — frontend:
- Health card renders all 5 status variants
- Timeline shows red tint for unsigned-after-signed rows
- Badge embed hidden when no releases
- Platform passport shows ghost cards for unclaimed platforms
Test patterns to follow
Backend: auths-cloud/crates/auths-registry-server/tests/cases/ — add supply_chain.rs module
SDK: auths/crates/auths-sdk/tests/ — add platform claim workflow tests
Frontend: auths-hub/apps/web/src/ — vitest component tests (none exist yet, need test infrastructure)
Existing test infrastructure
- Backend:
tests/integration.rswithtest_state()helper,app.oneshot()pattern - SDK:
cargo nextest run -p auths-sdk - Frontend:
pnpm --filter @auths/hub exec vitest run(vitest configured but no component tests)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels