Skip to content

Commit 3b5fb23

Browse files
committed
chore(deps): update openshell to 0.0.106
Patch-Walker-Manifest: sha256:6d6499fda9409244210dd3dac0afcb0962928c106f1a5ab08ef5a2530193e5af Refs #6256 Refs #3136 Refs #6871 Refs #7367 Refs #7937 Refs #7957 Refs #8769 Refs #8887 Refs #8893 Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
1 parent 6299c62 commit 3b5fb23

2 files changed

Lines changed: 45 additions & 24 deletions

File tree

test/installer-hash-check.test.ts

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -495,25 +495,33 @@ const CHECKER_MUTATIONS: Partial<Record<FixtureMode, (source: string) => string>
495495
),
496496
"trusted-formula-mismatch": (source) => source.replace(FORMULA_DIGEST, "0".repeat(64)),
497497
};
498+
const prependTrustedPin = (source: string, name: string, pin: string): string => {
499+
const declarationStart = source.indexOf(`const ${name}`);
500+
const assignment = source.indexOf("=", declarationStart);
501+
const arrayStart = source.indexOf("[", assignment);
502+
assert.notEqual(declarationStart, -1, `${name} declaration must exist`);
503+
assert.notEqual(assignment, -1, `${name} assignment must exist`);
504+
assert.notEqual(arrayStart, -1, `${name} array must exist`);
505+
return `${source.slice(0, arrayStart + 1)}\n${pin}${source.slice(arrayStart + 1)}`;
506+
};
507+
498508
const trustAlternateRelease = (source: string): string => {
499509
const digests = SYNTHETIC_SANDBOX_BUILD_DIGESTS;
500-
const sandbox = source.replace(
501-
"const TRUSTED_SANDBOX_BUILD_PINS: readonly TrustedSandboxBuildPin[] = [\n",
502-
`const TRUSTED_SANDBOX_BUILD_PINS: readonly TrustedSandboxBuildPin[] = [
503-
{ required: false, sha256: "${digests[0]}", version: "9.9.9" },
504-
{ required: false, sha256: "${digests[1]}", version: "9.9.9" },
505-
`,
510+
const sandbox = prependTrustedPin(
511+
source,
512+
"TRUSTED_SANDBOX_BUILD_PINS",
513+
` { required: false, sha256: "${digests[0]}", version: "9.9.9" },
514+
{ required: false, sha256: "${digests[1]}", version: "9.9.9" },`,
506515
);
507-
return sandbox.replace(
508-
"const TRUSTED_SUPERVISOR_MANIFEST_PINS: readonly TrustedSupervisorManifestPin[] = [\n",
509-
`const TRUSTED_SUPERVISOR_MANIFEST_PINS: readonly TrustedSupervisorManifestPin[] = [
510-
{
516+
return prependTrustedPin(
517+
sandbox,
518+
"TRUSTED_SUPERVISOR_MANIFEST_PINS",
519+
` {
511520
image: OPENSHELL_SUPERVISOR_IMAGE,
512521
manifestDigest: "${SYNTHETIC_SUPERVISOR_MANIFEST_DIGEST}",
513522
required: false,
514523
version: "9.9.9",
515-
},
516-
`,
524+
},`,
517525
);
518526
};
519527
const PARSER_MUTATIONS: Partial<Record<FixtureMode, (source: string) => string>> = {
@@ -524,10 +532,22 @@ const tempDirs: string[] = [];
524532

525533
function trustedPinArray(name: string): string {
526534
const start = TRUSTED_PARSER_TEMPLATE.indexOf(`const ${name}`);
527-
const end = TRUSTED_PARSER_TEMPLATE.indexOf("\n];", start);
535+
const assignment = TRUSTED_PARSER_TEMPLATE.indexOf("=", start);
536+
const arrayStart = TRUSTED_PARSER_TEMPLATE.indexOf("[", assignment);
528537
expect(start, `${name} start`).not.toBe(-1);
529-
expect(end, `${name} end`).not.toBe(-1);
530-
return TRUSTED_PARSER_TEMPLATE.slice(start, end);
538+
expect(assignment, `${name} assignment`).not.toBe(-1);
539+
expect(arrayStart, `${name} array start`).not.toBe(-1);
540+
541+
let depth = 0;
542+
for (let index = arrayStart; index < TRUSTED_PARSER_TEMPLATE.length; index += 1) {
543+
const character = TRUSTED_PARSER_TEMPLATE[index];
544+
if (character === "[") depth += 1;
545+
if (character !== "]") continue;
546+
depth -= 1;
547+
if (depth === 0) return TRUSTED_PARSER_TEMPLATE.slice(arrayStart + 1, index);
548+
}
549+
550+
expect.fail(`${name} array end`);
531551
}
532552

533553
function trustedSandboxBuildDigests(version: string): readonly [string, string] | undefined {

test/installer-supervisor-manifest-trust.test.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,25 +185,22 @@ function runParser(options: RunOptions = {}) {
185185
}
186186

187187
describe("OpenShell supervisor manifest trust", () => {
188-
it("accepts the selected base-trusted OpenShell 0.0.101 supervisor identity (#8893)", () => {
188+
it("accepts the selected base-trusted OpenShell 0.0.106 supervisor identity (#6256)", () => {
189189
const result = runParser();
190190

191191
expect(result.status, result.stderr).toBe(0);
192192
});
193193

194-
it("accepts the base-trusted OpenShell 0.0.103 supervisor identity before version selection (#8893)", () => {
195-
const result = runParser({
196-
transformSupervisor: (source) =>
197-
addSupervisorManifestPin(source, "0.0.103", V00103_SUPERVISOR_MANIFEST_DIGEST),
198-
});
194+
it("accepts the selected base-trusted OpenShell 0.0.103 supervisor identity (#8893)", () => {
195+
const result = runParser({ selectV00103: true });
199196

200197
expect(result.status, result.stderr).toBe(0);
201198
});
202199

203200
it("rejects a replacement supervisor digest", () => {
204201
const result = runParser({
205202
transformSupervisor: (source) =>
206-
addSupervisorManifestPin(source, "0.0.103", REPLACEMENT_SUPERVISOR_MANIFEST_DIGEST),
203+
source.replace(V00103_SUPERVISOR_MANIFEST_DIGEST, REPLACEMENT_SUPERVISOR_MANIFEST_DIGEST),
207204
});
208205

209206
expect(result.status).toBe(1);
@@ -223,7 +220,11 @@ describe("OpenShell supervisor manifest trust", () => {
223220
});
224221

225222
it("rejects selecting OpenShell 0.0.103 without its supervisor manifest identity (#8893)", () => {
226-
const result = runParser({ selectV00103: true });
223+
const result = runParser({
224+
selectV00103: true,
225+
transformSupervisor: (source) =>
226+
source.replace(/^ "0\.0\.103": "sha256:[a-f0-9]{64}",\n/mu, ""),
227+
});
227228

228229
expect(result.status).toBe(1);
229230
expect(result.stderr).toContain(
@@ -236,7 +237,7 @@ describe("OpenShell supervisor manifest trust", () => {
236237
candidateParserBypass: true,
237238
selectV00103: true,
238239
transformSupervisor: (source) =>
239-
addSupervisorManifestPin(source, "0.0.103", REPLACEMENT_SUPERVISOR_MANIFEST_DIGEST),
240+
source.replace(V00103_SUPERVISOR_MANIFEST_DIGEST, REPLACEMENT_SUPERVISOR_MANIFEST_DIGEST),
240241
});
241242

242243
expect(result.status).toBe(1);

0 commit comments

Comments
 (0)