Repository navigation
fix: allow git build approvals by repository - #12856
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough
ChangesGit-repo allowBuilds matching
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant createAllowBuildFunction
participant AllowBuildPolicy
participant from_config
participant InstallTest
participant addAllowBuildRule
createAllowBuildFunction->>addAllowBuildRule: route git repo allowBuild keys
from_config->>AllowBuildPolicy: store git-repo allow/deny rules
AllowBuildPolicy->>AllowBuildPolicy: derive gitRepoKey from depPath
AllowBuildPolicy->>AllowBuildPolicy: check gitRepo allow/deny sets
InstallTest->>createAllowBuildFunction: enable build for git-hosted dependency
InstallTest->>InstallTest: assert lifecycle script execution
Assessment against linked issues
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pacquet/crates/package-manager/src/build_modules.rs`:
- Around line 303-308: The helper git_repo_allow_build_key_from_dep_path
currently returns None for valid git dependency paths that do not include a
fragment, which prevents allow rules from matching no-hash forms. Update this
function so that after confirming the path is a git repo dep path, it returns
the full dep_path when find('#') yields no fragment, and only truncates at the
hash when one is present. Keep the change localized to
git_repo_allow_build_key_from_dep_path so matching behavior stays aligned with
pnpm for both hash and no-hash git URLs.
In `@pacquet/crates/package-manager/src/build_modules/tests.rs`:
- Around line 121-128: The policy test coverage in build_modules/tests.rs should
also verify the no-hash dep-path form that is now stored as the repo key. Add an
assertion alongside the existing policy.check cases in the test that exercises
this helper so it covers the plain git URL without a `#hash`, ensuring it matches
the same policy result as the hashed form and would fail without the no-hash
handling fix.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: bfcd49bc-2376-4d50-95ff-7f9249f034e5
📒 Files selected for processing (6)
.changeset/allow-git-repo-builds.mdpacquet/crates/package-manager/src/build_modules.rspacquet/crates/package-manager/src/build_modules/tests.rspnpm11/building/policy/src/index.tspnpm11/building/policy/test/index.tspnpm11/installing/deps-installer/test/install/lifecycleScripts.ts
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12856 +/- ##
=======================================
Coverage 85.61% 85.62%
=======================================
Files 449 449
Lines 69986 70031 +45
=======================================
+ Hits 59922 59966 +44
- Misses 10064 10065 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.8227770295,
"stddev": 0.1656203951034561,
"median": 3.761444922,
"user": 3.5937845200000007,
"system": 3.45859922,
"min": 3.6588393625,
"max": 4.1807424975,
"times": [
4.1807424975,
3.7598190015,
3.7945235015,
4.0176856055,
3.7630708425,
3.7032656514999998,
3.6588393625,
3.6870130205000002,
3.7517928685,
3.9110179435
]
},
{
"command": "pacquet@main",
"mean": 3.9051812511999997,
"stddev": 0.13412630160593483,
"median": 3.9100606165,
"user": 3.60443142,
"system": 3.4424573200000004,
"min": 3.7305012755,
"max": 4.0984941065,
"times": [
3.9898562775,
3.7662234525000002,
3.8265324395,
4.0241561975,
3.7453608875,
3.9255355755,
3.8945856575,
4.0984941065,
3.7305012755,
4.0505666425
]
},
{
"command": "pnpr@HEAD",
"mean": 2.2099483898,
"stddev": 0.13612761873866228,
"median": 2.1750113564999998,
"user": 2.7387490199999998,
"system": 3.18518582,
"min": 2.0635940765,
"max": 2.4328356355,
"times": [
2.4046040105,
2.0635940765,
2.0727326215,
2.1246292975,
2.1998313845,
2.4328356355,
2.2808675125,
2.0808345495,
2.2893634815,
2.1501913285
]
},
{
"command": "pnpr@main",
"mean": 2.1822068163,
"stddev": 0.13343101581390274,
"median": 2.1357091695,
"user": 2.7180071199999998,
"system": 3.10812532,
"min": 2.0625702695,
"max": 2.4095424055,
"times": [
2.1224836815,
2.4095424055,
2.0665689945,
2.1060914435,
2.0625702695,
2.2846606115,
2.3970481475,
2.1489346575,
2.1563140675,
2.0678538845
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6898896265200001,
"stddev": 0.03411556656208651,
"median": 0.6805122670200001,
"user": 0.43483928,
"system": 1.3680863999999997,
"min": 0.6554751335200001,
"max": 0.7694198385200001,
"times": [
0.6720463695200001,
0.6554751335200001,
0.69367441852,
0.69628339752,
0.6728792355200001,
0.66138899752,
0.66796732252,
0.6881452985200001,
0.72161625352,
0.7694198385200001
]
},
{
"command": "pacquet@main",
"mean": 0.7740907457199999,
"stddev": 0.07922934352099995,
"median": 0.75110159302,
"user": 0.43937007999999994,
"system": 1.4530442999999997,
"min": 0.69633380852,
"max": 0.97833475652,
"times": [
0.76796196752,
0.73850138552,
0.73774517752,
0.69633380852,
0.71743350652,
0.78759661952,
0.75215539552,
0.97833475652,
0.8147970495200001,
0.75004779052
]
},
{
"command": "pnpr@HEAD",
"mean": 0.8058837678199999,
"stddev": 0.05623524704922743,
"median": 0.79448868052,
"user": 0.4625905799999999,
"system": 1.4515255999999999,
"min": 0.74532845952,
"max": 0.92105766552,
"times": [
0.7973509415200001,
0.81638457852,
0.77247255652,
0.7538486805200001,
0.76282541652,
0.92105766552,
0.81937229052,
0.79162641952,
0.74532845952,
0.8785706695200001
]
},
{
"command": "pnpr@main",
"mean": 0.7741939146200001,
"stddev": 0.05552479067374141,
"median": 0.76241498502,
"user": 0.42870828000000005,
"system": 1.4019689,
"min": 0.7307701335200001,
"max": 0.92333790352,
"times": [
0.77355444352,
0.7905348855200001,
0.7583789925200001,
0.76645097752,
0.73752609552,
0.7461047135200001,
0.74425388552,
0.92333790352,
0.77102711552,
0.7307701335200001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.53806287742,
"stddev": 0.13193054687401257,
"median": 4.5729266077199995,
"user": 3.95042006,
"system": 3.5753686999999994,
"min": 4.32029893022,
"max": 4.69245997322,
"times": [
4.68602449222,
4.629377992219999,
4.5612647082199995,
4.635215094219999,
4.46387646222,
4.37691570122,
4.32029893022,
4.69245997322,
4.43060691322,
4.584588507219999
]
},
{
"command": "pacquet@main",
"mean": 4.333936432819999,
"stddev": 0.0515424838088394,
"median": 4.35568015922,
"user": 3.8204290599999995,
"system": 3.4583748,
"min": 4.21970513122,
"max": 4.395836839219999,
"times": [
4.367283264219999,
4.21970513122,
4.395836839219999,
4.34041047422,
4.28167583522,
4.35625539722,
4.3609809322199995,
4.3041312312199995,
4.35798030222,
4.35510492122
]
},
{
"command": "pnpr@HEAD",
"mean": 2.2534681598199997,
"stddev": 0.1557867243211459,
"median": 2.24512505722,
"user": 2.5686377599999997,
"system": 3.0339655,
"min": 2.01973687622,
"max": 2.48727894722,
"times": [
2.0628651012200003,
2.25978925922,
2.4199457362200003,
2.3048248942200003,
2.48727894722,
2.20445944722,
2.41183296122,
2.01973687622,
2.23046085522,
2.13348752022
]
},
{
"command": "pnpr@main",
"mean": 2.25236528332,
"stddev": 0.15397379600742633,
"median": 2.20002827372,
"user": 2.57716356,
"system": 3.0282750000000003,
"min": 2.09451605322,
"max": 2.50888647322,
"times": [
2.09493051422,
2.24182570822,
2.10540959822,
2.1582308392200003,
2.09451605322,
2.50888647322,
2.1512750562200003,
2.3981126332200002,
2.40149088922,
2.36897506822
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.44710866328,
"stddev": 0.031694428859977634,
"median": 1.44375113658,
"user": 1.43377096,
"system": 1.7445084999999998,
"min": 1.41091515408,
"max": 1.49366226008,
"times": [
1.41163010008,
1.41986214808,
1.42308217308,
1.45211610708,
1.43538616608,
1.48397429308,
1.48427500308,
1.45618322808,
1.41091515408,
1.49366226008
]
},
{
"command": "pacquet@main",
"mean": 1.4387706198799999,
"stddev": 0.05292686387449125,
"median": 1.4248707785799999,
"user": 1.3767431599999997,
"system": 1.7338383999999998,
"min": 1.39794963908,
"max": 1.58113297208,
"times": [
1.44037706308,
1.41859357008,
1.58113297208,
1.41255609008,
1.43114798708,
1.43712193008,
1.39794963908,
1.40406467008,
1.4119604100799998,
1.45280186708
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6972556193799999,
"stddev": 0.014793781115819655,
"median": 0.69633724308,
"user": 0.36531176,
"system": 1.3110274,
"min": 0.67904781308,
"max": 0.72813180208,
"times": [
0.69565848808,
0.71283693708,
0.68915333208,
0.67904781308,
0.70061799608,
0.6990762820799999,
0.72813180208,
0.67905854808,
0.69701599808,
0.69195899708
]
},
{
"command": "pnpr@main",
"mean": 0.70864078788,
"stddev": 0.04289809896145628,
"median": 0.69636853458,
"user": 0.36602485999999995,
"system": 1.3363899,
"min": 0.68034473608,
"max": 0.82710125908,
"times": [
0.68940878208,
0.70188747908,
0.69020240708,
0.69171172008,
0.68034473608,
0.71480174708,
0.70102534908,
0.82710125908,
0.70536575508,
0.68455864408
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.22384558678,
"stddev": 0.05420699946631418,
"median": 3.2115135390800003,
"user": 1.9826539199999995,
"system": 2.06525186,
"min": 3.17135583908,
"max": 3.36731034308,
"times": [
3.17135583908,
3.20358709608,
3.23140141608,
3.20802887708,
3.2149982010800002,
3.19009250908,
3.22176455508,
3.36731034308,
3.19247767208,
3.23743935908
]
},
{
"command": "pacquet@main",
"mean": 3.17740576718,
"stddev": 0.05360269557130354,
"median": 3.17205868558,
"user": 1.89985262,
"system": 2.0774332600000003,
"min": 3.08460657008,
"max": 3.27849926208,
"times": [
3.08460657008,
3.11939263008,
3.16546788608,
3.16609011308,
3.2019756520800002,
3.20022240108,
3.22115534408,
3.17802725808,
3.27849926208,
3.15862055508
]
},
{
"command": "pnpr@HEAD",
"mean": 0.71344553578,
"stddev": 0.019385841027871588,
"median": 0.7068191835800001,
"user": 0.37980632000000003,
"system": 1.3487300600000003,
"min": 0.6757030150800001,
"max": 0.73844832808,
"times": [
0.73844832808,
0.70555457608,
0.7319558740800001,
0.7336272690800001,
0.70537201108,
0.70442703608,
0.72859448508,
0.7080837910800001,
0.70268897208,
0.6757030150800001
]
},
{
"command": "pnpr@main",
"mean": 0.67382527088,
"stddev": 0.018939754804808192,
"median": 0.66901814258,
"user": 0.34426772,
"system": 1.30535466,
"min": 0.65757785408,
"max": 0.7210882280800001,
"times": [
0.66729246708,
0.65757785408,
0.65855747308,
0.6669019580800001,
0.67074381808,
0.68302948608,
0.68104950608,
0.65769145608,
0.6743204620800001,
0.7210882280800001
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6541802381400001,
"stddev": 0.008633016095990348,
"median": 0.65293871864,
"user": 0.6191783199999998,
"system": 0.15619388,
"min": 0.64131437164,
"max": 0.66711755664,
"times": [
0.66711755664,
0.64131437164,
0.66328560664,
0.65158533064,
0.66174609364,
0.65014793364,
0.64193922964,
0.6534626316400001,
0.65878882164,
0.65241480564
]
},
{
"command": "pacquet@main",
"mean": 0.64538431434,
"stddev": 0.007931950833139073,
"median": 0.64685326664,
"user": 0.60868132,
"system": 0.15751618,
"min": 0.6277867406400001,
"max": 0.65593468464,
"times": [
0.65593468464,
0.65103221664,
0.6277867406400001,
0.64284030764,
0.64065989664,
0.64829654464,
0.65228463664,
0.64540998864,
0.64852636564,
0.64107176164
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10775311140000003,
"stddev": 0.00029275483734436143,
"median": 0.10778754764000001,
"user": 0.02798298,
"system": 0.0193655,
"min": 0.10680127564000001,
"max": 0.10828467064000001,
"times": [
0.10773289564,
0.10751237664,
0.10758794364,
0.10780845564000001,
0.10793474364000001,
0.10805804764,
0.10778754764000001,
0.10779174564,
0.10745308364,
0.10782838364000001,
0.10785341964,
0.10828467064000001,
0.10772430964,
0.10778464264000001,
0.10811410364000001,
0.10749029564000001,
0.10761923564,
0.10798456264,
0.10797537564000001,
0.10810304664,
0.10785473264,
0.10760863564,
0.10755411364,
0.10758014164,
0.10680127564000001
]
},
{
"command": "pnpr@main",
"mean": 0.10780621348000002,
"stddev": 0.000329698646010348,
"median": 0.10777265864,
"user": 0.0276827,
"system": 0.01948846,
"min": 0.10723527964000001,
"max": 0.10848195364,
"times": [
0.10755804264,
0.10768221264000001,
0.10801043064,
0.10803292364000001,
0.10761431564000001,
0.10783294364000001,
0.10790620664,
0.10834678664000001,
0.10791375164000001,
0.10777265864,
0.10796636164000001,
0.10746962664000001,
0.10766485064,
0.10734244264000001,
0.10766392764,
0.10723527964000001,
0.10806712864000001,
0.10812607564000001,
0.10762562664000001,
0.10839648864000001,
0.10742861164,
0.10760116864000001,
0.10848195364,
0.10798528264000001,
0.10743023964000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.674515779219999,
"stddev": 0.1102833686261086,
"median": 6.680519948920001,
"user": 3.8049622399999996,
"system": 3.78382152,
"min": 6.43451481092,
"max": 6.81590817092,
"times": [
6.61419083792,
6.81590817092,
6.6078274949199995,
6.71369655292,
6.43451481092,
6.65818719592,
6.72917369492,
6.69462006092,
6.66641983692,
6.81061913592
]
},
{
"command": "pacquet@main",
"mean": 6.769811771120001,
"stddev": 0.16760197089169793,
"median": 6.77282062992,
"user": 3.901581840000001,
"system": 3.78713212,
"min": 6.54311285792,
"max": 7.03700794992,
"times": [
6.54450761692,
7.03700794992,
6.54311285792,
6.65673606092,
6.93700683592,
6.72945472492,
6.67157451192,
6.81618653492,
6.87004765292,
6.89248296492
]
},
{
"command": "pnpr@HEAD",
"mean": 5.02738178212,
"stddev": 0.05585895238822975,
"median": 5.04594656842,
"user": 2.81862924,
"system": 3.31663272,
"min": 4.93856346892,
"max": 5.09470615792,
"times": [
4.98116244792,
4.94511272892,
5.07746284192,
5.01188864292,
4.93856346892,
5.0663083559199995,
5.09470615792,
5.03463096892,
5.05726216792,
5.06672003992
]
},
{
"command": "pnpr@main",
"mean": 5.13540047022,
"stddev": 0.08471470093327164,
"median": 5.12530966642,
"user": 2.8731301399999998,
"system": 3.4155437199999996,
"min": 5.00919482992,
"max": 5.34233356492,
"times": [
5.00919482992,
5.09663347892,
5.09936209192,
5.34233356492,
5.12976417892,
5.17334530692,
5.09963955092,
5.14011289992,
5.14276364592,
5.12085515392
]
}
]
} |
|
| Branch | pr/12856 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 2,253.47 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 713.45 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 697.26 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 107.75 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,209.95 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 5,027.38 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 805.88 ms |
Allow git-hosted build approvals to survive commit changes without restoring package-name trust for artifact dep paths. Constraint: `allowBuilds` package-name rules must stay registry-only. Rejected: matching git artifacts by package name | restores trust bypass risk. Confidence: high Scope-risk: moderate Directive: Keep TS `createAllowBuildFunction` and pacquet `AllowBuildPolicy` in sync. Tested: `@pnpm/building.policy` focused Jest suite. Tested: `@pnpm/installing.deps-installer` compile. Tested: `cargo fmt --check` for changed pacquet files. Tested: `git diff --check`. Tested: `cspell` for changeset and changed TypeScript files. Not-tested: registry-backed lifecycle Jest; missing `pnpr` binary build hit ENOSPC. Not-tested: pacquet unit execution; avoid heavy Rust build on full filesystem.
Use explicit String clones when populating git build policy sets so Rust CI's Clippy step passes with warnings denied. Tested: cargo fmt --check -- pacquet/crates/package-manager/src/build_modules.rs Tested: cargo clippy -p pacquet-package-manager --lib -- -D warnings Tested: cargo test -p pacquet-package-manager explicit_allow_by_git_repo_allows_untrusted_package_identity -- --nocapture Tested: git diff --check
Treat a git dependency path without a fragment as its own repository key, while still stripping fragments from hashed git dependency paths. Tested: cargo fmt --check -- pacquet/crates/package-manager/src/build_modules.rs pacquet/crates/package-manager/src/build_modules/tests.rs Tested: cargo test -p pacquet-package-manager explicit_allow_by_git_repo_allows_untrusted_package_identity -- --nocapture Tested: cargo clippy -p pacquet-package-manager --lib -- -D warnings Tested: git diff --check
b20aa9d to
1f99cbf
Compare
Code Review by Qodo
Context used✅ Tickets:
🎫 `allowBuilds` does not match git-hosted packages by package name — requires exact commit hash✅ Compliance rules (platform):
51 rules 1.
|
PR Code Suggestions ✨Warning
|
|||||||||
Mirror the pacquet fix from b20aa9d in the TypeScript CLI: a git depPath without a ref must match its own hash-less allowBuilds key. Previously getGitRepoAllowBuildKeyFromDepPath returned undefined for the no-hash form, so such a depPath matched no rule at all. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit 9aa03c2 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
pnpm 11.11 (pnpm#12856) let an `allowBuilds` entry approve a git dependency's build scripts by its repository URL without the resolved commit hash, but only for dependencies pnpm clones, whose dep path looks like `name@git+https://host/org/repo.git#<commit>`. The common `github:` case is not cloned: pnpm downloads it as a tarball from codeload.github.com, giving a dep path of the form `name@https://codeload.github.com/org/repo/tar.gz/<commit>`. That form has neither the `git+` prefix nor the `#` separator the hashless matcher keys on, so the entry was ignored and the build stayed unapproved unless it pinned the exact commit hash. Normalize a git-hosted tarball dep path back to the canonical `name@git+https://host/org/repo.git` key that a clone of the same repository produces, so one hashless entry approves the package whether pnpm clones it or downloads a tarball. GitHub (codeload), GitLab archive, and Bitbucket download URLs are covered, and the download host of each is anchored so a look-alike host cannot be rewritten into an unrelated repository key. Approving or denying a specific resolved commit by its full tarball dep path continues to work. The change is mirrored in both stacks, `@pnpm/building.policy` and `pacquet-package-manager`, with unit tests on each side. Closes pnpm#12367
pnpm 11.11 (pnpm#12856) let an `allowBuilds` entry approve a git dependency's build scripts by its repository URL without the resolved commit hash, but only for dependencies pnpm clones, whose dep path looks like `name@git+https://host/org/repo.git#<commit>`. The common `github:` case is not cloned: pnpm downloads it as a tarball from codeload.github.com, giving a dep path of the form `name@https://codeload.github.com/org/repo/tar.gz/<commit>`. That form has neither the `git+` prefix nor the `#` separator the hashless matcher keys on, so the entry was ignored and the build stayed unapproved unless it pinned the exact commit hash. Normalize a git-hosted tarball dep path back to the canonical `name@git+https://host/org/repo.git` key that a clone of the same repository produces, so one hashless entry approves the package whether pnpm clones it or downloads a tarball. GitHub (codeload), GitLab archive, and Bitbucket download URLs are covered, and the download host of each is anchored so a look-alike host cannot be rewritten into an unrelated repository key. Approving or denying a specific resolved commit by its full tarball dep path continues to work. The change is mirrored in both stacks, `@pnpm/building.policy` and `pacquet-package-manager`, with unit tests on each side.
pnpm 11.11 (pnpm#12856) let an `allowBuilds` entry approve a git dependency's build scripts by its repository URL without the resolved commit hash, but only for dependencies pnpm clones, whose dep path looks like `name@git+https://host/org/repo.git#<commit>`. The common `github:` case is not cloned: pnpm downloads it as a tarball from codeload.github.com, giving a dep path of the form `name@https://codeload.github.com/org/repo/tar.gz/<commit>`. That form has neither the `git+` prefix nor the `#` separator the hashless matcher keys on, so the entry was ignored and the build stayed unapproved unless it pinned the exact commit hash. Normalize a git-hosted tarball dep path back to the canonical `name@git+https://host/org/repo.git` key that a clone of the same repository produces, so one hashless entry approves the package whether pnpm clones it or downloads a tarball. GitHub (codeload), GitLab archive, and Bitbucket download URLs are covered, and the download host of each is anchored so a look-alike host cannot be rewritten into an unrelated repository key. Approving or denying a specific resolved commit by its full tarball dep path continues to work. The change is mirrored in both stacks, `@pnpm/building.policy` and `pacquet-package-manager`, with unit tests on each side.
pnpm 11.11 (pnpm#12856) let an `allowBuilds` entry approve a git dependency's build scripts by its repository URL without the resolved commit hash, but only for dependencies pnpm clones, whose dep path looks like `name@git+https://host/org/repo.git#<commit>`. The common `github:` case is not cloned: pnpm downloads it as a tarball from codeload.github.com, giving a dep path of the form `name@https://codeload.github.com/org/repo/tar.gz/<commit>`. That form has neither the `git+` prefix nor the `#` separator the hashless matcher keys on, so the entry was ignored and the build stayed unapproved unless it pinned the exact commit hash. Normalize a git-hosted tarball dep path back to the canonical `name@git+https://host/org/repo.git` key that a clone of the same repository produces, so one hashless entry approves the package whether pnpm clones it or downloads a tarball. GitHub (codeload), GitLab archive, and Bitbucket download URLs are covered, and the download host of each is anchored so a look-alike host cannot be rewritten into an unrelated repository key. Approving or denying a specific resolved commit by its full tarball dep path continues to work. The change is mirrored in both stacks, `@pnpm/building.policy` and `pacquet-package-manager`, with unit tests on each side.
pnpm 11.11 (pnpm#12856) let an `allowBuilds` entry approve a git dependency's build scripts by its repository URL without the resolved commit hash, but only for dependencies pnpm clones, whose dep path looks like `name@git+https://host/org/repo.git#<commit>`. The common `github:` case is not cloned: pnpm downloads it as a tarball from codeload.github.com, giving a dep path of the form `name@https://codeload.github.com/org/repo/tar.gz/<commit>`. That form has neither the `git+` prefix nor the `#` separator the hashless matcher keys on, so the entry was ignored and the build stayed unapproved unless it pinned the exact commit hash. Normalize a git-hosted tarball dep path back to the canonical `name@git+https://host/org/repo.git` key that a clone of the same repository produces, so one hashless entry approves the package whether pnpm clones it or downloads a tarball. GitHub (codeload), GitLab archive, and Bitbucket download URLs are covered, and the download host of each is anchored so a look-alike host cannot be rewritten into an unrelated repository key. Approving or denying a specific resolved commit by its full tarball dep path continues to work. The change is mirrored in both stacks, `@pnpm/building.policy` and `pacquet-package-manager`, with unit tests on each side.
pnpm 11.11 (pnpm#12856) let an `allowBuilds` entry approve a git dependency's build scripts by its repository URL without the resolved commit hash, but only for dependencies pnpm clones, whose dep path looks like `name@git+https://host/org/repo.git#<commit>`. The common `github:` case is not cloned: pnpm downloads it as a tarball from codeload.github.com, giving a dep path of the form `name@https://codeload.github.com/org/repo/tar.gz/<commit>`. That form has neither the `git+` prefix nor the `#` separator the hashless matcher keys on, so the entry was ignored and the build stayed unapproved unless it pinned the exact commit hash. Normalize a git-hosted tarball dep path back to the canonical `name@git+https://host/org/repo.git` key that a clone of the same repository produces, so one hashless entry approves the package whether pnpm clones it or downloads a tarball. GitHub (codeload), GitLab archive, and Bitbucket download URLs are covered, and the download host of each is anchored so a look-alike host cannot be rewritten into an unrelated repository key. Approving or denying a specific resolved commit by its full tarball dep path continues to work. The change is mirrored in both stacks, `@pnpm/building.policy` and `pacquet-package-manager`, with unit tests on each side.
Summary
Allows
allowBuildskeys for git-hosted packages to omit the resolved commit hash, for examplepkg@git+ssh://host/org/repo.git.Keeps package-name-only approvals registry-only, so
pkg: truestill does not approve git artifacts. The same policy is implemented in the TypeScript CLI and the Rustpacquet/port, with a changeset forpnpmand@pnpm/building.policy.Fixes #12367.
Validation:
corepack pnpm --filter @pnpm/building.policy test -- --runTestsByPath test/index.tscorepack pnpm --filter @pnpm/installing.deps-installer compilecargo fmt --check -- pacquet/crates/package-manager/src/build_modules.rs pacquet/crates/package-manager/src/build_modules/tests.rscargo test -p pacquet-package-manager explicit_allow_by_git_repo_allows_untrusted_package_identity -- --nocapturecorepack pnpm exec cspell .changeset/allow-git-repo-builds.md pnpm11/building/policy/src/index.ts pnpm11/building/policy/test/index.ts pnpm11/installing/deps-installer/test/install/lifecycleScripts.ts --no-progressgit diff --checkFull Rust workspace pre-push reached
cargo clippy --all-targets --workspace -- -D warningsbut could not complete in this container because compiling the workspace filled the local filesystem.Squash Commit Body
Checklist
pacquet/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Summary by CodeRabbit
New Features
Bug Fixes
Tests