15 lines
1.5 KiB
Python
15 lines
1.5 KiB
Python
from pathlib import Path
|
|
import urllib.request,urllib.error,json,hashlib,datetime
|
|
o=Path(__file__).parent;r=o.parents[1]
|
|
class NoRedirect(urllib.request.HTTPRedirectHandler):
|
|
def redirect_request(self,*a,**k):return None
|
|
op=urllib.request.build_opener(NoRedirect());events=[]
|
|
for path,expected in [('/up',200),('/documentos',200),('/legislacao',200),('/management/editorial-installation',302)]:
|
|
try:response=op.open(urllib.request.Request('https://portal-investidor.test'+path,headers={'Accept':'text/html'}),timeout=40)
|
|
except urllib.error.HTTPError as e:response=e
|
|
raw=response.read();assert response.status==expected,(path,response.status)
|
|
events.append({'path':path,'status':response.status,'bytes':len(raw)})
|
|
runtime=json.loads((r/'public/build/manifest.json').read_text('utf8'));entry=runtime['resources/js/app.tsx']['file'];data=op.open('https://portal-investidor.test/build/'+entry,timeout=40).read();assert hashlib.sha256(data).hexdigest()==hashlib.sha256((r/'public/build'/entry).read_bytes()).hexdigest()
|
|
proof={'at':datetime.datetime.now(datetime.timezone.utc).isoformat(),'candidate':'editorial-QA-f95dbc5e373f','scope':'Post-deployment runtime reads and exact JS bytes only; no accepted functional journeys replayed','events':events,'runtime_JS_hash_matches':True,'TLS_validation':'default trust, unchanged','business_writes':0,'maintenance_ended':not(r/'storage/framework/down').exists()}
|
|
(o/'CONFERENCIA-RUNTIME.json').write_text(json.dumps(proof,ensure_ascii=False,indent=2),'utf8');print(json.dumps(proof,ensure_ascii=True))
|