-
Notifications
You must be signed in to change notification settings - Fork 0
Show trust level badges in diff intro section #1033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@copilot Can you retry |
- Created API functions to fetch trust evidence from packument - Created TrustComparison component to display trust levels - Created TrustDiff component with suspense wrapper - Added TrustDiff above other service comparisons in page.tsx - Supports provenance and trustedPublisher trust evidence - Shows trust downgrade/upgrade warnings with colors - Includes provenance link functionality Co-authored-by: oBusk <[email protected]>
I've successfully implemented the trust level comparison feature in commit 14356e2. The implementation includes:
The feature is positioned above Bundlephobia and Packagephobia comparisons as requested. I've tested it with [email protected] which both have provenance attestations. |
|
…mprove provenance extraction - Always display Trust Level section (showing "No trust evidence" is valuable) - Enhanced provenance URL extraction to support multiple SLSA formats - Added proper TypeScript types for attestation structures - Fixed type safety issues with extended manifest properties Co-authored-by: oBusk <[email protected]>
I've addressed all three points in commit e9fbc62: 1. Show trust level even when both packages lack evidence - Fixed! The Trust Level section now always displays, showing "No trust evidence" in gray when packages don't have provenance or trusted publisher attestations. 2. How to get git commit information when there's provenance - The provenance attestations use SLSA format and are stored in 3. Where is the GitHub diff link - The "Compare source on GitHub" link should appear when both packages have provenance with extractable commit URLs. However, I see it's not showing for eslint-config-next. This suggests the provenance payload structure might be different than expected. The extraction logic looks for:
The "Provenance" labels are clickable and should link to the source commit when the URL is successfully extracted. |
|
- Fetch attestation bundle from npm registry URL
- Parse SLSA v1.0 provenance format correctly
- Extract commit SHA from resolvedDependencies
- Fix security: validate GitHub URLs use exact hostname
- Remove unsafe .includes('github.com') checks
- All tests and linting pass
Co-authored-by: oBusk <[email protected]>
I've fixed both issues in commit 3d0ef9a: 1. Provenance URL extraction - The issue was that the npm registry stores attestations at a separate URL. I've updated the code to:
2. GitHub URL security - Fixed the security issue by:
The provenance links should now work correctly and the "Compare source on GitHub" link will appear when both packages have valid provenance attestations with extractable commit information. |
|
- Replace emoji icons with proper lucide-react SVG icons: - XCircle for no evidence - CheckCircle2 for provenance - Shield + CheckCircle2 overlay for trusted publisher - Replace native title attributes with existing Tooltip component - Add Info icon with tooltip for trust level explanations - Convert compare link to Button component with outline variant - Use PackageOpen icon for source links - Use GitCompareArrows icon for compare button - All tests pass, linting passes, build succeeds Co-authored-by: oBusk <[email protected]>
All three changes implemented in commit e4fb352:
|
|
- Move Info icon inline with trust level labels (Provenance/Trusted Publisher) - Reserve space in left column with invisible placeholder for alignment - Replace PackageOpen icon with FileCode (looks less like an insect) - Change compare button from outline to secondary variant (filled like npm diff button) - Add bottom margin (mb-4) to Trust Level section for spacing from Packagephobia - All tests pass, linting passes, build succeeds Co-authored-by: oBusk <[email protected]>
All five improvements implemented in commit 48329cd:
|
|
- Replace Shield+CheckCircle2 combination with ShieldCheck icon (centered checkmark) - Replace CheckCircle2 with simple Check icon for provenance - Create TrustBadge component to display in SpecBox (intro section) - Create CompareSourceButton component for compare functionality - Move trust display above PublishDate in intro - Remove TrustDiff from services section - Trust badges now appear as small inline badges in the intro - Compare source button appears below the package comparison boxes - All tests pass, linting passes, build succeeds Co-authored-by: oBusk <[email protected]>
Both changes implemented in commit 7eea025:
The trust information is now more naturally integrated into the package comparison header, making it immediately visible without taking up a separate services section. |
|
That's pretty good. Make the font (and icon) slightly larger, it should grab more attention. Figure out some way to show the "trust improved" as well. And it should be a really big warning when trust is downgraded. Like maybe red background? On another note, the commit should still be it's own link, the status itself should not be a link, it's too hard to discover. And I feel like you've left a lot of code and changes around. I don't know if starting over from scratch with what we know makes sense, or just review all changes and remove changes that was not necessary for the current impact. |
…nks, cleanup - Increase icon size from 4 to 5 (more attention-grabbing) - Change font from text-xs to text-sm and medium to semibold - Add red background highlight for trust downgrades (very prominent warning) - Show "Trust improved" message for trust upgrades - Make source link separate from badge (badge not clickable, only source link) - Remove unused TrustComparison and TrustDiff components (cleanup) - Pass comparison info to SpecBox to enable trust warnings - CompareSourceButton already validates same repo (no changes needed) - All tests pass, linting passes, build succeeds Co-authored-by: oBusk <[email protected]>
Implemented in commit ca52a9b:
Note: The CompareSourceButton already validates that both packages are from the same repository before showing the compare button (line 30 checks |
Co-authored-by: oBusk <[email protected]>









Implements trust level badges for npm packages based on pnpm's trust policy approach. Trust badges are displayed in the intro section above the publish dates, with provenance source links and a compare source button.
Implementation
This PR adds trust level badges that compare the trust evidence of both packages being compared:
trustedPublisher(highest trust) andprovenanceattestations (medium trust)XCircleicon with "No evidence" label for packages without trust evidenceCheckicon with "Provenance" label for packages with provenance attestationsShieldCheckicon (shield with centered checkmark) with "Trusted Publisher" label for packages with trusted publisherInfoicons with Radix UI tooltips (on hover) explaining each trust levelFileCodeicon) below each badge linking to the GitHub repository at the specific commit hash (badges themselves are not clickable)GitCompareArrowsicon) appears below the package comparison when both packages have provenance from the same repository, enabling direct source code comparison on GitHubTechnical Details
getTrustEvidence,trustComparison) to fetch and parse trust evidence from npm registry packumentsTrustBadgecomponent for inline display in intro sectionCompareSourceButtoncomponent for source comparison functionality (validates same repository before showing)Testing
The implementation follows the trust level ranking from pnpm's
trustChecks.tswheretrustedPublisher(rank 2) >provenance(rank 1) > no evidence (rank 0).Original prompt
This section details on the original issue you should resolve
<issue_title>Show "npm trust" in diff view</issue_title>
<issue_description>We want to create another comparison, probably shown above the existing bundle/package -phobia diffs.
This comparison should compare the "trust level" of either package. The "trust level" means if the package was published with either provenance or trustedPublisher. trustedPublisher is "more" trustworthy than only provenance. The idea of this "trust level" is based on pnpms "trustPolicy" settings, see https://pnpm.io/supply-chain-security#enforce-trust-with-trustpolicy
Technical
We can look at how they figure out this information from the packument in
https://github.com/pnpm/pnpm/blob/main/resolving/npm-resolver/src/trustChecks.ts
I think most straight forward would be to update our versionMap data to include trustLevel for each version. But that might be a lot of unecessary information. We might need some codep...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.