test(handoff): bind PDF diagnostics and constrain entry proposal
This commit is contained in:
@@ -83,6 +83,21 @@ test('omitting a source file from both manifests cannot claim a complete freeze'
|
||||
test('artifact paths cannot escape the imported package', () => shadow(base => {
|
||||
json(base, 'TEST_EVIDENCE', index => { index.artifacts[0].path = '../../outside'; });
|
||||
}));
|
||||
|
||||
test('PDF diagnostic code cannot be omitted from both frozen source manifests', () => shadow(base => {
|
||||
json(base, 'TEST_EVIDENCE', index => {
|
||||
for (const id of [index.sourceManifestArtifactId, index.sourceAfterArtifactId]) {
|
||||
const artifact = index.artifacts.find(item => item.id === id);
|
||||
const file = path.join(base, artifact.path);
|
||||
const data = JSON.parse(zlib.gunzipSync(fs.readFileSync(file)).toString('utf8'));
|
||||
const name = Object.keys(data).find(item => item.startsWith('docs/p10-entry-final/') && item.endsWith('.py'));
|
||||
assert.ok(name, 'PDF diagnostic source must be bound before qualification');
|
||||
delete data[name];
|
||||
const bytes = zlib.gzipSync(JSON.stringify(data));
|
||||
fs.writeFileSync(file, bytes); artifact.sha256 = hash(bytes);
|
||||
}
|
||||
});
|
||||
}));
|
||||
test('an imported schema cannot weaken the trusted schema', () => shadow(base => {
|
||||
fs.writeFileSync(path.join(base, 'HANDOFF_SCHEMA.json'), '{}');
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user