isomorphic-git 1.43.2 → 1.43.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/index.cjs +33 -32
- package/index.js +33 -32
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +31 -30
- package/managers/index.js +31 -30
- package/managers/index.umd.min.js +1 -1
- package/managers/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -461,6 +461,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
|
|
|
461
461
|
</tr>
|
|
462
462
|
<tr>
|
|
463
463
|
<td align="center"><a href="https://github.com/ewraj"><img src="https://avatars.githubusercontent.com/u/212665522?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Raj Royal</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ewraj" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ewraj" title="Tests">⚠️</a></td>
|
|
464
|
+
<td align="center"><a href="https://github.com/macabeus"><img src="https://avatars.githubusercontent.com/u/9501115?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Bruno Macabeus</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=macabeus" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=macabeus" title="Tests">⚠️</a></td>
|
|
464
465
|
</tr>
|
|
465
466
|
</table>
|
|
466
467
|
|
package/index.cjs
CHANGED
|
@@ -3718,37 +3718,12 @@ async function readObjectPacked({
|
|
|
3718
3718
|
}
|
|
3719
3719
|
|
|
3720
3720
|
// === Packfile Integrity Verification ===
|
|
3721
|
-
// Performance optimization:
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
// 1. Fast Check: Verify packfile trailer matches index record
|
|
3726
|
-
// Use subarray instead of slice to avoid memory copy (zero-copy for large packfiles)
|
|
3727
|
-
const packTrailer = pack.subarray(-20);
|
|
3728
|
-
const packTrailerSha = Array.from(packTrailer)
|
|
3729
|
-
.map(b => b.toString(16).padStart(2, '0'))
|
|
3730
|
-
.join('');
|
|
3731
|
-
if (packTrailerSha !== expectedShaFromIndex) {
|
|
3732
|
-
throw new InternalError(
|
|
3733
|
-
`Packfile trailer mismatch: expected ${expectedShaFromIndex}, got ${packTrailerSha}. The packfile may be corrupted.`
|
|
3734
|
-
)
|
|
3735
|
-
}
|
|
3736
|
-
|
|
3737
|
-
// 2. Deep Integrity Check: Calculate actual SHA-1 of packfile payload.
|
|
3738
|
-
// The Node package build swaps in a chunked implementation for large packs.
|
|
3739
|
-
const actualPayloadSha = await shasumRange(pack, {
|
|
3740
|
-
start: 0,
|
|
3741
|
-
end: pack.length - 20,
|
|
3742
|
-
});
|
|
3743
|
-
if (actualPayloadSha !== expectedShaFromIndex) {
|
|
3744
|
-
throw new InternalError(
|
|
3745
|
-
`Packfile payload corrupted: calculated ${actualPayloadSha} but expected ${expectedShaFromIndex}. The packfile may have been tampered with.`
|
|
3746
|
-
)
|
|
3747
|
-
}
|
|
3748
|
-
|
|
3749
|
-
// Mark as verified to prevent performance regression on subsequent reads
|
|
3750
|
-
p._checksumVerified = true;
|
|
3721
|
+
// Performance optimization: verify only once per packfile.
|
|
3722
|
+
// Concurrent reads share the same verification promise.
|
|
3723
|
+
if (!p._checksumVerification) {
|
|
3724
|
+
p._checksumVerification = verifyPackfile(pack, p.packfileSha);
|
|
3751
3725
|
}
|
|
3726
|
+
await p._checksumVerification;
|
|
3752
3727
|
|
|
3753
3728
|
const result = await p.read({ oid, getExternalRefDelta });
|
|
3754
3729
|
result.format = 'content';
|
|
@@ -3760,6 +3735,32 @@ async function readObjectPacked({
|
|
|
3760
3735
|
return null
|
|
3761
3736
|
}
|
|
3762
3737
|
|
|
3738
|
+
async function verifyPackfile(pack, expectedShaFromIndex) {
|
|
3739
|
+
// 1. Fast Check: Verify packfile trailer matches index record
|
|
3740
|
+
// Use subarray instead of slice to avoid memory copy (zero-copy for large packfiles)
|
|
3741
|
+
const packTrailer = pack.subarray(-20);
|
|
3742
|
+
const packTrailerSha = Array.from(packTrailer)
|
|
3743
|
+
.map(b => b.toString(16).padStart(2, '0'))
|
|
3744
|
+
.join('');
|
|
3745
|
+
if (packTrailerSha !== expectedShaFromIndex) {
|
|
3746
|
+
throw new InternalError(
|
|
3747
|
+
`Packfile trailer mismatch: expected ${expectedShaFromIndex}, got ${packTrailerSha}. The packfile may be corrupted.`
|
|
3748
|
+
)
|
|
3749
|
+
}
|
|
3750
|
+
|
|
3751
|
+
// 2. Deep Integrity Check: Calculate actual SHA-1 of packfile payload.
|
|
3752
|
+
// The Node package build swaps in a chunked implementation for large packs.
|
|
3753
|
+
const actualPayloadSha = await shasumRange(pack, {
|
|
3754
|
+
start: 0,
|
|
3755
|
+
end: pack.length - 20,
|
|
3756
|
+
});
|
|
3757
|
+
if (actualPayloadSha !== expectedShaFromIndex) {
|
|
3758
|
+
throw new InternalError(
|
|
3759
|
+
`Packfile payload corrupted: calculated ${actualPayloadSha} but expected ${expectedShaFromIndex}. The packfile may have been tampered with.`
|
|
3760
|
+
)
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3763
3764
|
/**
|
|
3764
3765
|
* @param {object} args
|
|
3765
3766
|
* @param {import('../models/FileSystem.js').FileSystem} args.fs
|
|
@@ -10055,8 +10056,8 @@ function filterCapabilities(server, client) {
|
|
|
10055
10056
|
|
|
10056
10057
|
const pkg = {
|
|
10057
10058
|
name: 'isomorphic-git',
|
|
10058
|
-
version: '1.43.
|
|
10059
|
-
agent: 'git/isomorphic-git@1.43.
|
|
10059
|
+
version: '1.43.3',
|
|
10060
|
+
agent: 'git/isomorphic-git@1.43.3',
|
|
10060
10061
|
};
|
|
10061
10062
|
|
|
10062
10063
|
class FIFO {
|
package/index.js
CHANGED
|
@@ -3705,37 +3705,12 @@ async function readObjectPacked({
|
|
|
3705
3705
|
}
|
|
3706
3706
|
|
|
3707
3707
|
// === Packfile Integrity Verification ===
|
|
3708
|
-
// Performance optimization:
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
// 1. Fast Check: Verify packfile trailer matches index record
|
|
3713
|
-
// Use subarray instead of slice to avoid memory copy (zero-copy for large packfiles)
|
|
3714
|
-
const packTrailer = pack.subarray(-20);
|
|
3715
|
-
const packTrailerSha = Array.from(packTrailer)
|
|
3716
|
-
.map(b => b.toString(16).padStart(2, '0'))
|
|
3717
|
-
.join('');
|
|
3718
|
-
if (packTrailerSha !== expectedShaFromIndex) {
|
|
3719
|
-
throw new InternalError(
|
|
3720
|
-
`Packfile trailer mismatch: expected ${expectedShaFromIndex}, got ${packTrailerSha}. The packfile may be corrupted.`
|
|
3721
|
-
)
|
|
3722
|
-
}
|
|
3723
|
-
|
|
3724
|
-
// 2. Deep Integrity Check: Calculate actual SHA-1 of packfile payload.
|
|
3725
|
-
// The Node package build swaps in a chunked implementation for large packs.
|
|
3726
|
-
const actualPayloadSha = await shasumRange(pack, {
|
|
3727
|
-
start: 0,
|
|
3728
|
-
end: pack.length - 20,
|
|
3729
|
-
});
|
|
3730
|
-
if (actualPayloadSha !== expectedShaFromIndex) {
|
|
3731
|
-
throw new InternalError(
|
|
3732
|
-
`Packfile payload corrupted: calculated ${actualPayloadSha} but expected ${expectedShaFromIndex}. The packfile may have been tampered with.`
|
|
3733
|
-
)
|
|
3734
|
-
}
|
|
3735
|
-
|
|
3736
|
-
// Mark as verified to prevent performance regression on subsequent reads
|
|
3737
|
-
p._checksumVerified = true;
|
|
3708
|
+
// Performance optimization: verify only once per packfile.
|
|
3709
|
+
// Concurrent reads share the same verification promise.
|
|
3710
|
+
if (!p._checksumVerification) {
|
|
3711
|
+
p._checksumVerification = verifyPackfile(pack, p.packfileSha);
|
|
3738
3712
|
}
|
|
3713
|
+
await p._checksumVerification;
|
|
3739
3714
|
|
|
3740
3715
|
const result = await p.read({ oid, getExternalRefDelta });
|
|
3741
3716
|
result.format = 'content';
|
|
@@ -3747,6 +3722,32 @@ async function readObjectPacked({
|
|
|
3747
3722
|
return null
|
|
3748
3723
|
}
|
|
3749
3724
|
|
|
3725
|
+
async function verifyPackfile(pack, expectedShaFromIndex) {
|
|
3726
|
+
// 1. Fast Check: Verify packfile trailer matches index record
|
|
3727
|
+
// Use subarray instead of slice to avoid memory copy (zero-copy for large packfiles)
|
|
3728
|
+
const packTrailer = pack.subarray(-20);
|
|
3729
|
+
const packTrailerSha = Array.from(packTrailer)
|
|
3730
|
+
.map(b => b.toString(16).padStart(2, '0'))
|
|
3731
|
+
.join('');
|
|
3732
|
+
if (packTrailerSha !== expectedShaFromIndex) {
|
|
3733
|
+
throw new InternalError(
|
|
3734
|
+
`Packfile trailer mismatch: expected ${expectedShaFromIndex}, got ${packTrailerSha}. The packfile may be corrupted.`
|
|
3735
|
+
)
|
|
3736
|
+
}
|
|
3737
|
+
|
|
3738
|
+
// 2. Deep Integrity Check: Calculate actual SHA-1 of packfile payload.
|
|
3739
|
+
// The Node package build swaps in a chunked implementation for large packs.
|
|
3740
|
+
const actualPayloadSha = await shasumRange(pack, {
|
|
3741
|
+
start: 0,
|
|
3742
|
+
end: pack.length - 20,
|
|
3743
|
+
});
|
|
3744
|
+
if (actualPayloadSha !== expectedShaFromIndex) {
|
|
3745
|
+
throw new InternalError(
|
|
3746
|
+
`Packfile payload corrupted: calculated ${actualPayloadSha} but expected ${expectedShaFromIndex}. The packfile may have been tampered with.`
|
|
3747
|
+
)
|
|
3748
|
+
}
|
|
3749
|
+
}
|
|
3750
|
+
|
|
3750
3751
|
/**
|
|
3751
3752
|
* @param {object} args
|
|
3752
3753
|
* @param {import('../models/FileSystem.js').FileSystem} args.fs
|
|
@@ -10042,8 +10043,8 @@ function filterCapabilities(server, client) {
|
|
|
10042
10043
|
|
|
10043
10044
|
const pkg = {
|
|
10044
10045
|
name: 'isomorphic-git',
|
|
10045
|
-
version: '1.43.
|
|
10046
|
-
agent: 'git/isomorphic-git@1.43.
|
|
10046
|
+
version: '1.43.3',
|
|
10047
|
+
agent: 'git/isomorphic-git@1.43.3',
|
|
10047
10048
|
};
|
|
10048
10049
|
|
|
10049
10050
|
class FIFO {
|