Initial curated chimera source from a8ae5b1db07fb49926c94585e2718e5130330974
This commit is contained in:
commit
c737a37f71
531 files changed
+119270
No files matched your search
@@ -0,0 +1,100 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const test = require('node:test');
|
||||
const {
|
||||
classifyPs5UploadRuntimeIdentity,
|
||||
assertMutationRuntimeIdentity,
|
||||
} = require('../../src/services/ps5upload-runtime-identity');
|
||||
|
||||
const REVISION = 'ec0e5c4e95520f2dc26c226a909dc5a95e385f41';
|
||||
const ENGINE = 'd'.repeat(64);
|
||||
const PAYLOAD = '3'.repeat(64);
|
||||
|
||||
function productionIdentity(overrides = {}) {
|
||||
return {
|
||||
lane: 'production',
|
||||
expected: {
|
||||
version: '5.4.19', revision: REVISION,
|
||||
engineSha256: ENGINE, payloadSha256: PAYLOAD,
|
||||
},
|
||||
observed: {
|
||||
engine: { version: '5.4.19', revision: REVISION, sha256: ENGINE, evidence: 'running-process-bytes' },
|
||||
payload: { version: '5.4.19', revision: REVISION, sha256: PAYLOAD, evidence: 'loader-input-and-instance-transition' },
|
||||
dpi: { active: false },
|
||||
},
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
test('A5 exact identity binds running engine and console payload bytes', () => {
|
||||
const identity = classifyPs5UploadRuntimeIdentity(productionIdentity());
|
||||
assert.equal(identity.status, 'exact');
|
||||
assert.equal(identity.mutationAllowed, true);
|
||||
assert.equal(identity.engine.observedSha256, ENGINE);
|
||||
assert.equal(identity.payload.observedSha256, PAYLOAD);
|
||||
assert.deepEqual(identity.discrepancies, []);
|
||||
});
|
||||
|
||||
test('A5 trusts exact bytes over a stale self-reported version label but records it', () => {
|
||||
const input = productionIdentity();
|
||||
input.observed.engine.version = '5.2.1';
|
||||
const identity = classifyPs5UploadRuntimeIdentity(input);
|
||||
assert.equal(identity.status, 'exact');
|
||||
assert.equal(identity.mutationAllowed, true);
|
||||
assert.ok(identity.discrepancies.some(item => item.code === 'engine-version-label-mismatch'));
|
||||
});
|
||||
|
||||
test('A5 classifies the observed 5.2.1 host plus 5.4.19 payload as split and blocks mutation', () => {
|
||||
const input = productionIdentity();
|
||||
input.observed.engine = { version: '5.2.1', revision: null, sha256: 'a'.repeat(64), evidence: 'running-process-bytes' };
|
||||
const identity = classifyPs5UploadRuntimeIdentity(input);
|
||||
assert.equal(identity.status, 'split');
|
||||
assert.equal(identity.mutationAllowed, false);
|
||||
assert.throws(() => assertMutationRuntimeIdentity(identity), error => error.code === 'PS5_FPKG_RUNTIME_IDENTITY_SPLIT');
|
||||
});
|
||||
|
||||
test('A5 classifies coherent older runtime bytes as stale', () => {
|
||||
const input = productionIdentity();
|
||||
input.observed.engine = { version: '5.2.1', sha256: 'a'.repeat(64), evidence: 'running-process-bytes' };
|
||||
input.observed.payload = { version: '5.2.1', sha256: 'b'.repeat(64), evidence: 'loader-input-and-instance-transition' };
|
||||
const identity = classifyPs5UploadRuntimeIdentity(input);
|
||||
assert.equal(identity.status, 'stale');
|
||||
assert.equal(identity.mutationAllowed, false);
|
||||
});
|
||||
|
||||
test('A5 missing running-byte evidence is unproven even when labels claim 5.4.19', () => {
|
||||
const input = productionIdentity();
|
||||
delete input.observed.engine.sha256;
|
||||
const identity = classifyPs5UploadRuntimeIdentity(input);
|
||||
assert.equal(identity.status, 'unproven');
|
||||
assert.equal(identity.mutationAllowed, false);
|
||||
assert.throws(() => assertMutationRuntimeIdentity(identity), error => error.code === 'PS5_FPKG_RUNTIME_IDENTITY_UNPROVEN');
|
||||
});
|
||||
|
||||
test('A5 active DPI without an expected exact hash is unproven', () => {
|
||||
const input = productionIdentity();
|
||||
input.observed.dpi = { active: true, version: '5.4.19', sha256: '6'.repeat(64), evidence: 'loader-input-and-port-transition' };
|
||||
const identity = classifyPs5UploadRuntimeIdentity(input);
|
||||
assert.equal(identity.status, 'unproven');
|
||||
assert.equal(identity.mutationAllowed, false);
|
||||
});
|
||||
|
||||
test('A5 explicit diagnostic lane must bind derivative bytes and exact base revision', () => {
|
||||
const identity = classifyPs5UploadRuntimeIdentity({
|
||||
lane: 'diagnostic',
|
||||
expected: {
|
||||
version: '5.4.19', revision: REVISION,
|
||||
engineSha256: '4'.repeat(64), payloadSha256: '5'.repeat(64),
|
||||
diagnostic: { identity: 'chimera-p15-shellui-observe-v1', baseRevision: REVISION, sourceSha256: '1'.repeat(64), diffSha256: '2'.repeat(64) },
|
||||
},
|
||||
observed: {
|
||||
engine: { version: '5.4.19', revision: REVISION, sha256: '4'.repeat(64), evidence: 'running-process-bytes', diagnosticIdentity: 'chimera-p15-shellui-observe-v1' },
|
||||
payload: { version: '5.4.19', revision: REVISION, sha256: '5'.repeat(64), evidence: 'loader-input-and-instance-transition', diagnosticIdentity: 'chimera-p15-shellui-observe-v1' },
|
||||
dpi: { active: false },
|
||||
},
|
||||
});
|
||||
assert.equal(identity.status, 'exact');
|
||||
assert.equal(identity.lane, 'diagnostic');
|
||||
assert.equal(identity.mutationAllowed, true);
|
||||
});
|
||||
Reference in new issue
Block a user