Подтвердить чистое воспроизведение, сохранность секретов и итоговый аудит
Skeleton contracts / contracts (pull_request) Blocked by required conditions

This commit is contained in:
2026-12-04 07:19:50 +03:00
parent 06459d3eed
commit 23fc876c00
6 changed files with 368 additions and 13 deletions
+15 -6
View File
@@ -6,6 +6,7 @@ import re
import subprocess
import sys
import tarfile
import zlib
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'student-tests'))
@@ -64,20 +65,28 @@ def main():
for image in (env['APP_IMAGE'],env['S3_IMAGE']):
print('Scanning exported image layers:',image,flush=True)
proc=subprocess.Popen(['docker','image','save',image],stdout=subprocess.PIPE)
count=0
count=0;compressed=0
with tarfile.open(fileobj=proc.stdout,mode='r|*') as bundle:
for entry in bundle:
if not entry.isfile():continue
count+=1
source=bundle.extractfile(entry);tail=b''
prefix=source.read(2)
decoder=zlib.decompressobj(31) if prefix==b'\x1f\x8b' else None
if decoder:compressed+=1
while True:
block=source.read(1024*1024)
block=prefix+source.read(1024*1024)
prefix=b''
if not block:break
data=tail+block
assert not any(value in data for value in values),'Credential in exported image'
tail=data[-16384:]
while block:
expanded=decoder.decompress(block,4*1024*1024) if decoder else block
data=tail+expanded
assert not any(value in data for value in values),'Credential in exported image'
tail=data[-16384:]
block=decoder.unconsumed_tail if decoder else b''
if decoder:assert decoder.eof,'Truncated compressed image layer'
assert proc.wait()==0
image_results.append({'image':image,'archive_members_scanned':count,'actual_credentials':'absent'})
image_results.append({'image':image,'archive_members_scanned':count,'gzip_members_expanded':compressed,'actual_credentials':'absent'})
commits=command('git','log',baseline+'..HEAD','--format=%h %an <%ae> | %cn <%ce>').splitlines()
assert all('Sergey Lyakhonov <lyserg119@gmail.com> | Sergey Lyakhonov <lyserg119@gmail.com>' in line for line in commits)
summary={'commit':command('git','rev-parse','HEAD'),'branch':command('git','branch','--show-current'),