isomorphic-git 1.37.0 → 1.37.2
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 +3 -0
- package/index.cjs +36 -2
- package/index.js +36 -2
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +34 -0
- package/managers/index.js +34 -0
- 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
|
@@ -414,6 +414,9 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
|
|
|
414
414
|
<td align="center"><a href="https://github.com/Andarist"><img src="https://avatars.githubusercontent.com/u/9800850?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Mateusz Burzyński</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=Andarist" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=Andarist" title="Tests">⚠️</a></td>
|
|
415
415
|
<td align="center"><a href="https://github.com/IAmSSH"><img src="https://avatars.githubusercontent.com/u/34162350?v=4?s=60" width="60px;" alt=""/><br /><sub><b>iamssh</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=IAmSSH" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=IAmSSH" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=IAmSSH" title="Tests">⚠️</a></td>
|
|
416
416
|
</tr>
|
|
417
|
+
<tr>
|
|
418
|
+
<td align="center"><a href="https://github.com/N0zoM1z0"><img src="https://avatars.githubusercontent.com/u/161784452?v=4?s=60" width="60px;" alt=""/><br /><sub><b>N0zoM1z0</b></sub></a><br /><a href="#security-N0zoM1z0" title="Security">🛡️</a></td>
|
|
419
|
+
</tr>
|
|
417
420
|
</table>
|
|
418
421
|
|
|
419
422
|
<!-- markdownlint-restore -->
|
package/index.cjs
CHANGED
|
@@ -3395,6 +3395,40 @@ async function readObjectPacked({
|
|
|
3395
3395
|
const packFile = indexFile.replace(/idx$/, 'pack');
|
|
3396
3396
|
p.pack = fs.read(packFile);
|
|
3397
3397
|
}
|
|
3398
|
+
const pack = await p.pack;
|
|
3399
|
+
|
|
3400
|
+
// === Packfile Integrity Verification ===
|
|
3401
|
+
// Performance optimization: use _checksumVerified flag to verify only once per packfile
|
|
3402
|
+
if (!p._checksumVerified) {
|
|
3403
|
+
const expectedShaFromIndex = p.packfileSha;
|
|
3404
|
+
|
|
3405
|
+
// 1. Fast Check: Verify packfile trailer matches index record
|
|
3406
|
+
// Use subarray instead of slice to avoid memory copy (zero-copy for large packfiles)
|
|
3407
|
+
const packTrailer = pack.subarray(-20);
|
|
3408
|
+
const packTrailerSha = Array.from(packTrailer)
|
|
3409
|
+
.map(b => b.toString(16).padStart(2, '0'))
|
|
3410
|
+
.join('');
|
|
3411
|
+
if (packTrailerSha !== expectedShaFromIndex) {
|
|
3412
|
+
throw new InternalError(
|
|
3413
|
+
`Packfile trailer mismatch: expected ${expectedShaFromIndex}, got ${packTrailerSha}. The packfile may be corrupted.`
|
|
3414
|
+
)
|
|
3415
|
+
}
|
|
3416
|
+
|
|
3417
|
+
// 2. Deep Integrity Check: Calculate actual SHA-1 of packfile payload
|
|
3418
|
+
// This ensures true data integrity by verifying the entire packfile content
|
|
3419
|
+
// Use subarray for zero-copy reading of large files
|
|
3420
|
+
const payload = pack.subarray(0, -20);
|
|
3421
|
+
const actualPayloadSha = await shasum(payload);
|
|
3422
|
+
if (actualPayloadSha !== expectedShaFromIndex) {
|
|
3423
|
+
throw new InternalError(
|
|
3424
|
+
`Packfile payload corrupted: calculated ${actualPayloadSha} but expected ${expectedShaFromIndex}. The packfile may have been tampered with.`
|
|
3425
|
+
)
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
// Mark as verified to prevent performance regression on subsequent reads
|
|
3429
|
+
p._checksumVerified = true;
|
|
3430
|
+
}
|
|
3431
|
+
|
|
3398
3432
|
const result = await p.read({ oid, getExternalRefDelta });
|
|
3399
3433
|
result.format = 'content';
|
|
3400
3434
|
result.source = `objects/pack/${filename.replace(/idx$/, 'pack')}`;
|
|
@@ -9261,8 +9295,8 @@ function filterCapabilities(server, client) {
|
|
|
9261
9295
|
|
|
9262
9296
|
const pkg = {
|
|
9263
9297
|
name: 'isomorphic-git',
|
|
9264
|
-
version: '1.37.
|
|
9265
|
-
agent: 'git/isomorphic-git@1.37.
|
|
9298
|
+
version: '1.37.2',
|
|
9299
|
+
agent: 'git/isomorphic-git@1.37.2',
|
|
9266
9300
|
};
|
|
9267
9301
|
|
|
9268
9302
|
class FIFO {
|
package/index.js
CHANGED
|
@@ -3389,6 +3389,40 @@ async function readObjectPacked({
|
|
|
3389
3389
|
const packFile = indexFile.replace(/idx$/, 'pack');
|
|
3390
3390
|
p.pack = fs.read(packFile);
|
|
3391
3391
|
}
|
|
3392
|
+
const pack = await p.pack;
|
|
3393
|
+
|
|
3394
|
+
// === Packfile Integrity Verification ===
|
|
3395
|
+
// Performance optimization: use _checksumVerified flag to verify only once per packfile
|
|
3396
|
+
if (!p._checksumVerified) {
|
|
3397
|
+
const expectedShaFromIndex = p.packfileSha;
|
|
3398
|
+
|
|
3399
|
+
// 1. Fast Check: Verify packfile trailer matches index record
|
|
3400
|
+
// Use subarray instead of slice to avoid memory copy (zero-copy for large packfiles)
|
|
3401
|
+
const packTrailer = pack.subarray(-20);
|
|
3402
|
+
const packTrailerSha = Array.from(packTrailer)
|
|
3403
|
+
.map(b => b.toString(16).padStart(2, '0'))
|
|
3404
|
+
.join('');
|
|
3405
|
+
if (packTrailerSha !== expectedShaFromIndex) {
|
|
3406
|
+
throw new InternalError(
|
|
3407
|
+
`Packfile trailer mismatch: expected ${expectedShaFromIndex}, got ${packTrailerSha}. The packfile may be corrupted.`
|
|
3408
|
+
)
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
// 2. Deep Integrity Check: Calculate actual SHA-1 of packfile payload
|
|
3412
|
+
// This ensures true data integrity by verifying the entire packfile content
|
|
3413
|
+
// Use subarray for zero-copy reading of large files
|
|
3414
|
+
const payload = pack.subarray(0, -20);
|
|
3415
|
+
const actualPayloadSha = await shasum(payload);
|
|
3416
|
+
if (actualPayloadSha !== expectedShaFromIndex) {
|
|
3417
|
+
throw new InternalError(
|
|
3418
|
+
`Packfile payload corrupted: calculated ${actualPayloadSha} but expected ${expectedShaFromIndex}. The packfile may have been tampered with.`
|
|
3419
|
+
)
|
|
3420
|
+
}
|
|
3421
|
+
|
|
3422
|
+
// Mark as verified to prevent performance regression on subsequent reads
|
|
3423
|
+
p._checksumVerified = true;
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3392
3426
|
const result = await p.read({ oid, getExternalRefDelta });
|
|
3393
3427
|
result.format = 'content';
|
|
3394
3428
|
result.source = `objects/pack/${filename.replace(/idx$/, 'pack')}`;
|
|
@@ -9255,8 +9289,8 @@ function filterCapabilities(server, client) {
|
|
|
9255
9289
|
|
|
9256
9290
|
const pkg = {
|
|
9257
9291
|
name: 'isomorphic-git',
|
|
9258
|
-
version: '1.37.
|
|
9259
|
-
agent: 'git/isomorphic-git@1.37.
|
|
9292
|
+
version: '1.37.2',
|
|
9293
|
+
agent: 'git/isomorphic-git@1.37.2',
|
|
9260
9294
|
};
|
|
9261
9295
|
|
|
9262
9296
|
class FIFO {
|