Skip to content

Conversation

@vadimpiven
Copy link
Owner

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @vadimpiven, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly bolsters the supply chain security of the 'packages/node' module by integrating a robust cryptographic verification process into its postinstall script. It ensures that any precompiled binaries downloaded are authentic and originate from trusted GitHub Actions workflows, leveraging Sigstore and Rekor for provenance attestation. Additionally, it includes minor dependency updates and improvements to development tooling configurations.

Highlights

  • Supply Chain Security: Implemented cryptographic verification for precompiled binaries in the 'packages/node' module's postinstall script, leveraging Sigstore provenance attestations and the Rekor transparency log to ensure authenticity and integrity.
  • Dependency Updates: Updated the 'bytes' crate in 'Cargo.lock' from version 1.11.0 to 1.11.1.
  • Development Tooling Configuration: Refined 'mise.toml' to manage the 'yq' tool and enhanced 'cargo clippy' tasks by adding the '--all-targets' flag for more comprehensive linting.
  • Documentation: Updated 'packages/node/README.md' to clearly document the new postinstall script's security verification process.
  • New Dependencies: Added several new '@sigstore' related packages to 'packages/node/package.json' and 'pnpm-lock.yaml' to support the newly introduced provenance verification logic.
Changelog
  • Cargo.lock
    • Updated the 'bytes' crate to version 1.11.1.
  • mise.lock
    • Removed the 'version_prefix' configuration for the 'yq' tool.
  • mise.toml
    • Added 'github:mikefarah/yq' version 4.52.1 to managed tools.
    • Removed a duplicate '[tools."github:mikefarah/yq"]' section.
    • Modified 'cargo clippy' commands in 'check:clippy' and 'fix:clippy' tasks to include the '--all-targets' flag for broader code analysis.
  • packages/node/README.md
    • The 'Install script' section was renamed to 'Postinstall Script'.
    • Content was updated to describe the new cryptographic verification process using Sigstore and Rekor for downloaded binaries.
  • packages/node/package.json
    • Added '@sigstore/core', 'sigstore', '@sigstore/bundle', and '@sigstore/rekor-types' as new dependencies to support the provenance verification.
  • packages/node/scripts/postinstall.js
    • Underwent a major overhaul to implement robust provenance verification logic.
    • Imported new modules for crypto, Sigstore, and X509 certificates.
    • Defined several JSDoc typedefs for improved code clarity.
    • Added utility functions like 'getExtensionValue' for parsing X509 certificate extensions.
    • Implemented 'fetchNpmAttestations' to retrieve provenance data from the npm registry.
    • Added 'searchRekor' and 'getRekorEntry' to interact with the Rekor transparency log.
    • Developed 'extractCertificateFromLogEntry' and 'extractRunInvocationURIFromNpmAttestation' to process attestation data.
    • Introduced 'verifyCertificateIdentity' to ensure the certificate issuer and source repository match expectations.
    • Created 'downloadAndHash' to securely download and compute the SHA256 hash of the binary.
    • The main logic now performs a comprehensive verification flow: fetching npm attestations, verifying the npm package's provenance signature, downloading the binary, searching Rekor for its attestation, and finally comparing the workflow run URIs of both the npm package and the binary to ensure they match before installation.
    • Replaced 'pipeline' and 'createGunzip' with 'gunzipSync' and 'writeFile' for binary handling.
  • pnpm-lock.yaml
    • Updated to reflect the new '@sigstore' dependencies and their transitive dependencies, ensuring consistent package management across the project.
Activity
  • The pull request was created by 'vadimpiven'.
  • New security features for binary verification were introduced in 'packages/node/scripts/postinstall.js'.
  • Project dependencies and configurations were updated across 'Cargo.lock', 'mise.lock', 'mise.toml', 'packages/node/package.json', and 'pnpm-lock.yaml'.
  • The 'packages/node/README.md' was updated to reflect the new postinstall script behavior.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@greptile-apps
Copy link

greptile-apps bot commented Feb 3, 2026

Greptile Overview

Greptile Summary

This PR enhances the postinstall script with cryptographic verification using Sigstore provenance attestations. The implementation ensures that downloaded precompiled binaries were built in the same GitHub Actions workflow run as the published npm package, preventing supply chain attacks.

