Fail closed on incomplete frozen-release source sets and mismatched role attestations
This commit is contained in:
1 parent
0ff688d142
commit
2676e474a1
3 files changed
+232
-3
No files matched your search
@@ -28,7 +28,12 @@ def checked_manifest(path,approvals):
|
||||
for field in ['sourceCommit','appSourceManifestSha256','exportManifestSha256','archiveSha256']:
|
||||
require(bool(re.fullmatch('[0-9a-f]{'+('40' if field=='sourceCommit' else '64')+'}',m.get(field,''))),'Invalid '+field)
|
||||
require(hash_manifest(m['files'])==m['exportManifestSha256'],'Export manifest mismatch')
|
||||
require(hash_manifest(m['appSourceFiles'])==m['appSourceManifestSha256'],'App manifest mismatch')
|
||||
app_rows=m.get('appSourceFiles',[])
|
||||
require(isinstance(app_rows,list) and app_rows and len({r['path'] for r in app_rows})==len(app_rows),'Nonempty unique app source set required')
|
||||
deploy_rows=m.get('deploymentFiles',[])
|
||||
require(isinstance(deploy_rows,list) and len(deploy_rows)==len(DEPLOY_FILES) and {r['path'] for r in deploy_rows}==set(DEPLOY_FILES),'Exact unique deployment source set required')
|
||||
require(bool(re.fullmatch('[0-9a-f]{40}',m.get('deploymentSourceCommit',m['sourceCommit']))),'Invalid deployment revision')
|
||||
require(hash_manifest(app_rows)==m['appSourceManifestSha256'],'App manifest mismatch')
|
||||
for field in ['appSourceFiles','deploymentFiles']:
|
||||
for row in m[field]:
|
||||
f=rooted(row['path']);require(f.is_file() and sha(f.read_bytes())==row['sha256'],'Working source changed: '+row['path'])
|
||||
@@ -40,7 +45,10 @@ def checked_manifest(path,approvals):
|
||||
found=set();agents=set()
|
||||
for ref in m.get('roleApprovals',[]):
|
||||
f=rooted(ref['path']);require(sha(f.read_bytes())==ref['sha256'],'Changed role approval');a=json.loads(f.read_text());role=a.get('role')
|
||||
require(role in ROLES and role not in found,'Missing/duplicate/unknown role');found.add(role);agents.add(a.get('agent'))
|
||||
require(role in ROLES and role not in found,'Missing/duplicate/unknown role');found.add(role)
|
||||
agent=a.get('agent');require(isinstance(agent,str) and bool(agent.strip()),'Actual nonempty agent required');agents.add(agent)
|
||||
role_sources=[a[k] for k in ['sourceManifestSha256','appSourceManifestSha256'] if k in a]
|
||||
require(role_sources and all(v==m['appSourceManifestSha256'] for v in role_sources),'Role app source manifest mismatch')
|
||||
require(a.get('decision')=='ALLOW_LIMITED_PUBLICATION' and a.get('fullHistoricalRestorationAccepted') is False,'Role veto or wrong scope: '+str(role))
|
||||
require(a.get('candidateSourceCommit')==m['sourceCommit'] and a.get('exportManifestSha256')==m['exportManifestSha256'],'Role reviewed another artifact')
|
||||
report=rooted(a['reportPath']);require(sha(report.read_bytes())==a['reportSha256'],'Changed role report')
|
||||
|
||||
Reference in new issue
Block a user