codex-plugin-doctor 1.9.0 → 1.11.0
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 +2 -2
- package/dist/core/review-bundle.js +60 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -358,9 +358,9 @@ jobs:
|
|
|
358
358
|
runs-on: ubuntu-latest
|
|
359
359
|
steps:
|
|
360
360
|
- uses: actions/checkout@v5
|
|
361
|
-
- uses: Esquetta/CodexPluginDoctor@v1.
|
|
361
|
+
- uses: Esquetta/CodexPluginDoctor@v1.11.0
|
|
362
362
|
with:
|
|
363
|
-
version: "1.
|
|
363
|
+
version: "1.11.0"
|
|
364
364
|
path: .
|
|
365
365
|
runtime: "true"
|
|
366
366
|
policy: codex-publish
|
|
@@ -46,6 +46,10 @@ function relativeBundleFiles() {
|
|
|
46
46
|
releaseEvidenceJson: "release-evidence.json"
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
+
function isPathInsideDirectory(candidatePath, directoryPath) {
|
|
50
|
+
const relativePath = path.relative(directoryPath, candidatePath);
|
|
51
|
+
return relativePath === "" || (!relativePath.startsWith("..") && !path.isAbsolute(relativePath));
|
|
52
|
+
}
|
|
49
53
|
function bundleStatus(runtimePolicy, releaseEvidence) {
|
|
50
54
|
if (runtimePolicy.status === "fail" || releaseEvidence.status === "fail") {
|
|
51
55
|
return "fail";
|
|
@@ -344,7 +348,16 @@ export async function verifyDoctorReviewBundle(bundleDirectory, options) {
|
|
|
344
348
|
const files = manifest?.files ?? relativeBundleFiles();
|
|
345
349
|
for (const [fileKey, relativePath] of Object.entries(files)) {
|
|
346
350
|
try {
|
|
347
|
-
const
|
|
351
|
+
const artifactPath = path.resolve(resolvedBundleDirectory, relativePath);
|
|
352
|
+
if (!isPathInsideDirectory(artifactPath, resolvedBundleDirectory)) {
|
|
353
|
+
checks.push({
|
|
354
|
+
id: `review_bundle.file.${fileKey}`,
|
|
355
|
+
status: "fail",
|
|
356
|
+
message: `${relativePath} resolves outside the review bundle directory.`
|
|
357
|
+
});
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
const fileStat = await stat(artifactPath);
|
|
348
361
|
checks.push({
|
|
349
362
|
id: `review_bundle.file.${fileKey}`,
|
|
350
363
|
status: fileStat.isFile() ? "pass" : "fail",
|
|
@@ -377,9 +390,54 @@ export async function verifyDoctorReviewBundle(bundleDirectory, options) {
|
|
|
377
390
|
message: "The review bundle manifest uses SHA-256 integrity digests."
|
|
378
391
|
});
|
|
379
392
|
}
|
|
393
|
+
const expectedIntegrityFileKeys = Object.keys(files).filter((fileKey) => fileKey !== "manifest");
|
|
394
|
+
const integrityFileKeys = Object.keys(manifest.integrity.files);
|
|
395
|
+
for (const fileKey of expectedIntegrityFileKeys) {
|
|
396
|
+
if (!(fileKey in manifest.integrity.files)) {
|
|
397
|
+
integrityStatus = "fail";
|
|
398
|
+
checks.push({
|
|
399
|
+
id: `review_bundle.integrity.${fileKey}`,
|
|
400
|
+
status: "fail",
|
|
401
|
+
message: `${files[fileKey]} is missing a manifest integrity entry.`
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
for (const fileKey of integrityFileKeys) {
|
|
406
|
+
if (!expectedIntegrityFileKeys.includes(fileKey)) {
|
|
407
|
+
integrityStatus = "fail";
|
|
408
|
+
checks.push({
|
|
409
|
+
id: `review_bundle.integrity.${fileKey}`,
|
|
410
|
+
status: "fail",
|
|
411
|
+
message: "The review bundle manifest includes an unexpected integrity entry."
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
380
415
|
for (const [fileKey, expected] of Object.entries(manifest.integrity.files)) {
|
|
416
|
+
if (!expectedIntegrityFileKeys.includes(fileKey)) {
|
|
417
|
+
continue;
|
|
418
|
+
}
|
|
381
419
|
try {
|
|
382
|
-
const
|
|
420
|
+
const declaredPath = files[fileKey];
|
|
421
|
+
if (expected.path !== declaredPath) {
|
|
422
|
+
integrityStatus = "fail";
|
|
423
|
+
checks.push({
|
|
424
|
+
id: `review_bundle.integrity.${fileKey}.path`,
|
|
425
|
+
status: "fail",
|
|
426
|
+
message: `${expected.path} does not match the declared bundle file path.`
|
|
427
|
+
});
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
const integrityPath = path.resolve(resolvedBundleDirectory, expected.path);
|
|
431
|
+
if (!isPathInsideDirectory(integrityPath, resolvedBundleDirectory)) {
|
|
432
|
+
integrityStatus = "fail";
|
|
433
|
+
checks.push({
|
|
434
|
+
id: `review_bundle.integrity.${fileKey}.path`,
|
|
435
|
+
status: "fail",
|
|
436
|
+
message: `${expected.path} resolves outside the review bundle directory.`
|
|
437
|
+
});
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
const content = await readFile(integrityPath);
|
|
383
441
|
const digest = sha256(content);
|
|
384
442
|
const matches = digest === expected.digest && content.byteLength === expected.bytes;
|
|
385
443
|
if (!matches) {
|
package/package.json
CHANGED