Key changes:

  • Implemented comprehensive binary verification flow that fetches npm package attestations, searches the Rekor transparency log for matching binary attestations, and verifies both were signed by the same GitHub Actions workflow run
  • Added Sigstore dependencies (sigstore, @sigstore/core) and related type definitions
  • Updated README to explain the security mechanism using Sigstore and Rekor
  • Reorganized mise.toml configuration and improved clippy linting coverage with --all-targets flag

The verification process validates:

  1. npm package provenance attestation signature
  2. Certificate identity (GitHub Actions issuer + expected repository)
  3. Binary artifact hash exists in Rekor transparency log
  4. Binary and npm package share the same workflow run invocation URI

Confidence Score: 5/5

  • This PR is safe to merge - it significantly improves supply chain security
  • The implementation is well-structured with comprehensive error handling, clear documentation, and follows security best practices. The verification logic is sound and adds important supply chain security without breaking changes.
  • No files require special attention

Important Files Changed

Filename Overview
packages/node/scripts/postinstall.js Implemented comprehensive cryptographic verification using Sigstore to ensure binary authenticity by matching npm package and binary workflow runs
packages/node/package.json Added Sigstore dependencies (sigstore, @sigstore/core) as production deps and type definitions as dev deps
packages/node/README.md Updated documentation to explain the new cryptographic verification process using Sigstore provenance attestations

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant security enhancement by adding cryptographic verification of the downloaded binary using Sigstore. The implementation is thorough, checking both the npm package and the binary artifact attestations to ensure they originate from the same build workflow. My feedback includes a few suggestions to improve script robustness and configuration consistency.

Comment on lines +87 to +98
function getExtensionValue(cert, oid) {
const ext = cert.extension(oid);
if (!ext) return null;

// v2 extensions (1.3.6.1.4.1.57264.1.8+) are DER-encoded UTF8String
// v1 extensions store raw ASCII in the value
const subs = ext.valueObj.subs;
if (subs && subs.length > 0) {
return subs[0].value.toString("ascii");
}
return ext.value.toString("ascii");
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

According to the Fulcio OID documentation, newer extension values (like Issuer v2, Source Repository URI) are specified as UTF8String. The current implementation decodes them as ascii, which is incorrect and could lead to verification failures if the strings contain non-ASCII characters. The decoding should be changed to utf8 for these newer extensions to ensure correctness.

Suggested change
function getExtensionValue(cert, oid) {
const ext = cert.extension(oid);
if (!ext) return null;
// v2 extensions (1.3.6.1.4.1.57264.1.8+) are DER-encoded UTF8String
// v1 extensions store raw ASCII in the value
const subs = ext.valueObj.subs;
if (subs && subs.length > 0) {
return subs[0].value.toString("ascii");
}
return ext.value.toString("ascii");
}
function getExtensionValue(cert, oid) {
const ext = cert.extension(oid);
if (!ext) return null;
// v2 extensions (1.3.6.1.4.1.57264.1.8+) are DER-encoded UTF8String
// v1 extensions store raw ASCII in the value
const subs = ext.valueObj.subs;
if (subs && subs.length > 0) {
return subs[0].value.toString("utf8");
}
return ext.value.toString("ascii");
}

hide = true
depends = ["setup:rust"]
run = "cargo clippy -r --locked --fix --allow-dirty"
run = "cargo clippy --all-targets --fix --allow-dirty"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the check:clippy task and to prevent unintended dependency updates, it's recommended to add the -r and --locked flags to this command. The fix command should operate on the same set of dependencies as the check command.

run = "cargo clippy --all-targets -r --locked --fix --allow-dirty"

};
// Extract expected repository from package.json
const repoUrl = typeof repository === "string" ? repository : (repository?.url ?? "");
const repoMatch = repoUrl.match(/github\.com[/:]([^/]+\/[^/.]+)/);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current regex for extracting the repository name from package.json might not handle all possible Git URL formats, such as the common SCP-like syntax (e.g., git@github.com:user/repo.git). Using a more flexible regex would make this security-sensitive script more robust against different URL formats.

Suggested change
const repoMatch = repoUrl.match(/github\.com[/:]([^/]+\/[^/.]+)/);
const repoMatch = repoUrl.match(/github\.com[/:]([^/]+\/[^/]+?)(\.git)?$/);

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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