Files
Investidor-V2/outputs/investmoz-audit-current-20261012/verify-case32-C148-assets-20261014.py
T
nala 5738418838
tests / ci (push) Canceled after 0s
oportunidades 9
2026-10-14 16:57:56 +02:00

26 lines
1.8 KiB
Python

from pathlib import Path
from urllib.request import urlopen
from hashlib import sha256
from datetime import datetime,timezone
import json,ssl
OUT=Path(__file__).resolve().parent;ROOT=OUT.parents[1]
QA=ROOT/'storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742'
DEST=OUT/'case32-C148-served-assets-QA-20261014.json';assert not DEST.exists()
BASE='https://portal-investidor.test:18445';context=ssl.create_default_context()
with urlopen(BASE+'/_qa/runtime',context=context,timeout=20)as r:runtime=json.load(r)
assert runtime['target']['database']=='stability_consumers_20261011_084534_test'and int(runtime['target']['port'])==55441
with urlopen(BASE+'/build/manifest.json',context=context,timeout=20)as r:server=r.read()
local=(QA/'public/build/manifest.json').read_bytes();assert sha256(server).digest()==sha256(local).digest()
manifest=json.loads(server);checked=[]
for name in ['resources/js/app.tsx','resources/js/pages/management/opportunity-draft.tsx']:
entry=manifest[name]['file'];assert entry.startswith('assets/')and '..'not in entry
with urlopen(BASE+'/build/'+entry,context=context,timeout=20)as r:body=r.read();assert r.status==200
assert sha256(body).digest()==sha256((QA/'public/build'/entry).read_bytes()).digest()
checked.append({'entry':name,'file':entry,'sha256':sha256(body).hexdigest()})
proof={'at':datetime.now(timezone.utc).isoformat(),'result':'passed','base_review':'396c691930bc',
'target':runtime['target'],'compiled_manifest_sha256':sha256(server).hexdigest(),'compiled_entries':checked,
'TLS_verified_without_bypass':True,'browser_presentation_not_inferred':True,'visual_acceptance':False,
'QA_business_data_changes':0,'active_changes':0}
DEST.write_text(json.dumps(proof,ensure_ascii=False,indent=2)+'\n',encoding='utf-8');print(json.dumps(proof,ensure_ascii=False))