test: accept full Linux script through MCP and simulated WebUI
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -0,0 +1,472 @@
|
||||
#!/usr/bin/env python3
|
||||
"""One exact benign Cloud Linux script: MCP plan/submit and read-only evidence.
|
||||
|
||||
No approval endpoint, browser, rights/policy mutation, direct job SQL write,
|
||||
cancel, retry, interpreter execution or local agent. Parent executes after review.
|
||||
"""
|
||||
import argparse
|
||||
import base64
|
||||
import datetime as dt
|
||||
import hashlib
|
||||
import inspect
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import time
|
||||
import uuid
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
INSTALL_SHA='667b56f7e5f085db249f27a7094919c7c0e6055dabc9f0600cb261c34760cd26'
|
||||
if hashlib.sha256((ROOT/'deploy/script_console_install.py').read_bytes()).hexdigest()!=INSTALL_SHA:
|
||||
raise RuntimeError('Reviewed bootstrap transport source changed')
|
||||
import script_console_install as old
|
||||
support=old.support
|
||||
TEMPLATE=ROOT/'devstate/output/playwright-private/console-full-v1/mcp-plan-input.template.json'
|
||||
TEMPLATE_SHA='66f684ab9c5c31be6583fe04f090ba9d7b8724d6e6c920dd9c67c484a339245e'
|
||||
ORIGINAL=ROOT/'devstate/script-console-install/2e27c312-58cc-444d-92a6-863a11ac6ffd/intent.json'
|
||||
ORIGINAL_SHA='8aec7bf7df13bc4968f47ca1554c813406409530613ce95241e74a81204cd02e'
|
||||
PATTERN_SHA='71ec226ef98acdd7a59cd1cc8648cce910ef143efad08b8e937afde7f26b6d72'
|
||||
SCRIPT_SHA='c878ba5b5c37fa3f1b9485c6994d6c57f6f37d01d99d4239c64d264d4ed95336'
|
||||
CREATOR='automation:11111111-1111-4111-8111-111111111111'
|
||||
APPROVER='simulated-testprincipal-a'
|
||||
STDOUT=b'0\nRMM_FULL_CONSOLE_LINUX_V1\n'
|
||||
STDERR=b'RMM_FULL_CONSOLE_STDERR_V1\n'
|
||||
STATE=ROOT/'devstate/script-console-job-acceptance'
|
||||
|
||||
|
||||
def require(value,code):
|
||||
if not value:raise RuntimeError(code)
|
||||
|
||||
|
||||
def encode(value):return json.dumps(value,ensure_ascii=False,separators=(',',':')).encode()
|
||||
|
||||
|
||||
def timestamp_ns(value):
|
||||
"""Strict RFC3339 calendar/offset -> integer epoch nanoseconds, no rounding."""
|
||||
import datetime as dt
|
||||
import re
|
||||
require(isinstance(value,str),'RFC3339 timestamp string')
|
||||
match=re.fullmatch(r'([0-9]{4})-([0-9]{2})-([0-9]{2})[Tt]([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]{1,9}))?([Zz]|[+-][0-9]{2}:[0-9]{2})',value)
|
||||
require(match is not None,'exact RFC3339 with at most nine fractional digits')
|
||||
year,month,day,hour,minute,second=(int(match[i]) for i in range(1,7))
|
||||
require(hour<24 and minute<60 and second<60,'valid bounded RFC3339 clock; leap-second spelling unsupported')
|
||||
try:days=(dt.date(year,month,day)-dt.date(1970,1,1)).days
|
||||
except ValueError:raise RuntimeError('valid RFC3339 calendar date') from None
|
||||
offset=match[8];offset_seconds=0
|
||||
if offset not in ('Z','z'):
|
||||
offset_hours=int(offset[1:3]);offset_minutes=int(offset[4:6])
|
||||
require(offset_hours<24 and offset_minutes<60,'valid RFC3339 UTC offset')
|
||||
offset_seconds=(offset_hours*60+offset_minutes)*60*(1 if offset[0]=='+' else -1)
|
||||
seconds=((days*24+hour)*60+minute)*60+second-offset_seconds
|
||||
return seconds*1_000_000_000+int((match[7] or '').ljust(9,'0'))
|
||||
|
||||
|
||||
def guards():
|
||||
require(support.sha(ROOT/'deploy/script_console_install.py')==INSTALL_SHA
|
||||
and support.sha(ROOT/'deploy/script_console_bootstrap.py')==old.PREFLIGHT_SHA
|
||||
and support.sha(ROOT/'deploy/cloud_mvp_acceptance.py')==PATTERN_SHA
|
||||
and support.sha(TEMPLATE)==TEMPLATE_SHA and support.sha(ORIGINAL)==ORIGINAL_SHA,'exact reviewed template/transport/target')
|
||||
old.pre.native.verify_support();manifest=support.load(old.pre.native.PACK/'manifest.json')
|
||||
require(support.sha(old.pre.native.PACK/'manifest.json')==old.pre.native.MANIFEST_SHA
|
||||
and len(manifest['source_files'])==158 and all(support.sha(ROOT/n)==h for n,h in manifest['source_files'].items()),'frozen158 inputs unchanged')
|
||||
template=support.load(TEMPLATE);script=template['parameters']['variants'][0]['script_utf8'].encode()
|
||||
require(len(script)==130 and hashlib.sha256(script).hexdigest()==SCRIPT_SHA,'exact benign130 script bytes')
|
||||
return template,support.load(ORIGINAL)
|
||||
|
||||
|
||||
def stored_json_slice(raw,path):
|
||||
"""Slice a nested value directly from stored UTF-8 JSON, never reencode it."""
|
||||
text=raw.decode('utf-8');decoder=json.JSONDecoder(object_pairs_hook=support.object_pairs);start=0
|
||||
for component in path:
|
||||
while text[start].isspace():start+=1
|
||||
opening=text[start];cursor=start+1;found=None
|
||||
while True:
|
||||
while text[cursor].isspace() or text[cursor]==',':cursor+=1
|
||||
if text[cursor] in '}]':break
|
||||
if opening=='{':
|
||||
key,cursor=decoder.raw_decode(text,cursor)
|
||||
while text[cursor].isspace():cursor+=1
|
||||
require(text[cursor]==':','stored object separator');cursor+=1
|
||||
while text[cursor].isspace():cursor+=1
|
||||
else:key=0 if found is None else found
|
||||
begin=cursor;_,cursor=decoder.raw_decode(text,cursor)
|
||||
if key==component:start=begin;break
|
||||
if opening=='[':found=key+1
|
||||
else:raise RuntimeError('Stored JSON path')
|
||||
require(key==component,'stored value path present')
|
||||
_,end=decoder.raw_decode(text,start);return text[start:end].encode()
|
||||
|
||||
|
||||
def checked_plan(record,intent):
|
||||
raw=base64.b64decode(record['payload_b64'],validate=True);require(len(raw)<=65536,'bounded original plan')
|
||||
plan=json.loads(raw,object_pairs_hook=support.object_pairs);require(hashlib.sha256(raw).hexdigest()==record['plan_hash'],'hash original stored plan bytes')
|
||||
require(plan['plan_id']==record['plan_id'] and str(uuid.UUID(plan['plan_id']))==plan['plan_id']
|
||||
and plan['schema_version']==1 and plan['tenant_id']==intent['target']['tenant_id'] and plan['principal']==CREATOR
|
||||
and plan['reason']==intent['input']['reason'] and plan['max_parallel']==plan['halt_after_failures']==1
|
||||
and len(plan['jobs'])==1 and plan.get('recipe_references',[])==plan.get('artifact_references',[])==[], 'one exact creator/target/rollout plan')
|
||||
entry=plan['jobs'][0];job=entry['payload'];job_raw=stored_json_slice(raw,['jobs',0,'payload'])
|
||||
expected=dict(schema_version=1,**intent['target'],job_id=job['job_id'],attempt_id=job['attempt_id'],
|
||||
action=dict(action='run_script',interpreter='posix_sh',script_utf8=intent['input']['parameters']['variants'][0]['script_utf8'],arguments=[],expected_stdout=STDOUT.decode(),privileged_script_profile='full_maintenance_v1'),
|
||||
execution_identity='root',not_before=job['not_before'],start_before=job['start_before'],max_runtime_seconds=30,max_output_bytes=4096)
|
||||
require(job==expected and all(str(uuid.UUID(job[k]))==job[k] for k in ('job_id','attempt_id'))
|
||||
and timestamp_ns(job['not_before'])==timestamp_ns(intent['input']['schedule']['not_before'])
|
||||
and timestamp_ns(job['start_before'])==timestamp_ns(intent['input']['schedule']['start_before'])
|
||||
and hashlib.sha256(job_raw).hexdigest()==entry['job_payload_hash'] and entry['script_sha256']==SCRIPT_SHA,'exact stored job bytes/IDs/identity/profile/script/limits')
|
||||
view=dict(plan_id=plan['plan_id'],plan_hash=record['plan_hash'],payload=plan,plan_payload=plan,plan_payload_bytes=list(raw),
|
||||
jobs=[dict(job_id=job['job_id'],attempt_id=job['attempt_id'],asset_id=job['asset_id'],agent_id=job['agent_id'],job_payload_hash=entry['job_payload_hash'],script_sha256=SCRIPT_SHA,payload=job)],
|
||||
resolved_targets=[dict(asset_id=job['asset_id'],agent_id=job['agent_id'])],excluded_targets=[],authorization_status='required',approval_state=None,expires_at=job['start_before'])
|
||||
return dict(record=record,view=view,job=job,job_bytes_b64=base64.b64encode(job_raw).decode(),job_payload_hash=entry['job_payload_hash'])
|
||||
|
||||
|
||||
def server(request):
|
||||
import base64
|
||||
import datetime as dt
|
||||
import hashlib
|
||||
import http.client as http_client
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import socket
|
||||
import ssl
|
||||
import stat
|
||||
import subprocess
|
||||
import time
|
||||
import uuid
|
||||
p=request['intent'];case_id=str(uuid.UUID(p['id']));require(case_id==p['id'] and request['action'] in ('plan','submit','read','mcp-result','isolation'),'fixed MCP/evidence case')
|
||||
target=p['target'];tenant=str(uuid.UUID(target['tenant_id']));agent=str(uuid.UUID(target['agent_id']));asset=str(uuid.UUID(target['asset_id']))
|
||||
require(tenant=='11111111-1111-4111-8111-111111111111' and target['agent_id']=='e9d85af1-067f-4cbe-a547-3a63b70a8d2e' and asset=='30aad079-86b3-41f2-a1e9-34275e7c08fc','only actual Cloud Linux target')
|
||||
creator='automation:'+tenant;approver='simulated-testprincipal-a';root=Path('/opt/rust-discovery')
|
||||
def quote(text):return "'"+text.replace("'","''")+"'"
|
||||
def sql(query):
|
||||
cmd=['docker','compose','--env-file',str(root/'devstate/.env'),'-f',str(root/'deploy/server.compose.yaml'),'exec','-T','postgres','psql','-X','-qAt','-v','ON_ERROR_STOP=1','-U','postgres','-d','rmm']
|
||||
done=subprocess.run(cmd,input=('BEGIN READ ONLY; '+query+'; COMMIT;').encode(),capture_output=True,check=True,timeout=25)
|
||||
require(len(done.stdout)<=4*1024*1024,'bounded fixed read-only SQL evidence');return json.loads(done.stdout)
|
||||
def current_rights():
|
||||
rows=sql("SELECT coalesce(json_agg(row_to_json(m)), '[]') FROM (SELECT principal,kind,permissions,revoked_at FROM memberships WHERE tenant_id="+quote(tenant)+" AND principal IN ("+quote(creator)+","+quote(approver)+") ORDER BY principal)m")
|
||||
roles={r['principal']:r for r in rows};require(set(roles)=={creator,approver} and all(r['revoked_at'] is None for r in rows),'existing active actors')
|
||||
require(roles[creator]['kind']=='automation' and roles[approver]['kind']=='test_human'
|
||||
and set(roles[creator]['permissions'])=={'inventory:read','logs:read','operations:plan','operations:submit','operations:read','jobs:cancel','scripts:execute','root:execute'}
|
||||
and 'plans:approve' not in roles[creator]['permissions']
|
||||
and {'plans:approve','scripts:execute','root:execute'}<=set(roles[approver]['permissions']),'current exact actor kinds and required rights before MCP mutation')
|
||||
return rows
|
||||
def policy_guard():
|
||||
path=root/'devstate/root-policy/policy.json';m=path.lstat();raw=path.read_bytes()
|
||||
require(not path.is_symlink() and m.st_uid==10001 and stat.S_IMODE(m.st_mode)==0o600 and hashlib.sha256(raw).hexdigest()==p['policy_sha256'],'explicit reviewed protected Root policy')
|
||||
policy=json.loads(raw);require(policy['schema_version']==2 and policy['profile']=='development' and len(policy['scopes'])==1,'single reviewed development Fullscope')
|
||||
scope=policy['scopes'][0]
|
||||
require(all(scope[k]==v for k,v in target.items()) and set(scope['principals'])=={creator,approver}
|
||||
and scope['helper_binary_sha256']=='79442727c3ba31cda02a8bc0e67481f14db9f39fc07520a880a90b64f10f1eaf'
|
||||
and scope['helper_policy_sha256']=='8101afd12b303c23bad57339729569262d4c1d66c741da9d6d4a72ebf3495ece'
|
||||
and scope['allow_root_scripts'] is True and scope['allowed_script_profiles']==['full_maintenance_v1']
|
||||
and scope['allowed_services']==[] and scope['allow_reboot'] is False and 'apt' not in scope,'exact narrow Fullscope/code/policy/actors')
|
||||
expiry=timestamp_ns(policy['expires_at']);deadline=timestamp_ns(p['input']['schedule']['start_before'])
|
||||
require(expiry>=deadline>time.time_ns(),'explicit current start deadline within policy expiry')
|
||||
return dict(sha256=p['policy_sha256'],expires_at=policy['expires_at'])
|
||||
def http(body,headers,principal):
|
||||
class HTTPS(http_client.HTTPSConnection):
|
||||
def connect(self):self.sock=self._context.wrap_socket(socket.create_connection(('127.0.0.1',18443),timeout=15),server_hostname='localhost')
|
||||
require(principal in ('a','b'),'fixed existing server-only credential')
|
||||
token_path=root/('devstate/operator-'+principal+'.token');m=token_path.lstat();require(not token_path.is_symlink() and stat.S_ISREG(m.st_mode) and m.st_uid in (0,10001) and not m.st_mode&0o077 and m.st_size<=8192,'existing private server-only operator credential')
|
||||
client=HTTPS('localhost',18443,timeout=15,context=ssl.create_default_context(cafile=str(root/'devstate/api-pki/ca.pem')))
|
||||
try:
|
||||
client.request('POST','/mcp',body=json.dumps(body),headers={'Content-Type':'application/json','Authorization':'Bearer '+token_path.read_text().strip(),**headers})
|
||||
response=client.getresponse();session=response.getheader('Mcp-Session-Id');status=response.status;data=None
|
||||
if status!=202:
|
||||
if 'text/event-stream' in response.getheader('Content-Type',''):
|
||||
parts=[];total=0
|
||||
for _ in range(256):
|
||||
line=response.readline(1024*1024+1);total+=len(line);require(total<=1024*1024,'bounded MCP SSE')
|
||||
if not line:break
|
||||
if line.startswith(b'data:'):parts.append(line[5:].lstrip(b' ').rstrip(b'\r\n'))
|
||||
if not line.strip() and parts:
|
||||
value=json.loads(b'\n'.join(parts));parts=[]
|
||||
if 'result' in value or 'error' in value:data=value;break
|
||||
else:
|
||||
raw=response.read(1024*1024+1);require(len(raw)<=1024*1024,'bounded MCP JSON');data=json.loads(raw) if raw else None
|
||||
return status,session,data
|
||||
finally:client.close()
|
||||
def mcp(name,args,principal='a',expect_denied=False):
|
||||
require((principal=='a' and not expect_denied and name in ('operations.plan','operations.submit','jobs.get'))
|
||||
or (principal=='b' and expect_denied and name in ('jobs.get','inventory.get_device')),'only fixed mutation or affected readonly MCP methods; no approvals/cancel')
|
||||
headers={'Accept':'application/json, text/event-stream','MCP-Protocol-Version':'2025-11-25'}
|
||||
status,session,data=http(dict(jsonrpc='2.0',id=1,method='initialize',params=dict(protocolVersion='2025-11-25',capabilities={},clientInfo=dict(name='script-console-cloud-only',version='1'))),headers,principal)
|
||||
require(status==200 and session and data['jsonrpc']=='2.0' and data['id']==1
|
||||
and data['result']['protocolVersion']=='2025-11-25','existing verified MCP initialize')
|
||||
headers['Mcp-Session-Id']=session
|
||||
require(http(dict(jsonrpc='2.0',method='notifications/initialized'),headers,principal)[0]==202,'MCP initialized notification')
|
||||
status,_,data=http(dict(jsonrpc='2.0',id=2,method='tools/call',params=dict(name=name,arguments=args)),headers,principal)
|
||||
if expect_denied:
|
||||
require(status==200 and data and data.get('id')==2 and data.get('jsonrpc')=='2.0'
|
||||
and data.get('result',{}).get('isError') is True,'actual authenticated MCP tool denial required')
|
||||
denial=data['result']['structuredContent']
|
||||
require(set(denial)=={'code','retryable','message','correlation_id','details'} and denial['code'] in ('FORBIDDEN','NOT_FOUND')
|
||||
and denial['retryable'] is False and denial['details']=={},'no successful other-tenant response or leaked details')
|
||||
return dict(tool=name,http_status=status,valid_authenticated_initialize=True,is_error=True,code=denial['code'],details={})
|
||||
require(status==200 and data and data['jsonrpc']=='2.0' and data['id']==2
|
||||
and 'result' in data and not data['result'].get('isError'),'MCP call incomplete; retain case and read only')
|
||||
return data['result']['structuredContent']
|
||||
def safe(path,directory=False):
|
||||
m=path.lstat();require(not path.is_symlink() and m.st_uid==0 and stat.S_IMODE(m.st_mode)==(0o700 if directory else 0o600)
|
||||
and (stat.S_ISDIR(m.st_mode) if directory else stat.S_ISREG(m.st_mode) and m.st_nlink==1),'private bootstrap case')
|
||||
def once(path,value):
|
||||
raw=json.dumps(value,sort_keys=True,separators=(',',':')).encode();fd=os.open(path,os.O_CREAT|os.O_EXCL|os.O_WRONLY|os.O_NOFOLLOW,0o600)
|
||||
with os.fdopen(fd,'wb') as out:out.write(raw);out.flush();os.fsync(out.fileno())
|
||||
fd=os.open(path.parent,os.O_RDONLY|os.O_DIRECTORY|os.O_NOFOLLOW)
|
||||
try:os.fsync(fd)
|
||||
finally:os.close(fd)
|
||||
parent=root/'devstate/script-console-job-acceptance';case=parent/case_id
|
||||
if request['action'] in ('plan','submit'):
|
||||
rights=current_rights();policy=policy_guard()
|
||||
os.umask(0o077)
|
||||
if request['action']=='plan':
|
||||
if not parent.exists():parent.mkdir(mode=0o700)
|
||||
safe(parent,True);case.mkdir(mode=0o700);once(case/'intent.json',p)
|
||||
safe(parent,True);safe(case,True);safe(case/'intent.json')
|
||||
require(json.loads((case/'intent.json').read_bytes())==p,'original immutable remote intent')
|
||||
if request['action']=='plan':
|
||||
once(case/'plan-entered.json',dict(plan_once=True,rights=rights,policy=policy))
|
||||
result=mcp('operations.plan',dict(tenant_id=tenant,input=p['input']));once(case/'plan-result.json',result);return dict(plan=result,rights=rights,policy=policy)
|
||||
stored=request['plan'];plan_id=str(uuid.UUID(stored['plan_id']))
|
||||
require(plan_id==stored['plan_id'],'canonical stored plan ID')
|
||||
actual=sql("SELECT json_build_object('payload_b64',replace(encode(payload,'base64'),chr(10),''),'principal',principal,'reason',convert_from(payload,'UTF8')::jsonb->>'reason') FROM operation_plans WHERE tenant_id="+quote(tenant)+" AND plan_id="+quote(plan_id))
|
||||
require(actual['principal']==creator and actual['reason']==p['input']['reason']
|
||||
and hashlib.sha256(base64.b64decode(actual['payload_b64'],validate=True)).hexdigest()==stored['plan_hash'],'actual original plan before submit')
|
||||
once(case/'submit-entered.json',dict(submit_once=True,plan_id=plan_id,plan_hash=stored['plan_hash'],idempotency_key=p['idempotency_key'],rights=rights,policy=policy))
|
||||
result=mcp('operations.submit',dict(tenant_id=tenant,plan_id=plan_id,idempotency_key=p['idempotency_key']));once(case/'submit-result.json',result);return dict(pending=result,rights=rights,policy=policy)
|
||||
if request['action'] in ('mcp-result','isolation'):
|
||||
stored=request['plan'];plan_id=str(uuid.UUID(stored['plan_id']))
|
||||
actual=sql("SELECT json_build_object('payload_b64',replace(encode(payload,'base64'),chr(10),''),'principal',principal) FROM operation_plans WHERE tenant_id="+quote(tenant)+" AND plan_id="+quote(plan_id))
|
||||
raw=base64.b64decode(actual['payload_b64'],validate=True)
|
||||
require(actual['principal']==creator and hashlib.sha256(raw).hexdigest()==stored['plan_hash'],'same actual stored A-plan for readonly HTTP proof')
|
||||
plan=json.loads(raw);require(plan['reason']==p['input']['reason'] and len(plan['jobs'])==1,'same one fixed acceptance plan')
|
||||
job=plan['jobs'][0]['payload'];job_id=str(uuid.UUID(job['job_id']))
|
||||
require(job['tenant_id']==tenant and job['agent_id']==agent and job['asset_id']==asset,'same existing A-job/asset for readonly HTTP proof')
|
||||
if request['action']=='mcp-result':return dict(result=mcp('jobs.get',dict(tenant_id=tenant,job_id=job_id)),read_only=True)
|
||||
return dict(read_only=True,credential='existing server-only operator-b',tests=[
|
||||
mcp('jobs.get',dict(tenant_id=tenant,job_id=job_id),'b',True),
|
||||
mcp('inventory.get_device',dict(tenant_id=tenant,asset_id=asset),'b',True)])
|
||||
# All recovery/status queries are read-only. In particular do not use the
|
||||
# operation getter, which may expire a pending request in application code.
|
||||
reason=quote(p['input']['reason']);key=quote(p['idempotency_key']);scope="tenant_id="+quote(tenant)
|
||||
plans=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT plan_id,plan_hash,replace(encode(payload,'base64'),chr(10),'') AS payload_b64 FROM operation_plans WHERE "+scope+" AND principal="+quote(creator)+" AND convert_from(payload,'UTF8')::jsonb->>'reason'="+reason+" ORDER BY created_at LIMIT 2)q")
|
||||
require(len(plans)<=1,'ambiguous stored plan; no retry')
|
||||
markers={}
|
||||
if case.exists():
|
||||
safe(parent,True);safe(case,True);safe(case/'intent.json');require(json.loads((case/'intent.json').read_bytes())==p,'original case readback')
|
||||
for name in ('plan-entered','submit-entered'):markers[name]=os.path.lexists(case/(name+'.json'))
|
||||
result=dict(plans=plans,markers=markers,read_only=True,approvals_performed=False)
|
||||
if not plans:return result
|
||||
plan_id=str(uuid.UUID(plans[0]['plan_id']));plan=json.loads(base64.b64decode(plans[0]['payload_b64']));job=plan['jobs'][0]['payload'];job_id=str(uuid.UUID(job['job_id']));attempt=str(uuid.UUID(job['attempt_id']))
|
||||
require(job['agent_id']==agent and job['asset_id']==asset and job['tenant_id']==tenant,'fixed target in stored plan')
|
||||
selected=scope+' AND job_id='+quote(job_id)+' AND attempt_id='+quote(attempt)
|
||||
result['requests']=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT r.operation_id,r.plan_id,r.principal,r.approval_state,r.idempotency_key,r.request_hash FROM approval_requests r JOIN operation_submissions s USING(tenant_id,operation_id) WHERE r.tenant_id="+quote(tenant)+" AND r.plan_id="+quote(plan_id)+" AND s.principal="+quote(creator)+" AND s.idempotency_key="+key+")q")
|
||||
result['counts']=sql("SELECT json_build_object('jobs',(SELECT count(*) FROM jobs WHERE "+selected+"),'outbox',(SELECT count(*) FROM outbox WHERE "+selected+"),'permits',(SELECT count(*) FROM execution_permits WHERE "+selected+"),'authorizations',(SELECT count(*) FROM authorizations WHERE "+scope+" AND plan_id="+quote(plan_id)+"))")
|
||||
result['jobs']=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT job_id,attempt_id,operation_id,agent_id,asset_id,payload_hash,replace(encode(payload,'base64'),chr(10),'') AS payload_b64,state,result FROM jobs WHERE "+selected+")q")
|
||||
result['permits']=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT grant_id,replace(encode(payload,'base64'),chr(10),'') AS payload_b64,replace(encode(signature,'base64'),chr(10),'') AS signature_b64 FROM execution_permits WHERE "+selected+")q")
|
||||
result['authorizations']=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT authorization_id,operation_id,plan_id,plan_hash,principal,approval_origin,testsimulation FROM authorizations WHERE "+scope+" AND plan_id="+quote(plan_id)+")q")
|
||||
result['audit']=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT event_id,principal,event_type,data,created_at FROM audit_events WHERE "+scope+" AND event_type='plan_authorization' AND data->>'plan_id'="+quote(plan_id)+" ORDER BY created_at)q")
|
||||
return result
|
||||
|
||||
|
||||
def native_evidence(p):
|
||||
import base64
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sqlite3
|
||||
import subprocess
|
||||
import uuid
|
||||
job=p['job'];require(os.geteuid()==0 and str(uuid.UUID(job['job_id']))==job['job_id'] and str(uuid.UUID(job['attempt_id']))==job['attempt_id'],'fixed native evidence binding')
|
||||
require(Path('/proc/sys/kernel/random/boot_id').read_text().strip()==p['boot_id'],'same native boot')
|
||||
processes={}
|
||||
for name,key,uid in (('rmm-full-maintenance-helper.service','helper',0),('rmm-agent-remote.service','agent',993)):
|
||||
pid=int(subprocess.run(['systemctl','show',name,'-p','MainPID','--value'],capture_output=True,check=True,timeout=10).stdout)
|
||||
proc=Path('/proc',str(pid));birth=(proc/'stat').read_text().rsplit(')',1)[1].split()[19];status=(proc/'status').read_text().splitlines()
|
||||
require(next(x.split()[1:] for x in status if x.startswith('Uid:'))==[str(uid)]*4
|
||||
and next(x.split()[1:] for x in status if x.startswith('Gid:'))==['984']*4
|
||||
and hashlib.sha256((proc/'exe').read_bytes()).hexdigest()==p['artifacts'][key]['sha256']
|
||||
and (proc/'stat').read_text().rsplit(')',1)[1].split()[19]==birth,'actual qualified process image/accounts/birth')
|
||||
processes[name]=dict(pid=pid,start_ticks=birth,sha256=p['artifacts'][key]['sha256'])
|
||||
path=Path('/var/lib/rmm-helper/consumption.sqlite');m=path.lstat()
|
||||
require(not path.is_symlink() and [m.st_dev,m.st_ino]==p['database_identity'],'original Root database inode')
|
||||
import time
|
||||
original_ids=sorted(p['original_rows']);require(len(original_ids)==18,'exact eighteen original Root IDs')
|
||||
started=time.monotonic_ns();db=sqlite3.connect(path.as_uri()+'?mode=ro',uri=True,timeout=0.25)
|
||||
try:
|
||||
db.set_progress_handler(lambda:int(time.monotonic_ns()-started>1_000_000_000),1000)
|
||||
db.execute('PRAGMA query_only=ON');db.execute('BEGIN')
|
||||
require(db.execute('PRAGMA journal_mode').fetchone()[0]=='delete','qualified readonly DELETE journal')
|
||||
total,unresolved=db.execute('SELECT count(*),coalesce(sum(result IS NULL),0) FROM consumed').fetchone()
|
||||
require(total in (18,19),'at most one new Root consumption')
|
||||
placeholders=','.join('?' for _ in original_ids)
|
||||
rows=db.execute('SELECT c.grant_id,c.agent,c.generation,c.job,c.attempt,c.result,e.start,e.outcome FROM consumed c LEFT JOIN execution_evidence e USING(grant_id) '
|
||||
+'WHERE c.grant_id IN ('+placeholders+') OR (c.job=? AND c.attempt=?) ORDER BY c.grant_id LIMIT 20',
|
||||
[*original_ids,job['job_id'],job['attempt_id']]).fetchall()
|
||||
finally:
|
||||
# Materialize only the known eighteen plus this one attempt; close the
|
||||
# shared read transaction before hashing/decoding any retained BLOBs.
|
||||
try:db.rollback()
|
||||
finally:db.close()
|
||||
elapsed=time.monotonic_ns()-started;m=path.lstat()
|
||||
require(elapsed<=1_000_000_000,'short native read transaction within accepted one-second budget')
|
||||
require(not path.is_symlink() and [m.st_dev,m.st_ino]==p['database_identity'],'same Root inode after short read')
|
||||
def digest(row):return hashlib.sha256(json.dumps([dict(sha256=hashlib.sha256(v).hexdigest(),size=len(v)) if isinstance(v,bytes) else v for v in row],separators=(',',':')).encode()).hexdigest()
|
||||
original={row[0]:digest(row) for row in rows if row[0] in p['original_rows']}
|
||||
require(original==p['original_rows'] and len(rows)==total,'all original18 bytes retained, only this possible new consumption')
|
||||
found=[row for row in rows if row[3]==job['job_id'] and row[4]==job['attempt_id']]
|
||||
require(len(found)<=1 and total==18+len(found),'no unrelated new consumption')
|
||||
records=[]
|
||||
for row in found:
|
||||
require(row[1]==job['agent_id'] and row[2]==job['enrollment_generation'],'native consumption target/generation')
|
||||
records.append(dict(grant_id=row[0],result_b64=base64.b64encode(row[5]).decode() if row[5] is not None else None,
|
||||
start_b64=base64.b64encode(row[6]).decode() if row[6] is not None else None,outcome_b64=base64.b64encode(row[7]).decode() if row[7] is not None else None))
|
||||
return dict(read_only=True,original_root18_unchanged=True,consumed=total,unresolved=unresolved,records=records,processes=processes,
|
||||
read_transaction_ns=elapsed,read_transaction_budget_ns=1_000_000_000,sqlite_busy_timeout_ms=250,sqlite_integrity_scan_performed=False)
|
||||
|
||||
|
||||
|
||||
def rpc(intent,action,folder,**extra):
|
||||
guards();require(intent['runner_sha256']==support.sha(__file__),'same original runner before every call/read')
|
||||
require(support.load(folder/'intent-hash.json')==dict(intent_sha256=support.sha(folder/'intent.json')),'original complete local intent bytes before every target call')
|
||||
code=inspect.getsource(require)+'\n'+inspect.getsource(timestamp_ns)+'\n'+inspect.getsource(server)
|
||||
code+='\ntry:\n print(__import__("json").dumps(server('+repr(dict(intent=intent,action=action,**extra))+')))\nexcept Exception as e:\n print(__import__("json").dumps(dict(bootstrap_error=True,error_class=type(e).__name__)))\n'
|
||||
return support.transport(old.server_prefix(),'python3 -',code.encode(),folder,timeout=230)
|
||||
|
||||
|
||||
def retain_plan(folder,record,intent):
|
||||
plan=checked_plan(record,intent);path=folder/'stored-plan.json'
|
||||
if path.exists():require(support.load(path)==plan,'original plan bytes/IDs/hash never replaced')
|
||||
else:support.save(path,plan)
|
||||
return plan
|
||||
|
||||
|
||||
def read_case(intent,folder):
|
||||
evidence=rpc(intent,'read',folder);support.save(folder/('server-read-'+str(uuid.uuid4())+'.json'),evidence)
|
||||
if not evidence['plans']:return dict(state='plan_effect_unknown' if (folder/'plan-entered.json').exists() else 'not_planned',evidence=evidence)
|
||||
plan=retain_plan(folder,evidence['plans'][0],intent);_,original=guards()
|
||||
require(intent['runner_sha256']==support.sha(__file__)
|
||||
and support.load(folder/'intent-hash.json')==dict(intent_sha256=support.sha(folder/'intent.json')),'same original source/intent before native read')
|
||||
identity=original['preflight']['database_inodes']['/var/lib/rmm-helper/consumption.sqlite']
|
||||
native=old.rpc(support.access_settings(old.pre.ACCESS_ROOT,'linux'),native_evidence,dict(job=plan['job'],boot_id=original['preflight']['boot_id'],artifacts=original['artifacts'],database_identity=identity,original_rows=original['preflight']['root_rows']),folder)
|
||||
support.save(folder/('native-read-'+str(uuid.uuid4())+'.json'),native)
|
||||
return dict(plan=plan,evidence=evidence,native=native)
|
||||
|
||||
|
||||
def pending_checkpoint(intent,folder,value):
|
||||
evidence=value['evidence'];require(len(evidence['requests'])==1,'one immutable submission lookup')
|
||||
pending=evidence['requests'][0];require(pending['approval_state']=='pending_approval' and pending['principal']==CREATOR
|
||||
and pending['idempotency_key']==intent['idempotency_key'] and evidence['counts']==dict(jobs=0,outbox=0,permits=0,authorizations=0)
|
||||
and evidence['jobs']==evidence['permits']==evidence['authorizations']==evidence['audit']==[]
|
||||
and value['native']['records']==[] and value['native']['consumed']==18 and value['native']['unresolved']==0,'pending has zero executable artifacts and no native consumption')
|
||||
plan=value['plan'];require(pending['plan_id']==plan['record']['plan_id'],'same pending plan')
|
||||
checkpoint=dict(profile='dev/test',case='script-console-linux-full-v1',**intent['target'],expected_principal=APPROVER,
|
||||
plan=plan['view'],job=plan['view']['jobs'][0],request=intent['input'],operation_id=pending['operation_id'],
|
||||
plan_hash=plan['record']['plan_hash'],plan_payload_bytes=plan['view']['plan_payload_bytes'],job_payload=plan['job'],job_payload_hash=plan['job_payload_hash'],
|
||||
preapproval=evidence['counts'],operation=dict(operation_id=pending['operation_id'],plan_id=pending['plan_id'],plan_hash=plan['record']['plan_hash'],
|
||||
approval_state='pending_approval',planned_job_count=1,job_count=0,execution_state=None,jobs=[]),
|
||||
operation_view_origin='read_only_scoped_SQL',stage='pending_approval',script_sha256=SCRIPT_SHA,no_retry=True,approval_performed=False)
|
||||
path=folder/'pending-checkpoint.json'
|
||||
if path.exists():require(support.load(path)==checkpoint,'original pending checkpoint remains immutable')
|
||||
else:support.save(path,checkpoint)
|
||||
return checkpoint
|
||||
|
||||
|
||||
def verify_result(intent,value):
|
||||
plan=value['plan'];evidence=value['evidence'];native=value['native']
|
||||
require(evidence['counts']==dict(jobs=1,outbox=1,permits=1,authorizations=1)
|
||||
and len(evidence['requests'])==len(evidence['jobs'])==len(evidence['permits'])==len(evidence['authorizations'])==len(evidence['audit'])==1,'one job/outbox/grant/authorization only')
|
||||
request=evidence['requests'][0];job=evidence['jobs'][0];permit=evidence['permits'][0];auth=evidence['authorizations'][0];audit=evidence['audit'][0]
|
||||
require(request['approval_state']=='approved' and request['principal']==CREATOR and request['idempotency_key']==intent['idempotency_key']
|
||||
and auth['principal']==APPROVER and auth['approval_origin']=='dev_test_browser_simulation' and auth['testsimulation'] is True
|
||||
and auth['plan_hash']==plan['record']['plan_hash'] and auth['operation_id']==request['operation_id']==job['operation_id']
|
||||
and auth['plan_id']==request['plan_id']==plan['record']['plan_id']
|
||||
and audit['principal']==APPROVER and audit['data']['approval_origin']=='dev_test_browser_simulation' and audit['data']['testsimulation'] is True
|
||||
and audit['data']['decision']=='approve' and audit['data']['profile']=='development'
|
||||
and audit['data']['plan_id']==plan['record']['plan_id'] and audit['data']['plan_hash']==plan['record']['plan_hash'] and audit['data']['operation_id']==request['operation_id'],'actual simulated WebUI audit binding, never production human approval')
|
||||
raw_job=base64.b64decode(plan['job_bytes_b64'],validate=True)
|
||||
require(job['state']=='succeeded' and job['job_id']==plan['job']['job_id'] and job['attempt_id']==plan['job']['attempt_id']
|
||||
and job['agent_id']==plan['job']['agent_id'] and job['asset_id']==plan['job']['asset_id']
|
||||
and job['payload_hash']==plan['job_payload_hash'] and base64.b64decode(job['payload_b64'],validate=True)==raw_job,'same successful stored job/attempt bytes')
|
||||
result=job['result'];require(result['exit_code']==0 and result['output_truncated'] is False and result['reboot_required'] is False
|
||||
and bytes(result['stdout'])==STDOUT and bytes(result['stderr'])==STDERR and result['evidence']['postconditions_passed'] is True
|
||||
and result['evidence']['execution_uid']==0 and result['evidence']['privileged_script_profile']=='full_maintenance_v1'
|
||||
and result['evidence']['script_sha256']==SCRIPT_SHA,'exact native root/profile/stdout/stderr result')
|
||||
require(native['original_root18_unchanged'] is True and native['consumed']==19 and native['unresolved']==0 and len(native['records'])==1,'one finished new Root consumption')
|
||||
record=native['records'][0];start=json.loads(base64.b64decode(record['start_b64'],validate=True));outcome=json.loads(base64.b64decode(record['outcome_b64'],validate=True));finished=json.loads(base64.b64decode(record['result_b64'],validate=True));request=start['request']
|
||||
permit_raw=base64.b64decode(permit['payload_b64'],validate=True);grant=json.loads(permit_raw)
|
||||
require(record['grant_id']==permit['grant_id']==grant['grant_id']==result['grant_id']
|
||||
and bytes(request['job_bytes'])==raw_job and bytes(request['permit_bytes'])==permit_raw
|
||||
and bytes(request['signature'])==base64.b64decode(permit['signature_b64'],validate=True)
|
||||
and request['plan_hash']==grant['plan_hash']==plan['record']['plan_hash'] and request['authorization_id']==grant['authorization_id']==auth['authorization_id']
|
||||
and grant['job_payload_hash']==plan['job_payload_hash'] and all(grant[k]==plan['job'][k] for k in (*intent['target'].keys(),'job_id','attempt_id','execution_identity','max_runtime_seconds'))
|
||||
and grant['domain']=='rmm.execution-permit' and grant['schema_version']==1
|
||||
and grant['action']=='run_script' and grant['key_id']==intent['signing_key_id']
|
||||
and timestamp_ns(plan['job']['not_before'])<=timestamp_ns(grant['not_before'])
|
||||
<=timestamp_ns(start['reserved_at'])<timestamp_ns(grant['start_before'])
|
||||
<=timestamp_ns(plan['job']['start_before'])
|
||||
and start['previous_boot_id']==intent['boot_id'] and outcome==finished
|
||||
and outcome['state']==job['state']
|
||||
and all(outcome[k]==result[k] for k in ('stdout','stderr','exit_code','output_truncated','reboot_required','evidence','error_code')),'retained exact original native request/grant/signature/outcome matches server evidence')
|
||||
|
||||
|
||||
def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('mode',choices=('prepare-local','plan','submit','pending','read','verify-result'));parser.add_argument('--case');parser.add_argument('--not-before');parser.add_argument('--start-before');parser.add_argument('--policy-sha');args=parser.parse_args()
|
||||
os.umask(0o077);STATE.mkdir(mode=0o700,parents=True,exist_ok=True);template,original=guards()
|
||||
if args.mode=='prepare-local':
|
||||
require(args.case is None and args.not_before and args.start_before and re.fullmatch('[a-f0-9]{64}',args.policy_sha or ''),'explicit future schedule and reviewed policy SHA')
|
||||
not_before=timestamp_ns(args.not_before);start_before=timestamp_ns(args.start_before)
|
||||
require(all(re.search(r'(?:Z|[+]00:00)$',v) for v in (args.not_before,args.start_before))
|
||||
and time.time_ns()<not_before<start_before and start_before-not_before<=600_000_000_000,'fixed future UTC window, at most ten minutes')
|
||||
case=str(uuid.uuid4());folder=STATE/case;folder.mkdir(mode=0o700);target=original['general_pin']['identity'];target={k:target[k] for k in ('tenant_id','asset_id','agent_id','enrollment_generation','assignment_version')}
|
||||
template['targets']['asset_ids']=[target['asset_id']];template['schedule'].update(not_before=args.not_before,start_before=args.start_before);template['reason']+='; acceptance_case='+case
|
||||
support.save(folder/'intent.json',dict(id=case,runner_sha256=support.sha(__file__),template_sha256=TEMPLATE_SHA,script_sha256=SCRIPT_SHA,policy_sha256=args.policy_sha,
|
||||
idempotency_key='script-console-full-'+case,target=target,input=template,boot_id=original['preflight']['boot_id'],signing_key_id=original['general_pin']['identity']['signing_key_id']))
|
||||
support.save(folder/'intent-hash.json',dict(intent_sha256=support.sha(folder/'intent.json')))
|
||||
else:
|
||||
require(args.case and args.not_before is None and args.start_before is None and args.policy_sha is None,'original case only; no changed plan/retry')
|
||||
case=str(uuid.UUID(args.case));require(case==args.case,'canonical case');folder=STATE/case;intent=support.load(folder/'intent.json')
|
||||
require(intent['runner_sha256']==support.sha(__file__) and intent['template_sha256']==TEMPLATE_SHA and intent['script_sha256']==SCRIPT_SHA,'same original source/input/script')
|
||||
require(support.load(folder/'intent-hash.json')==dict(intent_sha256=support.sha(folder/'intent.json')),'original complete intent bytes')
|
||||
fixed_target={k:original['general_pin']['identity'][k] for k in ('tenant_id','asset_id','agent_id','enrollment_generation','assignment_version')}
|
||||
template['targets']['asset_ids']=[fixed_target['asset_id']]
|
||||
template['schedule'].update(not_before=intent['input']['schedule']['not_before'],start_before=intent['input']['schedule']['start_before'])
|
||||
template['reason']+='; acceptance_case='+case
|
||||
expected=dict(id=case,runner_sha256=support.sha(__file__),template_sha256=TEMPLATE_SHA,script_sha256=SCRIPT_SHA,policy_sha256=intent['policy_sha256'],
|
||||
idempotency_key='script-console-full-'+case,target=fixed_target,input=template,boot_id=original['preflight']['boot_id'],signing_key_id=original['general_pin']['identity']['signing_key_id'])
|
||||
require(intent==expected and re.fullmatch('[a-f0-9]{64}',intent['policy_sha256']),'exact frozen template/target/profile/limits/actors for every operation')
|
||||
if args.mode=='plan':
|
||||
support.save(folder/'plan-entered.json',dict(plan_once=True,no_retry=True));reply=rpc(intent,'plan',folder);support.save(folder/'plan-reply.json',reply)
|
||||
view=reply['plan'];raw=bytes(view['plan_payload_bytes']);require(view['plan_id']==view['payload']['plan_id'] and view['payload']==view['plan_payload']==json.loads(raw),'actual plan aliases match stored bytes')
|
||||
plan=retain_plan(folder,dict(plan_id=view['plan_id'],plan_hash=view['plan_hash'],payload_b64=base64.b64encode(raw).decode()),intent)
|
||||
require(view['jobs']==plan['view']['jobs'],'actual job mirrors match original stored bytes')
|
||||
elif args.mode=='submit':
|
||||
plan=checked_plan(support.load(folder/'stored-plan.json')['record'],intent)
|
||||
support.save(folder/'submit-entered.json',dict(submit_once=True,no_retry=True,idempotency_key=intent['idempotency_key']))
|
||||
reply=rpc(intent,'submit',folder,plan=plan['record']);support.save(folder/'submit-reply.json',reply)
|
||||
pending=reply['pending'];require(pending['plan_id']==plan['record']['plan_id'] and pending['plan_hash']==plan['record']['plan_hash']
|
||||
and pending['approval_state']=='pending_approval' and pending['job_count']==0 and pending['execution_state'] is None
|
||||
and str(uuid.UUID(pending['operation_id']))==pending['operation_id'],'actual submit reply is the same pending request with zero executable jobs')
|
||||
checkpoint=pending_checkpoint(intent,folder,read_case(intent,folder))
|
||||
require(checkpoint['operation_id']==pending['operation_id'],'same submitted and stored pending operation')
|
||||
else:
|
||||
value=read_case(intent,folder);support.save(folder/('readback-'+str(uuid.uuid4())+'.json'),value)
|
||||
if args.mode=='pending':pending_checkpoint(intent,folder,value)
|
||||
if args.mode=='verify-result':
|
||||
verify_result(intent,value)
|
||||
actual=rpc(intent,'mcp-result',folder,plan=value['plan']['record']);support.save(folder/('mcp-result-'+str(uuid.uuid4())+'.json'),actual)
|
||||
job=value['evidence']['jobs'][0]
|
||||
require(actual['read_only'] is True and actual['result']['job_id']==job['job_id'] and actual['result']['attempt_id']==job['attempt_id']
|
||||
and actual['result']['state']==job['state'] and actual['result']['result']==job['result'],'complete same-tenant MCP result/raw bytes match SQL/native')
|
||||
denied=rpc(intent,'isolation',folder,plan=value['plan']['record']);support.save(folder/('tenant-b-denial-'+str(uuid.uuid4())+'.json'),denied)
|
||||
require(denied['read_only'] is True and len(denied['tests'])==2
|
||||
and [x['tool'] for x in denied['tests']]==['jobs.get','inventory.get_device']
|
||||
and all(x['valid_authenticated_initialize'] is True and x['http_status']==200 and x['is_error'] is True
|
||||
and x['code'] in ('FORBIDDEN','NOT_FOUND') and x['details']=={} for x in denied['tests']),'actual affected other-tenant MCP HTTP denials')
|
||||
support.save(folder/'passed.json',dict(verified=True,case_id=case,script_sha256=SCRIPT_SHA,plan_hash=value['plan']['record']['plan_hash'],
|
||||
result=value,mcp_result=actual,tenant_b_http_denial=denied,approval_performed=False,independent_ed25519_reverification=False))
|
||||
print(json.dumps(dict(case_id=case,mode=args.mode,intent=str(folder/'intent.json'),intent_sha256=support.sha(folder/'intent.json'),target_called=args.mode!='prepare-local',approval_performed=False,retries=False)))
|
||||
|
||||
|
||||
if __name__=='__main__':main()
|
||||
@@ -0,0 +1,477 @@
|
||||
#!/usr/bin/env python3
|
||||
"""One exact benign Cloud Linux script: MCP plan/submit and read-only evidence.
|
||||
|
||||
No approval endpoint, browser, rights/policy mutation, direct job SQL write,
|
||||
cancel, retry, interpreter execution or local agent. Parent executes after review.
|
||||
"""
|
||||
import argparse
|
||||
import base64
|
||||
import datetime as dt
|
||||
import hashlib
|
||||
import inspect
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import time
|
||||
import uuid
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
INSTALL_SHA='667b56f7e5f085db249f27a7094919c7c0e6055dabc9f0600cb261c34760cd26'
|
||||
if hashlib.sha256((ROOT/'deploy/script_console_install.py').read_bytes()).hexdigest()!=INSTALL_SHA:
|
||||
raise RuntimeError('Reviewed bootstrap transport source changed')
|
||||
import script_console_install as old
|
||||
support=old.support
|
||||
TEMPLATE=ROOT/'devstate/output/playwright-private/console-full-v1/mcp-plan-input.template.json'
|
||||
TEMPLATE_SHA='66f684ab9c5c31be6583fe04f090ba9d7b8724d6e6c920dd9c67c484a339245e'
|
||||
ORIGINAL=ROOT/'devstate/script-console-install/2e27c312-58cc-444d-92a6-863a11ac6ffd/intent.json'
|
||||
ORIGINAL_SHA='8aec7bf7df13bc4968f47ca1554c813406409530613ce95241e74a81204cd02e'
|
||||
PATTERN_SHA='71ec226ef98acdd7a59cd1cc8648cce910ef143efad08b8e937afde7f26b6d72'
|
||||
SCRIPT_SHA='c878ba5b5c37fa3f1b9485c6994d6c57f6f37d01d99d4239c64d264d4ed95336'
|
||||
CREATOR='automation:11111111-1111-4111-8111-111111111111'
|
||||
APPROVER='simulated-testprincipal-a'
|
||||
STDOUT=b'0\nRMM_FULL_CONSOLE_LINUX_V1\n'
|
||||
STDERR=b'RMM_FULL_CONSOLE_STDERR_V1\n'
|
||||
STATE=ROOT/'devstate/script-console-job-acceptance'
|
||||
|
||||
|
||||
def require(value,code):
|
||||
if not value:raise RuntimeError(code)
|
||||
|
||||
|
||||
def encode(value):return json.dumps(value,ensure_ascii=False,separators=(',',':')).encode()
|
||||
|
||||
|
||||
def timestamp_ns(value):
|
||||
"""Strict RFC3339 calendar/offset -> integer epoch nanoseconds, no rounding."""
|
||||
import datetime as dt
|
||||
import re
|
||||
require(isinstance(value,str),'RFC3339 timestamp string')
|
||||
match=re.fullmatch(r'([0-9]{4})-([0-9]{2})-([0-9]{2})[Tt]([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]{1,9}))?([Zz]|[+-][0-9]{2}:[0-9]{2})',value)
|
||||
require(match is not None,'exact RFC3339 with at most nine fractional digits')
|
||||
year,month,day,hour,minute,second=(int(match[i]) for i in range(1,7))
|
||||
require(hour<24 and minute<60 and second<60,'valid bounded RFC3339 clock; leap-second spelling unsupported')
|
||||
try:days=(dt.date(year,month,day)-dt.date(1970,1,1)).days
|
||||
except ValueError:raise RuntimeError('valid RFC3339 calendar date') from None
|
||||
offset=match[8];offset_seconds=0
|
||||
if offset not in ('Z','z'):
|
||||
offset_hours=int(offset[1:3]);offset_minutes=int(offset[4:6])
|
||||
require(offset_hours<24 and offset_minutes<60,'valid RFC3339 UTC offset')
|
||||
offset_seconds=(offset_hours*60+offset_minutes)*60*(1 if offset[0]=='+' else -1)
|
||||
seconds=((days*24+hour)*60+minute)*60+second-offset_seconds
|
||||
return seconds*1_000_000_000+int((match[7] or '').ljust(9,'0'))
|
||||
|
||||
|
||||
def guards():
|
||||
require(support.sha(ROOT/'deploy/script_console_install.py')==INSTALL_SHA
|
||||
and support.sha(ROOT/'deploy/script_console_bootstrap.py')==old.PREFLIGHT_SHA
|
||||
and support.sha(ROOT/'deploy/cloud_mvp_acceptance.py')==PATTERN_SHA
|
||||
and support.sha(TEMPLATE)==TEMPLATE_SHA and support.sha(ORIGINAL)==ORIGINAL_SHA,'exact reviewed template/transport/target')
|
||||
old.pre.native.verify_support();manifest=support.load(old.pre.native.PACK/'manifest.json')
|
||||
require(support.sha(old.pre.native.PACK/'manifest.json')==old.pre.native.MANIFEST_SHA
|
||||
and len(manifest['source_files'])==158 and all(support.sha(ROOT/n)==h for n,h in manifest['source_files'].items()),'frozen158 inputs unchanged')
|
||||
template=support.load(TEMPLATE);script=template['parameters']['variants'][0]['script_utf8'].encode()
|
||||
require(len(script)==130 and hashlib.sha256(script).hexdigest()==SCRIPT_SHA,'exact benign130 script bytes')
|
||||
return template,support.load(ORIGINAL)
|
||||
|
||||
|
||||
def stored_json_slice(raw,path):
|
||||
"""Slice a nested value directly from stored UTF-8 JSON, never reencode it."""
|
||||
text=raw.decode('utf-8');decoder=json.JSONDecoder(object_pairs_hook=support.object_pairs);start=0
|
||||
for component in path:
|
||||
while text[start].isspace():start+=1
|
||||
opening=text[start];cursor=start+1;found=None
|
||||
while True:
|
||||
while text[cursor].isspace() or text[cursor]==',':cursor+=1
|
||||
if text[cursor] in '}]':break
|
||||
if opening=='{':
|
||||
key,cursor=decoder.raw_decode(text,cursor)
|
||||
while text[cursor].isspace():cursor+=1
|
||||
require(text[cursor]==':','stored object separator');cursor+=1
|
||||
while text[cursor].isspace():cursor+=1
|
||||
else:key=0 if found is None else found
|
||||
begin=cursor;_,cursor=decoder.raw_decode(text,cursor)
|
||||
if key==component:start=begin;break
|
||||
if opening=='[':found=key+1
|
||||
else:raise RuntimeError('Stored JSON path')
|
||||
require(key==component,'stored value path present')
|
||||
_,end=decoder.raw_decode(text,start);return text[start:end].encode()
|
||||
|
||||
|
||||
def checked_plan(record,intent):
|
||||
raw=base64.b64decode(record['payload_b64'],validate=True);require(len(raw)<=65536,'bounded original plan')
|
||||
plan=json.loads(raw,object_pairs_hook=support.object_pairs);require(hashlib.sha256(raw).hexdigest()==record['plan_hash'],'hash original stored plan bytes')
|
||||
require(plan['plan_id']==record['plan_id'] and str(uuid.UUID(plan['plan_id']))==plan['plan_id']
|
||||
and plan['schema_version']==1 and plan['tenant_id']==intent['target']['tenant_id'] and plan['principal']==CREATOR
|
||||
and plan['reason']==intent['input']['reason'] and plan['max_parallel']==plan['halt_after_failures']==1
|
||||
and len(plan['jobs'])==1 and plan.get('recipe_references',[])==plan.get('artifact_references',[])==[], 'one exact creator/target/rollout plan')
|
||||
entry=plan['jobs'][0];job=entry['payload'];job_raw=stored_json_slice(raw,['jobs',0,'payload'])
|
||||
expected=dict(schema_version=1,**intent['target'],job_id=job['job_id'],attempt_id=job['attempt_id'],
|
||||
action=dict(action='run_script',interpreter='posix_sh',script_utf8=intent['input']['parameters']['variants'][0]['script_utf8'],arguments=[],expected_stdout=STDOUT.decode(),privileged_script_profile='full_maintenance_v1'),
|
||||
execution_identity='root',not_before=job['not_before'],start_before=job['start_before'],max_runtime_seconds=30,max_output_bytes=4096)
|
||||
require(job==expected and all(str(uuid.UUID(job[k]))==job[k] for k in ('job_id','attempt_id'))
|
||||
and timestamp_ns(job['not_before'])==timestamp_ns(intent['input']['schedule']['not_before'])
|
||||
and timestamp_ns(job['start_before'])==timestamp_ns(intent['input']['schedule']['start_before'])
|
||||
and hashlib.sha256(job_raw).hexdigest()==entry['job_payload_hash'] and entry['script_sha256']==SCRIPT_SHA,'exact stored job bytes/IDs/identity/profile/script/limits')
|
||||
view=dict(plan_id=plan['plan_id'],plan_hash=record['plan_hash'],payload=plan,plan_payload=plan,plan_payload_bytes=list(raw),
|
||||
jobs=[dict(job_id=job['job_id'],attempt_id=job['attempt_id'],asset_id=job['asset_id'],agent_id=job['agent_id'],job_payload_hash=entry['job_payload_hash'],script_sha256=SCRIPT_SHA,payload=job)],
|
||||
resolved_targets=[dict(asset_id=job['asset_id'],agent_id=job['agent_id'])],excluded_targets=[],authorization_status='required',approval_state=None,expires_at=job['start_before'])
|
||||
return dict(record=record,view=view,job=job,job_bytes_b64=base64.b64encode(job_raw).decode(),job_payload_hash=entry['job_payload_hash'])
|
||||
|
||||
|
||||
def server(request):
|
||||
import base64
|
||||
import datetime as dt
|
||||
import hashlib
|
||||
import http.client as http_client
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import socket
|
||||
import ssl
|
||||
import stat
|
||||
import subprocess
|
||||
import time
|
||||
import uuid
|
||||
p=request['intent'];case_id=str(uuid.UUID(p['id']));require(case_id==p['id'] and request['action'] in ('plan','submit','read','mcp-result','isolation'),'fixed MCP/evidence case')
|
||||
target=p['target'];tenant=str(uuid.UUID(target['tenant_id']));agent=str(uuid.UUID(target['agent_id']));asset=str(uuid.UUID(target['asset_id']))
|
||||
require(tenant=='11111111-1111-4111-8111-111111111111' and target['agent_id']=='e9d85af1-067f-4cbe-a547-3a63b70a8d2e' and asset=='30aad079-86b3-41f2-a1e9-34275e7c08fc','only actual Cloud Linux target')
|
||||
creator='automation:'+tenant;approver='simulated-testprincipal-a';root=Path('/opt/rust-discovery')
|
||||
def quote(text):return "'"+text.replace("'","''")+"'"
|
||||
def sql(query):
|
||||
cmd=['docker','compose','--env-file',str(root/'devstate/.env'),'-f',str(root/'deploy/server.compose.yaml'),'exec','-T','postgres','psql','-X','-qAt','-v','ON_ERROR_STOP=1','-U','postgres','-d','rmm']
|
||||
done=subprocess.run(cmd,input=('BEGIN READ ONLY; '+query+'; COMMIT;').encode(),capture_output=True,check=True,timeout=25)
|
||||
require(len(done.stdout)<=4*1024*1024,'bounded fixed read-only SQL evidence');return json.loads(done.stdout)
|
||||
def current_rights():
|
||||
rows=sql("SELECT coalesce(json_agg(row_to_json(m)), '[]') FROM (SELECT principal,kind,permissions,revoked_at FROM memberships WHERE tenant_id="+quote(tenant)+" AND principal IN ("+quote(creator)+","+quote(approver)+") ORDER BY principal)m")
|
||||
roles={r['principal']:r for r in rows};require(set(roles)=={creator,approver} and all(r['revoked_at'] is None for r in rows),'existing active actors')
|
||||
require(roles[creator]['kind']=='automation' and roles[approver]['kind']=='test_human'
|
||||
and set(roles[creator]['permissions'])=={'inventory:read','logs:read','operations:plan','operations:submit','operations:read','jobs:cancel','scripts:execute','root:execute'}
|
||||
and 'plans:approve' not in roles[creator]['permissions']
|
||||
and {'plans:approve','scripts:execute','root:execute'}<=set(roles[approver]['permissions']),'current exact actor kinds and required rights before MCP mutation')
|
||||
return rows
|
||||
def policy_guard():
|
||||
path=root/'devstate/root-policy/policy.json';m=path.lstat();raw=path.read_bytes()
|
||||
require(not path.is_symlink() and m.st_uid==10001 and stat.S_IMODE(m.st_mode)==0o600 and hashlib.sha256(raw).hexdigest()==p['policy_sha256'],'explicit reviewed protected Root policy')
|
||||
policy=json.loads(raw);require(policy['schema_version']==2 and policy['profile']=='development' and len(policy['scopes'])==1,'single reviewed development Fullscope')
|
||||
scope=policy['scopes'][0]
|
||||
require(all(scope[k]==v for k,v in target.items()) and set(scope['principals'])=={creator,approver}
|
||||
and scope['helper_binary_sha256']=='79442727c3ba31cda02a8bc0e67481f14db9f39fc07520a880a90b64f10f1eaf'
|
||||
and scope['helper_policy_sha256']=='8101afd12b303c23bad57339729569262d4c1d66c741da9d6d4a72ebf3495ece'
|
||||
and scope['allow_root_scripts'] is True and scope['allowed_script_profiles']==['full_maintenance_v1']
|
||||
and scope['allowed_services']==[] and scope['allow_reboot'] is False and 'apt' not in scope,'exact narrow Fullscope/code/policy/actors')
|
||||
expiry=timestamp_ns(policy['expires_at']);deadline=timestamp_ns(p['input']['schedule']['start_before'])
|
||||
require(expiry>=deadline>time.time_ns(),'explicit current start deadline within policy expiry')
|
||||
return dict(sha256=p['policy_sha256'],expires_at=policy['expires_at'])
|
||||
def http(body,headers,principal):
|
||||
class HTTPS(http_client.HTTPSConnection):
|
||||
def connect(self):self.sock=self._context.wrap_socket(socket.create_connection(('127.0.0.1',18443),timeout=15),server_hostname='localhost')
|
||||
require(principal in ('a','b'),'fixed existing server-only credential')
|
||||
token_path=root/('devstate/operator-'+principal+'.token');m=token_path.lstat();require(not token_path.is_symlink() and stat.S_ISREG(m.st_mode) and m.st_uid in (0,10001) and not m.st_mode&0o077 and m.st_size<=8192,'existing private server-only operator credential')
|
||||
client=HTTPS('localhost',18443,timeout=15,context=ssl.create_default_context(cafile=str(root/'devstate/api-pki/ca.pem')))
|
||||
try:
|
||||
client.request('POST','/mcp',body=json.dumps(body),headers={'Content-Type':'application/json','Authorization':'Bearer '+token_path.read_text().strip(),**headers})
|
||||
response=client.getresponse();session=response.getheader('Mcp-Session-Id');status=response.status;data=None
|
||||
if status!=202:
|
||||
if 'text/event-stream' in response.getheader('Content-Type',''):
|
||||
parts=[];total=0
|
||||
for _ in range(256):
|
||||
line=response.readline(1024*1024+1);total+=len(line);require(total<=1024*1024,'bounded MCP SSE')
|
||||
if not line:break
|
||||
if line.startswith(b'data:'):
|
||||
chunk=line[5:].rstrip(b'\r\n')
|
||||
if chunk.startswith(b' '):chunk=chunk[1:]
|
||||
parts.append(chunk)
|
||||
if not line.strip() and parts:
|
||||
frame=b'\n'.join(parts);parts=[]
|
||||
if frame==b'':continue
|
||||
value=json.loads(frame)
|
||||
if 'result' in value or 'error' in value:data=value;break
|
||||
else:
|
||||
raw=response.read(1024*1024+1);require(len(raw)<=1024*1024,'bounded MCP JSON');data=json.loads(raw) if raw else None
|
||||
return status,session,data
|
||||
finally:client.close()
|
||||
def mcp(name,args,principal='a',expect_denied=False):
|
||||
require((principal=='a' and not expect_denied and name in ('operations.plan','operations.submit','jobs.get'))
|
||||
or (principal=='b' and expect_denied and name in ('jobs.get','inventory.get_device')),'only fixed mutation or affected readonly MCP methods; no approvals/cancel')
|
||||
headers={'Accept':'application/json, text/event-stream','MCP-Protocol-Version':'2025-11-25'}
|
||||
status,session,data=http(dict(jsonrpc='2.0',id=1,method='initialize',params=dict(protocolVersion='2025-11-25',capabilities={},clientInfo=dict(name='script-console-cloud-only',version='1'))),headers,principal)
|
||||
require(status==200 and session and data['jsonrpc']=='2.0' and data['id']==1
|
||||
and data['result']['protocolVersion']=='2025-11-25','existing verified MCP initialize')
|
||||
headers['Mcp-Session-Id']=session
|
||||
require(http(dict(jsonrpc='2.0',method='notifications/initialized'),headers,principal)[0]==202,'MCP initialized notification')
|
||||
status,_,data=http(dict(jsonrpc='2.0',id=2,method='tools/call',params=dict(name=name,arguments=args)),headers,principal)
|
||||
if expect_denied:
|
||||
require(status==200 and data and data.get('id')==2 and data.get('jsonrpc')=='2.0'
|
||||
and data.get('result',{}).get('isError') is True,'actual authenticated MCP tool denial required')
|
||||
denial=data['result']['structuredContent']
|
||||
require(set(denial)=={'code','retryable','message','correlation_id','details'} and denial['code'] in ('FORBIDDEN','NOT_FOUND')
|
||||
and denial['retryable'] is False and denial['details']=={},'no successful other-tenant response or leaked details')
|
||||
return dict(tool=name,http_status=status,valid_authenticated_initialize=True,is_error=True,code=denial['code'],details={})
|
||||
require(status==200 and data and data['jsonrpc']=='2.0' and data['id']==2
|
||||
and 'result' in data and not data['result'].get('isError'),'MCP call incomplete; retain case and read only')
|
||||
return data['result']['structuredContent']
|
||||
def safe(path,directory=False):
|
||||
m=path.lstat();require(not path.is_symlink() and m.st_uid==0 and stat.S_IMODE(m.st_mode)==(0o700 if directory else 0o600)
|
||||
and (stat.S_ISDIR(m.st_mode) if directory else stat.S_ISREG(m.st_mode) and m.st_nlink==1),'private bootstrap case')
|
||||
def once(path,value):
|
||||
raw=json.dumps(value,sort_keys=True,separators=(',',':')).encode();fd=os.open(path,os.O_CREAT|os.O_EXCL|os.O_WRONLY|os.O_NOFOLLOW,0o600)
|
||||
with os.fdopen(fd,'wb') as out:out.write(raw);out.flush();os.fsync(out.fileno())
|
||||
fd=os.open(path.parent,os.O_RDONLY|os.O_DIRECTORY|os.O_NOFOLLOW)
|
||||
try:os.fsync(fd)
|
||||
finally:os.close(fd)
|
||||
parent=root/'devstate/script-console-job-acceptance';case=parent/case_id
|
||||
if request['action'] in ('plan','submit'):
|
||||
rights=current_rights();policy=policy_guard()
|
||||
os.umask(0o077)
|
||||
if request['action']=='plan':
|
||||
if not parent.exists():parent.mkdir(mode=0o700)
|
||||
safe(parent,True);case.mkdir(mode=0o700);once(case/'intent.json',p)
|
||||
safe(parent,True);safe(case,True);safe(case/'intent.json')
|
||||
require(json.loads((case/'intent.json').read_bytes())==p,'original immutable remote intent')
|
||||
if request['action']=='plan':
|
||||
once(case/'plan-entered.json',dict(plan_once=True,rights=rights,policy=policy))
|
||||
result=mcp('operations.plan',dict(tenant_id=tenant,input=p['input']));once(case/'plan-result.json',result);return dict(plan=result,rights=rights,policy=policy)
|
||||
stored=request['plan'];plan_id=str(uuid.UUID(stored['plan_id']))
|
||||
require(plan_id==stored['plan_id'],'canonical stored plan ID')
|
||||
actual=sql("SELECT json_build_object('payload_b64',replace(encode(payload,'base64'),chr(10),''),'principal',principal,'reason',convert_from(payload,'UTF8')::jsonb->>'reason') FROM operation_plans WHERE tenant_id="+quote(tenant)+" AND plan_id="+quote(plan_id))
|
||||
require(actual['principal']==creator and actual['reason']==p['input']['reason']
|
||||
and hashlib.sha256(base64.b64decode(actual['payload_b64'],validate=True)).hexdigest()==stored['plan_hash'],'actual original plan before submit')
|
||||
once(case/'submit-entered.json',dict(submit_once=True,plan_id=plan_id,plan_hash=stored['plan_hash'],idempotency_key=p['idempotency_key'],rights=rights,policy=policy))
|
||||
result=mcp('operations.submit',dict(tenant_id=tenant,plan_id=plan_id,idempotency_key=p['idempotency_key']));once(case/'submit-result.json',result);return dict(pending=result,rights=rights,policy=policy)
|
||||
if request['action'] in ('mcp-result','isolation'):
|
||||
stored=request['plan'];plan_id=str(uuid.UUID(stored['plan_id']))
|
||||
actual=sql("SELECT json_build_object('payload_b64',replace(encode(payload,'base64'),chr(10),''),'principal',principal) FROM operation_plans WHERE tenant_id="+quote(tenant)+" AND plan_id="+quote(plan_id))
|
||||
raw=base64.b64decode(actual['payload_b64'],validate=True)
|
||||
require(actual['principal']==creator and hashlib.sha256(raw).hexdigest()==stored['plan_hash'],'same actual stored A-plan for readonly HTTP proof')
|
||||
plan=json.loads(raw);require(plan['reason']==p['input']['reason'] and len(plan['jobs'])==1,'same one fixed acceptance plan')
|
||||
job=plan['jobs'][0]['payload'];job_id=str(uuid.UUID(job['job_id']))
|
||||
require(job['tenant_id']==tenant and job['agent_id']==agent and job['asset_id']==asset,'same existing A-job/asset for readonly HTTP proof')
|
||||
if request['action']=='mcp-result':return dict(result=mcp('jobs.get',dict(tenant_id=tenant,job_id=job_id)),read_only=True)
|
||||
return dict(read_only=True,credential='existing server-only operator-b',tests=[
|
||||
mcp('jobs.get',dict(tenant_id=tenant,job_id=job_id),'b',True),
|
||||
mcp('inventory.get_device',dict(tenant_id=tenant,asset_id=asset),'b',True)])
|
||||
# All recovery/status queries are read-only. In particular do not use the
|
||||
# operation getter, which may expire a pending request in application code.
|
||||
reason=quote(p['input']['reason']);key=quote(p['idempotency_key']);scope="tenant_id="+quote(tenant)
|
||||
plans=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT plan_id,plan_hash,replace(encode(payload,'base64'),chr(10),'') AS payload_b64 FROM operation_plans WHERE "+scope+" AND principal="+quote(creator)+" AND convert_from(payload,'UTF8')::jsonb->>'reason'="+reason+" ORDER BY created_at LIMIT 2)q")
|
||||
require(len(plans)<=1,'ambiguous stored plan; no retry')
|
||||
markers={}
|
||||
if case.exists():
|
||||
safe(parent,True);safe(case,True);safe(case/'intent.json');require(json.loads((case/'intent.json').read_bytes())==p,'original case readback')
|
||||
for name in ('plan-entered','submit-entered'):markers[name]=os.path.lexists(case/(name+'.json'))
|
||||
result=dict(plans=plans,markers=markers,read_only=True,approvals_performed=False)
|
||||
if not plans:return result
|
||||
plan_id=str(uuid.UUID(plans[0]['plan_id']));plan=json.loads(base64.b64decode(plans[0]['payload_b64']));job=plan['jobs'][0]['payload'];job_id=str(uuid.UUID(job['job_id']));attempt=str(uuid.UUID(job['attempt_id']))
|
||||
require(job['agent_id']==agent and job['asset_id']==asset and job['tenant_id']==tenant,'fixed target in stored plan')
|
||||
selected=scope+' AND job_id='+quote(job_id)+' AND attempt_id='+quote(attempt)
|
||||
result['requests']=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT r.operation_id,r.plan_id,r.principal,r.approval_state,r.idempotency_key,r.request_hash FROM approval_requests r JOIN operation_submissions s USING(tenant_id,operation_id) WHERE r.tenant_id="+quote(tenant)+" AND r.plan_id="+quote(plan_id)+" AND s.principal="+quote(creator)+" AND s.idempotency_key="+key+")q")
|
||||
result['counts']=sql("SELECT json_build_object('jobs',(SELECT count(*) FROM jobs WHERE "+selected+"),'outbox',(SELECT count(*) FROM outbox WHERE "+selected+"),'permits',(SELECT count(*) FROM execution_permits WHERE "+selected+"),'authorizations',(SELECT count(*) FROM authorizations WHERE "+scope+" AND plan_id="+quote(plan_id)+"))")
|
||||
result['jobs']=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT job_id,attempt_id,operation_id,agent_id,asset_id,payload_hash,replace(encode(payload,'base64'),chr(10),'') AS payload_b64,state,result FROM jobs WHERE "+selected+")q")
|
||||
result['permits']=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT grant_id,replace(encode(payload,'base64'),chr(10),'') AS payload_b64,replace(encode(signature,'base64'),chr(10),'') AS signature_b64 FROM execution_permits WHERE "+selected+")q")
|
||||
result['authorizations']=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT authorization_id,operation_id,plan_id,plan_hash,principal,approval_origin,testsimulation FROM authorizations WHERE "+scope+" AND plan_id="+quote(plan_id)+")q")
|
||||
result['audit']=sql("SELECT coalesce(json_agg(row_to_json(q)),'[]') FROM (SELECT event_id,principal,event_type,data,created_at FROM audit_events WHERE "+scope+" AND event_type='plan_authorization' AND data->>'plan_id'="+quote(plan_id)+" ORDER BY created_at)q")
|
||||
return result
|
||||
|
||||
|
||||
def native_evidence(p):
|
||||
import base64
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sqlite3
|
||||
import subprocess
|
||||
import uuid
|
||||
job=p['job'];require(os.geteuid()==0 and str(uuid.UUID(job['job_id']))==job['job_id'] and str(uuid.UUID(job['attempt_id']))==job['attempt_id'],'fixed native evidence binding')
|
||||
require(Path('/proc/sys/kernel/random/boot_id').read_text().strip()==p['boot_id'],'same native boot')
|
||||
processes={}
|
||||
for name,key,uid in (('rmm-full-maintenance-helper.service','helper',0),('rmm-agent-remote.service','agent',993)):
|
||||
pid=int(subprocess.run(['systemctl','show',name,'-p','MainPID','--value'],capture_output=True,check=True,timeout=10).stdout)
|
||||
proc=Path('/proc',str(pid));birth=(proc/'stat').read_text().rsplit(')',1)[1].split()[19];status=(proc/'status').read_text().splitlines()
|
||||
require(next(x.split()[1:] for x in status if x.startswith('Uid:'))==[str(uid)]*4
|
||||
and next(x.split()[1:] for x in status if x.startswith('Gid:'))==['984']*4
|
||||
and hashlib.sha256((proc/'exe').read_bytes()).hexdigest()==p['artifacts'][key]['sha256']
|
||||
and (proc/'stat').read_text().rsplit(')',1)[1].split()[19]==birth,'actual qualified process image/accounts/birth')
|
||||
processes[name]=dict(pid=pid,start_ticks=birth,sha256=p['artifacts'][key]['sha256'])
|
||||
path=Path('/var/lib/rmm-helper/consumption.sqlite');m=path.lstat()
|
||||
require(not path.is_symlink() and [m.st_dev,m.st_ino]==p['database_identity'],'original Root database inode')
|
||||
import time
|
||||
original_ids=sorted(p['original_rows']);require(len(original_ids)==18,'exact eighteen original Root IDs')
|
||||
started=time.monotonic_ns();db=sqlite3.connect(path.as_uri()+'?mode=ro',uri=True,timeout=0.25)
|
||||
try:
|
||||
db.set_progress_handler(lambda:int(time.monotonic_ns()-started>1_000_000_000),1000)
|
||||
db.execute('PRAGMA query_only=ON');db.execute('BEGIN')
|
||||
require(db.execute('PRAGMA journal_mode').fetchone()[0]=='delete','qualified readonly DELETE journal')
|
||||
total,unresolved=db.execute('SELECT count(*),coalesce(sum(result IS NULL),0) FROM consumed').fetchone()
|
||||
require(total in (18,19),'at most one new Root consumption')
|
||||
placeholders=','.join('?' for _ in original_ids)
|
||||
rows=db.execute('SELECT c.grant_id,c.agent,c.generation,c.job,c.attempt,c.result,e.start,e.outcome FROM consumed c LEFT JOIN execution_evidence e USING(grant_id) '
|
||||
+'WHERE c.grant_id IN ('+placeholders+') OR (c.job=? AND c.attempt=?) ORDER BY c.grant_id LIMIT 20',
|
||||
[*original_ids,job['job_id'],job['attempt_id']]).fetchall()
|
||||
finally:
|
||||
# Materialize only the known eighteen plus this one attempt; close the
|
||||
# shared read transaction before hashing/decoding any retained BLOBs.
|
||||
try:db.rollback()
|
||||
finally:db.close()
|
||||
elapsed=time.monotonic_ns()-started;m=path.lstat()
|
||||
require(elapsed<=1_000_000_000,'short native read transaction within accepted one-second budget')
|
||||
require(not path.is_symlink() and [m.st_dev,m.st_ino]==p['database_identity'],'same Root inode after short read')
|
||||
def digest(row):return hashlib.sha256(json.dumps([dict(sha256=hashlib.sha256(v).hexdigest(),size=len(v)) if isinstance(v,bytes) else v for v in row],separators=(',',':')).encode()).hexdigest()
|
||||
original={row[0]:digest(row) for row in rows if row[0] in p['original_rows']}
|
||||
require(original==p['original_rows'] and len(rows)==total,'all original18 bytes retained, only this possible new consumption')
|
||||
found=[row for row in rows if row[3]==job['job_id'] and row[4]==job['attempt_id']]
|
||||
require(len(found)<=1 and total==18+len(found),'no unrelated new consumption')
|
||||
records=[]
|
||||
for row in found:
|
||||
require(row[1]==job['agent_id'] and row[2]==job['enrollment_generation'],'native consumption target/generation')
|
||||
records.append(dict(grant_id=row[0],result_b64=base64.b64encode(row[5]).decode() if row[5] is not None else None,
|
||||
start_b64=base64.b64encode(row[6]).decode() if row[6] is not None else None,outcome_b64=base64.b64encode(row[7]).decode() if row[7] is not None else None))
|
||||
return dict(read_only=True,original_root18_unchanged=True,consumed=total,unresolved=unresolved,records=records,processes=processes,
|
||||
read_transaction_ns=elapsed,read_transaction_budget_ns=1_000_000_000,sqlite_busy_timeout_ms=250,sqlite_integrity_scan_performed=False)
|
||||
|
||||
|
||||
|
||||
def rpc(intent,action,folder,**extra):
|
||||
guards();require(intent['runner_sha256']==support.sha(__file__),'same original runner before every call/read')
|
||||
require(support.load(folder/'intent-hash.json')==dict(intent_sha256=support.sha(folder/'intent.json')),'original complete local intent bytes before every target call')
|
||||
code=inspect.getsource(require)+'\n'+inspect.getsource(timestamp_ns)+'\n'+inspect.getsource(server)
|
||||
code+='\ntry:\n print(__import__("json").dumps(server('+repr(dict(intent=intent,action=action,**extra))+')))\nexcept Exception as e:\n print(__import__("json").dumps(dict(bootstrap_error=True,error_class=type(e).__name__)))\n'
|
||||
return support.transport(old.server_prefix(),'python3 -',code.encode(),folder,timeout=230)
|
||||
|
||||
|
||||
def retain_plan(folder,record,intent):
|
||||
plan=checked_plan(record,intent);path=folder/'stored-plan.json'
|
||||
if path.exists():require(support.load(path)==plan,'original plan bytes/IDs/hash never replaced')
|
||||
else:support.save(path,plan)
|
||||
return plan
|
||||
|
||||
|
||||
def read_case(intent,folder):
|
||||
evidence=rpc(intent,'read',folder);support.save(folder/('server-read-'+str(uuid.uuid4())+'.json'),evidence)
|
||||
if not evidence['plans']:return dict(state='plan_effect_unknown' if (folder/'plan-entered.json').exists() else 'not_planned',evidence=evidence)
|
||||
plan=retain_plan(folder,evidence['plans'][0],intent);_,original=guards()
|
||||
require(intent['runner_sha256']==support.sha(__file__)
|
||||
and support.load(folder/'intent-hash.json')==dict(intent_sha256=support.sha(folder/'intent.json')),'same original source/intent before native read')
|
||||
identity=original['preflight']['database_inodes']['/var/lib/rmm-helper/consumption.sqlite']
|
||||
native=old.rpc(support.access_settings(old.pre.ACCESS_ROOT,'linux'),native_evidence,dict(job=plan['job'],boot_id=original['preflight']['boot_id'],artifacts=original['artifacts'],database_identity=identity,original_rows=original['preflight']['root_rows']),folder)
|
||||
support.save(folder/('native-read-'+str(uuid.uuid4())+'.json'),native)
|
||||
return dict(plan=plan,evidence=evidence,native=native)
|
||||
|
||||
|
||||
def pending_checkpoint(intent,folder,value):
|
||||
evidence=value['evidence'];require(len(evidence['requests'])==1,'one immutable submission lookup')
|
||||
pending=evidence['requests'][0];require(pending['approval_state']=='pending_approval' and pending['principal']==CREATOR
|
||||
and pending['idempotency_key']==intent['idempotency_key'] and evidence['counts']==dict(jobs=0,outbox=0,permits=0,authorizations=0)
|
||||
and evidence['jobs']==evidence['permits']==evidence['authorizations']==evidence['audit']==[]
|
||||
and value['native']['records']==[] and value['native']['consumed']==18 and value['native']['unresolved']==0,'pending has zero executable artifacts and no native consumption')
|
||||
plan=value['plan'];require(pending['plan_id']==plan['record']['plan_id'],'same pending plan')
|
||||
checkpoint=dict(profile='dev/test',case='script-console-linux-full-v1',**intent['target'],expected_principal=APPROVER,
|
||||
plan=plan['view'],job=plan['view']['jobs'][0],request=intent['input'],operation_id=pending['operation_id'],
|
||||
plan_hash=plan['record']['plan_hash'],plan_payload_bytes=plan['view']['plan_payload_bytes'],job_payload=plan['job'],job_payload_hash=plan['job_payload_hash'],
|
||||
preapproval=evidence['counts'],operation=dict(operation_id=pending['operation_id'],plan_id=pending['plan_id'],plan_hash=plan['record']['plan_hash'],
|
||||
approval_state='pending_approval',planned_job_count=1,job_count=0,execution_state=None,jobs=[]),
|
||||
operation_view_origin='read_only_scoped_SQL',stage='pending_approval',script_sha256=SCRIPT_SHA,no_retry=True,approval_performed=False)
|
||||
path=folder/'pending-checkpoint.json'
|
||||
if path.exists():require(support.load(path)==checkpoint,'original pending checkpoint remains immutable')
|
||||
else:support.save(path,checkpoint)
|
||||
return checkpoint
|
||||
|
||||
|
||||
def verify_result(intent,value):
|
||||
plan=value['plan'];evidence=value['evidence'];native=value['native']
|
||||
require(evidence['counts']==dict(jobs=1,outbox=1,permits=1,authorizations=1)
|
||||
and len(evidence['requests'])==len(evidence['jobs'])==len(evidence['permits'])==len(evidence['authorizations'])==len(evidence['audit'])==1,'one job/outbox/grant/authorization only')
|
||||
request=evidence['requests'][0];job=evidence['jobs'][0];permit=evidence['permits'][0];auth=evidence['authorizations'][0];audit=evidence['audit'][0]
|
||||
require(request['approval_state']=='approved' and request['principal']==CREATOR and request['idempotency_key']==intent['idempotency_key']
|
||||
and auth['principal']==APPROVER and auth['approval_origin']=='dev_test_browser_simulation' and auth['testsimulation'] is True
|
||||
and auth['plan_hash']==plan['record']['plan_hash'] and auth['operation_id']==request['operation_id']==job['operation_id']
|
||||
and auth['plan_id']==request['plan_id']==plan['record']['plan_id']
|
||||
and audit['principal']==APPROVER and audit['data']['approval_origin']=='dev_test_browser_simulation' and audit['data']['testsimulation'] is True
|
||||
and audit['data']['decision']=='approve' and audit['data']['profile']=='development'
|
||||
and audit['data']['plan_id']==plan['record']['plan_id'] and audit['data']['plan_hash']==plan['record']['plan_hash'] and audit['data']['operation_id']==request['operation_id'],'actual simulated WebUI audit binding, never production human approval')
|
||||
raw_job=base64.b64decode(plan['job_bytes_b64'],validate=True)
|
||||
require(job['state']=='succeeded' and job['job_id']==plan['job']['job_id'] and job['attempt_id']==plan['job']['attempt_id']
|
||||
and job['agent_id']==plan['job']['agent_id'] and job['asset_id']==plan['job']['asset_id']
|
||||
and job['payload_hash']==plan['job_payload_hash'] and base64.b64decode(job['payload_b64'],validate=True)==raw_job,'same successful stored job/attempt bytes')
|
||||
result=job['result'];require(result['exit_code']==0 and result['output_truncated'] is False and result['reboot_required'] is False
|
||||
and bytes(result['stdout'])==STDOUT and bytes(result['stderr'])==STDERR and result['evidence']['postconditions_passed'] is True
|
||||
and result['evidence']['execution_uid']==0 and result['evidence']['privileged_script_profile']=='full_maintenance_v1'
|
||||
and result['evidence']['script_sha256']==SCRIPT_SHA,'exact native root/profile/stdout/stderr result')
|
||||
require(native['original_root18_unchanged'] is True and native['consumed']==19 and native['unresolved']==0 and len(native['records'])==1,'one finished new Root consumption')
|
||||
record=native['records'][0];start=json.loads(base64.b64decode(record['start_b64'],validate=True));outcome=json.loads(base64.b64decode(record['outcome_b64'],validate=True));finished=json.loads(base64.b64decode(record['result_b64'],validate=True));request=start['request']
|
||||
permit_raw=base64.b64decode(permit['payload_b64'],validate=True);grant=json.loads(permit_raw)
|
||||
require(record['grant_id']==permit['grant_id']==grant['grant_id']==result['grant_id']
|
||||
and bytes(request['job_bytes'])==raw_job and bytes(request['permit_bytes'])==permit_raw
|
||||
and bytes(request['signature'])==base64.b64decode(permit['signature_b64'],validate=True)
|
||||
and request['plan_hash']==grant['plan_hash']==plan['record']['plan_hash'] and request['authorization_id']==grant['authorization_id']==auth['authorization_id']
|
||||
and grant['job_payload_hash']==plan['job_payload_hash'] and all(grant[k]==plan['job'][k] for k in (*intent['target'].keys(),'job_id','attempt_id','execution_identity','max_runtime_seconds'))
|
||||
and grant['domain']=='rmm.execution-permit' and grant['schema_version']==1
|
||||
and grant['action']=='run_script' and grant['key_id']==intent['signing_key_id']
|
||||
and timestamp_ns(plan['job']['not_before'])<=timestamp_ns(grant['not_before'])
|
||||
<=timestamp_ns(start['reserved_at'])<timestamp_ns(grant['start_before'])
|
||||
<=timestamp_ns(plan['job']['start_before'])
|
||||
and start['previous_boot_id']==intent['boot_id'] and outcome==finished
|
||||
and outcome['state']==job['state']
|
||||
and all(outcome[k]==result[k] for k in ('stdout','stderr','exit_code','output_truncated','reboot_required','evidence','error_code')),'retained exact original native request/grant/signature/outcome matches server evidence')
|
||||
|
||||
|
||||
def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('mode',choices=('prepare-local','plan','submit','pending','read','verify-result'));parser.add_argument('--case');parser.add_argument('--not-before');parser.add_argument('--start-before');parser.add_argument('--policy-sha');args=parser.parse_args()
|
||||
os.umask(0o077);STATE.mkdir(mode=0o700,parents=True,exist_ok=True);template,original=guards()
|
||||
if args.mode=='prepare-local':
|
||||
require(args.case is None and args.not_before and args.start_before and re.fullmatch('[a-f0-9]{64}',args.policy_sha or ''),'explicit future schedule and reviewed policy SHA')
|
||||
not_before=timestamp_ns(args.not_before);start_before=timestamp_ns(args.start_before)
|
||||
require(all(re.search(r'(?:Z|[+]00:00)$',v) for v in (args.not_before,args.start_before))
|
||||
and time.time_ns()<not_before<start_before and start_before-not_before<=600_000_000_000,'fixed future UTC window, at most ten minutes')
|
||||
case=str(uuid.uuid4());folder=STATE/case;folder.mkdir(mode=0o700);target=original['general_pin']['identity'];target={k:target[k] for k in ('tenant_id','asset_id','agent_id','enrollment_generation','assignment_version')}
|
||||
template['targets']['asset_ids']=[target['asset_id']];template['schedule'].update(not_before=args.not_before,start_before=args.start_before);template['reason']+='; acceptance_case='+case
|
||||
support.save(folder/'intent.json',dict(id=case,runner_sha256=support.sha(__file__),template_sha256=TEMPLATE_SHA,script_sha256=SCRIPT_SHA,policy_sha256=args.policy_sha,
|
||||
idempotency_key='script-console-full-'+case,target=target,input=template,boot_id=original['preflight']['boot_id'],signing_key_id=original['general_pin']['identity']['signing_key_id']))
|
||||
support.save(folder/'intent-hash.json',dict(intent_sha256=support.sha(folder/'intent.json')))
|
||||
else:
|
||||
require(args.case and args.not_before is None and args.start_before is None and args.policy_sha is None,'original case only; no changed plan/retry')
|
||||
case=str(uuid.UUID(args.case));require(case==args.case,'canonical case');folder=STATE/case;intent=support.load(folder/'intent.json')
|
||||
require(intent['runner_sha256']==support.sha(__file__) and intent['template_sha256']==TEMPLATE_SHA and intent['script_sha256']==SCRIPT_SHA,'same original source/input/script')
|
||||
require(support.load(folder/'intent-hash.json')==dict(intent_sha256=support.sha(folder/'intent.json')),'original complete intent bytes')
|
||||
fixed_target={k:original['general_pin']['identity'][k] for k in ('tenant_id','asset_id','agent_id','enrollment_generation','assignment_version')}
|
||||
template['targets']['asset_ids']=[fixed_target['asset_id']]
|
||||
template['schedule'].update(not_before=intent['input']['schedule']['not_before'],start_before=intent['input']['schedule']['start_before'])
|
||||
template['reason']+='; acceptance_case='+case
|
||||
expected=dict(id=case,runner_sha256=support.sha(__file__),template_sha256=TEMPLATE_SHA,script_sha256=SCRIPT_SHA,policy_sha256=intent['policy_sha256'],
|
||||
idempotency_key='script-console-full-'+case,target=fixed_target,input=template,boot_id=original['preflight']['boot_id'],signing_key_id=original['general_pin']['identity']['signing_key_id'])
|
||||
require(intent==expected and re.fullmatch('[a-f0-9]{64}',intent['policy_sha256']),'exact frozen template/target/profile/limits/actors for every operation')
|
||||
if args.mode=='plan':
|
||||
support.save(folder/'plan-entered.json',dict(plan_once=True,no_retry=True));reply=rpc(intent,'plan',folder);support.save(folder/'plan-reply.json',reply)
|
||||
view=reply['plan'];raw=bytes(view['plan_payload_bytes']);require(view['plan_id']==view['payload']['plan_id'] and view['payload']==view['plan_payload']==json.loads(raw),'actual plan aliases match stored bytes')
|
||||
plan=retain_plan(folder,dict(plan_id=view['plan_id'],plan_hash=view['plan_hash'],payload_b64=base64.b64encode(raw).decode()),intent)
|
||||
require(view['jobs']==plan['view']['jobs'],'actual job mirrors match original stored bytes')
|
||||
elif args.mode=='submit':
|
||||
plan=checked_plan(support.load(folder/'stored-plan.json')['record'],intent)
|
||||
support.save(folder/'submit-entered.json',dict(submit_once=True,no_retry=True,idempotency_key=intent['idempotency_key']))
|
||||
reply=rpc(intent,'submit',folder,plan=plan['record']);support.save(folder/'submit-reply.json',reply)
|
||||
pending=reply['pending'];require(pending['plan_id']==plan['record']['plan_id'] and pending['plan_hash']==plan['record']['plan_hash']
|
||||
and pending['approval_state']=='pending_approval' and pending['job_count']==0 and pending['execution_state'] is None
|
||||
and str(uuid.UUID(pending['operation_id']))==pending['operation_id'],'actual submit reply is the same pending request with zero executable jobs')
|
||||
checkpoint=pending_checkpoint(intent,folder,read_case(intent,folder))
|
||||
require(checkpoint['operation_id']==pending['operation_id'],'same submitted and stored pending operation')
|
||||
else:
|
||||
value=read_case(intent,folder);support.save(folder/('readback-'+str(uuid.uuid4())+'.json'),value)
|
||||
if args.mode=='pending':pending_checkpoint(intent,folder,value)
|
||||
if args.mode=='verify-result':
|
||||
verify_result(intent,value)
|
||||
actual=rpc(intent,'mcp-result',folder,plan=value['plan']['record']);support.save(folder/('mcp-result-'+str(uuid.uuid4())+'.json'),actual)
|
||||
job=value['evidence']['jobs'][0]
|
||||
require(actual['read_only'] is True and actual['result']['job_id']==job['job_id'] and actual['result']['attempt_id']==job['attempt_id']
|
||||
and actual['result']['state']==job['state'] and actual['result']['result']==job['result'],'complete same-tenant MCP result/raw bytes match SQL/native')
|
||||
denied=rpc(intent,'isolation',folder,plan=value['plan']['record']);support.save(folder/('tenant-b-denial-'+str(uuid.uuid4())+'.json'),denied)
|
||||
require(denied['read_only'] is True and len(denied['tests'])==2
|
||||
and [x['tool'] for x in denied['tests']]==['jobs.get','inventory.get_device']
|
||||
and all(x['valid_authenticated_initialize'] is True and x['http_status']==200 and x['is_error'] is True
|
||||
and x['code'] in ('FORBIDDEN','NOT_FOUND') and x['details']=={} for x in denied['tests']),'actual affected other-tenant MCP HTTP denials')
|
||||
support.save(folder/'passed.json',dict(verified=True,case_id=case,script_sha256=SCRIPT_SHA,plan_hash=value['plan']['record']['plan_hash'],
|
||||
result=value,mcp_result=actual,tenant_b_http_denial=denied,approval_performed=False,independent_ed25519_reverification=False))
|
||||
print(json.dumps(dict(case_id=case,mode=args.mode,intent=str(folder/'intent.json'),intent_sha256=support.sha(folder/'intent.json'),target_called=args.mode!='prepare-local',approval_performed=False,retries=False)))
|
||||
|
||||
|
||||
if __name__=='__main__':main()
|
||||
@@ -0,0 +1,53 @@
|
||||
# MCP-Abnahmerunner V2: leeres SSE-Initialframe
|
||||
|
||||
Der erste tatsächliche Planmodus mit der bisherigen Quelle `dcccd789c2eab18…`
|
||||
im Fall `b8a4ea33-ab19-45a0-b838-c5dd6cf6d75a` hielt während MCP-Initialize mit
|
||||
`JSONDecodeError` an. Der separate strikt lesende Lookup belegte null gespeicherte
|
||||
Pläne und Anträge, `plan-entered:true`, `submit-entered:false`. Der Fall wird nicht
|
||||
für einen erneuten Plan-/Submitversuch verwendet; ursprüngliche Intents,
|
||||
Marker, Zeiten und Inputbytes bleiben unverändert.
|
||||
|
||||
Die danach tatsächlich durch Root ausgeführte Initialize-only-Diagnose belegt:
|
||||
HTTP 200, `text/event-stream`, vorhandener Sessionheader, zuerst eine leere
|
||||
Datazeile mit sieben Byte, zwei Eventmetadatenzeilen und ein Frameabschluss;
|
||||
anschließend eine gültige JSON-Datazeile mit 307 Byte. Es wurde kein Toolcall
|
||||
gesendet. Beleg `initialize-frame-shape-readonly.json`, SHA256
|
||||
`40790d612b840c6073684a5ea2ee308b0dba5c42beea29c0d43922a8f7e0c3b8`.
|
||||
Der alte Parser übergab das vollständige leere Datenframe an `json.loads(b'')`.
|
||||
Das ist ein Fehler des Bootstrap-SSE-Parsers, kein Produktjobfehler.
|
||||
|
||||
Die neue separate Quelle ist `deploy/script_console_job_acceptance_v2.py`, SHA256
|
||||
`c7f42df0a7e89274b7e255ac728ec4198a02278926348113c5b7e363e8983757`.
|
||||
Die ursprüngliche Datei bleibt unverändert als ausführbarer Reader für ihren
|
||||
Originalfall erhalten. Zusätzlich wurden Quelle und alle neun damaligen
|
||||
B8-Belege create-only unter
|
||||
`devstate/source-history/job-ops-dccc-sse-dcc82959-51cd-424e-84ab-6dd56de36689/`
|
||||
archiviert; Manifest-SHA256
|
||||
`c9a1dee9e3ca71539c94b59433297dfd3be5e1687a212ad030226eb09765280d`.
|
||||
|
||||
Die einzige geänderte Funktionsfamilie ist SSE-Framing: Erst ein vollständig
|
||||
abgeschlossenes Datenframe bilden, den Puffer zurücksetzen und ausschließlich
|
||||
die leere Bytefolge `b''` vor dem JSON-Parse überspringen. Nach `data:` wird nur
|
||||
die eine im SSE-Format optionale Trennspace entfernt; weitere Whitespacebytes
|
||||
bleiben erhalten. Dadurch werden nichtleere Whitespaceframes und anderes
|
||||
ungültiges JSON weiterhin als Fehler verweigert. Mehrzeilige gültige JSON-
|
||||
Datenframes funktionieren weiterhin. Byte-/Zeilenlimits bleiben unverändert.
|
||||
|
||||
HTTP/TLS/CA/SNI, Tokenbehandlung, MCP-Initialize-/Session-/ID-Prüfungen,
|
||||
Actor-/Rechte-/Policyguards, Ganzzahl-Nanosekunden, kurze SQLite-Reads,
|
||||
Originalplan-/Job-/Grantbindungen und Wiederholungssperren sind unverändert.
|
||||
Es gibt weiterhin keinen Approval-, Browserautomations-, Rechte-, Policy-,
|
||||
Cancel- oder Retrypfad; der [Grundvertrag](script-console-job-acceptance.md)
|
||||
bleibt bestehen. Insbesondere wird der fehlgeschlagene B8-Fall nicht umetikettiert.
|
||||
|
||||
Tatsächlich lokal geprüft: Python-Syntax; der genaue neue Parser-AST mit einem
|
||||
Frameverlauf entsprechend dem tatsächlichen Rootbeleg; anschließend gültiges
|
||||
Initialize-JSON. Nichtleeres `not-json`, `{invalid}` und ein Frame aus drei
|
||||
Whitespacebytes wurden jeweils als JSON-Fehler verweigert. Mehrzeiliges gültiges
|
||||
JSON bestand. Kein Zielaufruf und kein neuer Fall wurden dabei angelegt.
|
||||
|
||||
**Danach tatsächlich ausgeführt:** Root prüfte Quelle und Nichtwirkungsbeleg
|
||||
des alten Falls, schloss dessen temporären Scope und erzeugte unter einem
|
||||
frischen Scope den separaten V2-Fall `ced97b4d…`. MCP-Plan/Submit, WebUI-Grenze
|
||||
und genau ein Rootlauf sind [nativ bestanden](script-console-linux-full-results.md).
|
||||
Kein alter Planaufruf wurde wiederholt oder dessen Deadline geändert.
|
||||
@@ -0,0 +1,181 @@
|
||||
# Vorbereiteter MCP-Abnahmerunner für das Linux-Rootskript
|
||||
|
||||
Stand: Grundvertrag des engen Jobrunners. Der erste tatsächliche Aufruf im
|
||||
Planmodus hielt bei MCP-Initialize an; der strikt lesende Lookup belegt null
|
||||
persistierte Pläne/Anträge und keinen Job. Die separate Initialize-Diagnose
|
||||
und der eng korrigierte V2-Parser sind im [V2-Nachtrag](script-console-job-acceptance-v2.md)
|
||||
belegt. Der ursprüngliche Reader und Fall bleiben unverändert. Kein Approval
|
||||
oder Browseraufruf gehört zu diesem Runner.
|
||||
Die 158 eingefrorenen Produktinputs und alle bisherigen Opsquellen bleiben
|
||||
unverändert. Der neue Runner ist `deploy/script_console_job_acceptance.py`.
|
||||
|
||||
Er verwendet ausschließlich die tatsächliche Cloud-Linux-Geräteidentität aus
|
||||
dem unveränderten Installationsfall `2e27c312-58cc-444d-92a6-863a11ac6ffd`.
|
||||
Notebook und Windows-VM sind keine Ziele. Die private Inputvorlage ist
|
||||
`devstate/output/playwright-private/console-full-v1/mcp-plan-input.template.json`,
|
||||
SHA256 `66f684ab9c5c31be6583fe04f090ba9d7b8724d6e6c920dd9c67c484a339245e`.
|
||||
Die Skriptbytes bleiben exakt 130 Byte, SHA256
|
||||
`c878ba5b5c37fa3f1b9485c6994d6c57f6f37d01d99d4239c64d264d4ed95336`:
|
||||
|
||||
```sh
|
||||
set -eu
|
||||
/usr/bin/id -u
|
||||
/usr/bin/sleep 12
|
||||
printf '%s\n' 'RMM_FULL_CONSOLE_LINUX_V1'
|
||||
printf '%s\n' 'RMM_FULL_CONSOLE_STDERR_V1' >&2
|
||||
```
|
||||
|
||||
Diese Darstellung ist keine Aufforderung zur lokalen Ausführung. Der genaue
|
||||
ursprüngliche UTF-8-Inhalt einschließlich abschließender Zeile wird gehasht.
|
||||
Fest gebunden sind `posix_sh`, Root, `full_maintenance_v1`, keine Argumente,
|
||||
30 Sekunden Laufzeit, 4096 Byte Gesamtausgabe, ein Job mit genau einem Versuch,
|
||||
`max_parallel:1` und `halt_after_failures:1`. Erwartete rohe Ausgabe ist
|
||||
`0\nRMM_FULL_CONSOLE_LINUX_V1\n` auf stdout und
|
||||
`RMM_FULL_CONSOLE_STDERR_V1\n` auf stderr. Der harmlose Warteabschnitt von zwölf Sekunden
|
||||
ermöglicht die Beobachtung des tatsächlichen laufenden Jobs in der WebUI.
|
||||
|
||||
## Voraussetzungen und Grenze
|
||||
|
||||
Der verantwortliche Rootagent prüft vor der tatsächlichen Benutzung getrennt
|
||||
den erhaltenden Runtime-/Serverwechsel, frischen signierten Sync und Fullhelper-
|
||||
Nachweis, Browservertrauen und die konkrete neue Rootpolicy. Vorlagen oder
|
||||
dieser Runner ersetzen diese Abnahmen nicht. Eine ausdrücklich angegebene
|
||||
Policy-SHA256 und ein fester künftiger UTC-Startzeitraum werden im unveränderlichen
|
||||
Intent gebunden; die Deadline muss innerhalb der überprüften Policygültigkeit
|
||||
liegen. Der Runner öffnet oder schließt selbst keine Policy.
|
||||
|
||||
Vor jedem `operations.plan` und `operations.submit` liest der Runner die
|
||||
tatsächlichen aktuellen Mitgliedschaften ausschließlich auf dem Server.
|
||||
Der bestehende Creator ist
|
||||
`automation:11111111-1111-4111-8111-111111111111`, Art `automation`;
|
||||
der Testfreigeber ist `simulated-testprincipal-a`, Art `test_human`.
|
||||
Beide dürfen nicht widerrufen sein. Automation muss exakt die vorhandenen sieben
|
||||
Rechte plus `root:execute` haben; `plans:approve` ist dort ausdrücklich verboten.
|
||||
Der Simulator benötigt seine bestehenden Planfreigabe-, Skript- und Rootrechte.
|
||||
Fehlende Rechte verweigern den Aufruf **vor** jeder MCP-Mutation. Das gesondert
|
||||
reviewte Provisionieren des zusätzlichen Automation-Rootrechts gehört nicht
|
||||
zu diesem Runner. Er verändert weder Rechte noch Actorart.
|
||||
|
||||
Die zentrale Policy muss genau einen Scope für dieses Gerät, diese Generation,
|
||||
beide Akteure, den tatsächlichen Fullpolicyhash und den qualifizierten Helpercode
|
||||
enthalten. Nur Fullskripte, keine Service-, APT- oder typisierte Rebootfreigabe.
|
||||
Das Profil gibt genehmigtem Rootcode volle Hostautorität; daraus wird keine
|
||||
Sandbox- oder generelle No-Reboot-Zusage abgeleitet.
|
||||
|
||||
Serverzugang nutzt ausschließlich den vorhandenen gepinnten SSH-Bootstrapweg.
|
||||
Der Token `/opt/rust-discovery/devstate/operator-a.token` wird ausschließlich auf
|
||||
dem Server für dessen eigene HTTPS-Anfrage gelesen. Er gelangt weder zum
|
||||
Entwicklungsrechner noch in Logs oder Ergebnisse. Der HTTP-Endpunkt ist fest
|
||||
`127.0.0.1:18443`, TLS-Name/SNI `localhost`, Vertrauen ausschließlich über
|
||||
`/opt/rust-discovery/devstate/api-pki/ca.pem`. MCP-Initialize, Initialisierungs-
|
||||
Notification, Sessionbindung und begrenzte JSON-/SSE-Antworten folgen dem
|
||||
bestehenden Cloud-MVP-Muster; dessen veralteter privater API-CA-Pfad wird hier
|
||||
gezielt nicht übernommen.
|
||||
|
||||
## Bedienweg und getrennte tatsächliche Abnahme
|
||||
|
||||
Die folgende Tabelle beschreibt die Modi. Mit dem separat korrigierten
|
||||
V2-Runner wurde anschließend genau ein [nativer Rootlauf bestanden](script-console-linux-full-results.md).
|
||||
Der ursprüngliche Fehlversuch bleibt erhalten; die Modusquelle selbst
|
||||
enthält weiterhin keinen Genehmigungsweg.
|
||||
|
||||
| Modus | Einzige zugelassene Wirkung |
|
||||
| --- | --- |
|
||||
| `prepare-local` | Neuer privater lokaler Intent samt unveränderlichem vollständigem Hashzeugen; explizite Policy-SHA und UTC-Zeiten erforderlich |
|
||||
| `plan --case <UUID>` | Einmalig MCP `operations.plan`, erst nach lokalem und serverseitigem dauerhaften Startmarker |
|
||||
| `submit --case <UUID>` | Einmalig MCP `operations.submit` mit festem Idempotenzschlüssel; danach lesender Pending-0/0/0/0-Nachweis |
|
||||
| `pending --case <UUID>` | Bestehende Anfrage und native Nichtverbräuche lesen; niemals einreichen oder genehmigen |
|
||||
| `read --case <UUID>` | Originalfälle, eindeutige Plan-/Idempotenzlookupdaten und vorhandene Resultate lesen |
|
||||
| `verify-result --case <UUID>` | Vorhandenes Endergebnis, tatsächlichen UI-Audit, native Originalbytes und betroffene MCP-Mandantengrenze lesen und prüfen |
|
||||
|
||||
`prepare-local` setzt nur Asset- und Zeitplatzhalter ein. An den Grund wird eine
|
||||
eindeutige `acceptance_case=<UUID>`-Kennung angehängt, damit ein verlorener
|
||||
Planreply rein lesend eindeutig gefunden werden kann. Skript, Identität,
|
||||
Interpreter, Argumente und Limits werden nicht verändert. Sämtliche Vorlagen-,
|
||||
Quell- und vollständigen Intentbindungen werden vor jedem Aufruf und Readback
|
||||
geprüft. Bestehende Pläne, Versuche und Intents werden nicht überschrieben.
|
||||
|
||||
Die einzigen mutierenden MCP-Methoden sind Plan und Submit. Es existiert kein
|
||||
Approval-API-, Browserautomations-, Cancel-, Retry- oder SQL-Schreibpfad. Auf dem
|
||||
Server entstehen nur eigene private Bootstrapintents und Einmalmarker sowie die
|
||||
durch MCP selbst erzeugten Pläne/Anträge. Alle direkten SQL-Abfragen laufen in
|
||||
`BEGIN READ ONLY`; der Operation-Getter wird bewusst nicht aufgerufen, weil
|
||||
dieser beim Lesen einen abgelaufenen Pendingantrag aktualisieren kann.
|
||||
|
||||
Nach Submit müssen die gespeicherte Anfrage `pending_approval`, null Jobs,
|
||||
Outboxeinträge, Grants und Autorisierungen sowie null native Verbräuche des
|
||||
neuen Versuchs belegt sein. Der lokale `pending-checkpoint.json` enthält die
|
||||
tatsächlichen ursprünglichen Planbytes, Plan-/Job-/Skripthashes, Job-/Versuch- und
|
||||
Operation-IDs, Ziel, Rechteprofil und Grenzen für die separate Browserprüfung.
|
||||
Seine zusätzliche Operationsansicht ist als aus lesendem SQL abgeleitet
|
||||
gekennzeichnet. **Erst danach darf der separat berechtigte Akteur den exakten
|
||||
gespeicherten Plan tatsächlich in der WebUI genehmigen.**
|
||||
|
||||
Bei verlorenem Reply niemals denselben Plan-/Submitaufruf erneut starten.
|
||||
Nur `read` verwenden: Originalcase und eindeutige gespeicherte Reason-/
|
||||
Idempotenzbindung werden gelesen. Ein gefundener Originalplan darf als genau
|
||||
dieser Plan erhalten werden; es wird kein Ersatzplan erzeugt. Ein fehlender oder
|
||||
mehrdeutiger Nachweis bleibt unklar und sperrt Wiederholung.
|
||||
|
||||
## Geplanter Ergebnisnachweis und seine Grenzen
|
||||
|
||||
Der Endnachweis verlangt genau einen Job, Outboxeintrag, Grant und eine
|
||||
Autorisierung. Er prüft tatsächlichen `dev_test_browser_simulation`-Audit mit
|
||||
Simulatorprincipal, `testsimulation:true`, Developmentprofil sowie unveränderten
|
||||
Plan-/Operationbindungen. Das ist ausdrücklich kein Produktionsnachweis einer
|
||||
echten menschlichen Identität. Erfolgreicher Zustand, Exit 0, ungekürzte rohe
|
||||
stdout-/stderr-Bytes, Root-UID, Fullprofil und Skripthash müssen übereinstimmen.
|
||||
|
||||
Die native Abfrage öffnet ausschließlich das vorhandene Root-Ledger lesend,
|
||||
prüft Inode und alle ursprünglichen 18 Verbrauchszeilen bytegebunden und erlaubt
|
||||
genau einen neuen abgeschlossenen Verbrauch für genau diesen Job/Versuch.
|
||||
Sie materialisiert ausschließlich diese 18 bekannten IDs und den neuen Versuch
|
||||
sowie die beiden Verbrauchszähler. Der Leseabschnitt wird vor BLOB-Hashing und
|
||||
Dekodierung vollständig zurückgerollt/geschlossen. SQLite-Busy-Timeout ist
|
||||
250 Millisekunden, das kooperative Fortschrittsbudget eine Sekunde; längere
|
||||
gemessene Transaktionen werden als Nachweis verweigert. Dies ist keine harte
|
||||
OS-/I/O-Echtzeitgarantie. Es läuft kein vollständiger Integritätsscan.
|
||||
Originalstart, Jobbytes, Grantbytes, Signaturbytes, Autorisierung, Boot und
|
||||
Ausführungsausgabe werden mit den gespeicherten Serverdaten verglichen.
|
||||
Skriptbytes werden direkt aus den ursprünglichen Planbytes ausgeschnitten,
|
||||
nicht aus einer API-Ansicht neu serialisiert. Die primäre Ed25519-Prüfung bleibt
|
||||
beim qualifizierten Produkthelper; dieser enge Opsrunner ist kein zweiter
|
||||
unabhängiger Signaturverifizierer und behauptet dies nicht.
|
||||
|
||||
Zeitvergleiche verwenden einen strikten RFC3339-Parser mit ganzzahligen
|
||||
Epoch-Nanosekunden: null bis neun Nachkommastellen werden exakt auf neun Stellen
|
||||
aufgefüllt, Z- und numerische UTC-Offsets korrekt verrechnet. Es gibt weder
|
||||
Gleitkommazahlen noch Rundung/Abschneiden. Ungültige Kalender-/Offsetwerte,
|
||||
fehlende Zone, mehr als neun Nachkommastellen und die hier nicht unterstützte
|
||||
Schaltsekunden-Schreibweise werden verweigert. Eingabe und Policy dürfen weiter
|
||||
Mikrosekunden verwenden; die ursprünglichen Produktbytes bleiben unverändert.
|
||||
Grant-/Native-Start-/Deadlinegrenzen werden bis zur letzten Nanosekunde verglichen.
|
||||
|
||||
Zusätzlich muss derselbe bestehende Automation-A-Token den bereits gespeicherten
|
||||
eigenen Job über den tatsächlichen MCP/HTTPS-Weg vollständig lesen können;
|
||||
Ergebnis und rohe Ausgabe müssen zu SQL und nativen Originalen passen.
|
||||
Mit dem ausschließlich serverseitigen bestehenden `operator-b.token` werden
|
||||
danach genau zwei lesende MCP-Abfragen ausgeführt: der neue A-Job und dessen
|
||||
gespeichertes A-Assetinventar. Gültige Authentisierung/Initialize und tatsächliche
|
||||
strukturierte `FORBIDDEN`-/`NOT_FOUND`-Toolantworten ohne Daten/Details sind Pflicht.
|
||||
Eine ungültige B-Anmeldung gilt nicht als Mandantennachweis. Dafür entstehen
|
||||
weder neue Jobs noch weitere Scopes. Der frühere Datenbank-RLS-Beleg ersetzt
|
||||
diesen ausdrücklich geplanten HTTP-/MCP-Authnachweis nicht.
|
||||
|
||||
Tatsächlich lokal geprüft: Python-Syntax und Help; sämtliche eingefrorenen
|
||||
Quell-/Templatebindungen; exakte Jobbyteausschnitte aus allen drei tatsächlichen
|
||||
Rust-Goldenplänen; synthetischer zulässiger Plan und Verweigerung geänderter
|
||||
Skriptbytes, Limits, Creatoridentität und mehrerer Versuche. Kein Test wurde als
|
||||
nativer Job- oder Browsernachweis ausgegeben. Der danach tatsächlich vorbereitete
|
||||
ursprüngliche Fall hielt während MCP-Initialize vor dem Plan-Toolcall an;
|
||||
sein Nichtwirkungsbeleg und die separate V2-Korrektur stehen im V2-Nachtrag.
|
||||
|
||||
Der ursprüngliche unbenutzte Runner `c958db665…` bleibt create-only archiviert.
|
||||
Unabhängiger Review fand dort den zu langen Leseabschnitt über einen vollständigen
|
||||
SQLite-Integritätsscan und Python-3.10-inkompatible beziehungsweise für Rust-
|
||||
Nanosekunden ungeeignete `fromisoformat`-Vergleiche. Beide wurden vor jeder
|
||||
Jobvorbereitung eng korrigiert. Tatsächliche gezielte lokale Prüfungen bestanden:
|
||||
Z, null bis neun Nachkommastellen, positive/negative Offsets, Zeitpunkt eine
|
||||
Nanosekunde vor Epoch und die echte Grantgrenzbedingung mit Ein-Nanosekunden-
|
||||
Abständen. Ein separater temporärer SQLite-Zeuge konnte einen unabhängigen
|
||||
Schreiber vor jedem Rowhash erwerben; kein Produkt-/VM-Ledger wurde dafür benutzt.
|
||||
@@ -0,0 +1,89 @@
|
||||
# Tatsächliche Linux-Abnahme der vollständigen Skriptkonsole
|
||||
|
||||
2026-11-14, ausschließlich Cloud-Linux gegen `discovery.ease-technologies.de`.
|
||||
Fall `ced97b4d-c352-4f0c-b34f-59e4d69ca192`, Runner-V2
|
||||
`c7f42df0a7e89274b7e255ac728ec4198a02278926348113c5b7e363e8983757`.
|
||||
**Die einzelne vollständige MCP → WebUI → Rootskript → Ergebnisstrecke ist
|
||||
nativ bestanden.** Dies schließt weder Windows noch den Selbstupdater ab.
|
||||
|
||||
Voraussetzung war der tatsächlich bestandene dreiteilige passive
|
||||
Linux-Nachbeleg `4c425416…`, SHA256
|
||||
`594fdf94261aa882df7ea771dda3f04779533dfdac768cf4a63c83448e1f27d7`.
|
||||
Die zuvor geöffnete Policy `71660e4c…` wurde ohne neuen Job geschlossen.
|
||||
Ein neuer, unveränderlicher 15-Minuten-Scope `992a6639…` band ausschließlich
|
||||
das tatsächlich qualifizierte Cloudgerät, beide berechtigten Akteure,
|
||||
Fullpolicy `8101afd1…` und Helpercode `79442727…`. Er erteilte keine
|
||||
Plangenehmigung. SYSTEM, Dienst-, APT- und typisierte Rebootfreigaben wurden
|
||||
nicht hinzugefügt. Volle Rootautorität des genehmigten Skripts bleibt ausdrücklich
|
||||
ohne Sandbox- oder generelle No-Reboot-Zusage.
|
||||
|
||||
## Tatsächlich durchlaufene Grenze
|
||||
|
||||
1. Der bestehende Automation-Akteur legte den festen Plan einmal über MCP an
|
||||
und reichte ihn einmal ein. Plan `259ff8f7-9b91-4707-8c3c-678573576ce3`,
|
||||
Planhash `070ed2a5aa98acb461719492590b85574e0450739d7ea7a715d2dc3d5ec4966f`.
|
||||
Antrag `25af50d7-b1fe-46f7-991f-23a4f186b46f` war dauerhaft
|
||||
`pending_approval`: null Jobs, Outboxeinträge, Grants, Autorisierungen
|
||||
und native Verbräuche dieses Versuchs.
|
||||
2. In der echten WebUI wurde genau dieser Antrag geöffnet und dessen
|
||||
unveränderlicher Plan angezeigt. DOM-Auslesung der vollständigen
|
||||
Zielpreviews und lokaler Vergleich bestätigten sämtliche originalen
|
||||
Planbytes, Ziel-/Job-/Versuchs-IDs, Skript- und Jobhashes, Root/
|
||||
`full_maintenance_v1`, Argumente, Zeitfenster und Limits. Vor dem
|
||||
angehakten Prüfkästchen war der Freigabebutton deaktiviert.
|
||||
3. Ein tatsächlicher Klick auf **„SIMULIERT: Diesen festen Plan ausdrücklich
|
||||
genehmigen“** erzeugte die Freigabe. Gespeicherte Autorisierung und Audit
|
||||
binden `simulated-testprincipal-a`, `dev_test_browser_simulation`,
|
||||
`testsimulation:true`, Entwicklungsprofil und denselben Plan/Antrag.
|
||||
Dies ist kein Freigabenachweis eines menschlichen Produktionsbenutzers.
|
||||
4. Genau Job `b014fb7a-c23e-440f-8bb6-8212c3af2b1f`, Versuch
|
||||
`cc56ea51-a548-4bde-93a5-ef49a31d110d`, wurde erfolgreich abgeschlossen.
|
||||
Je genau ein Job, Outboxeintrag, Grant und Autorisierungsdatensatz sind
|
||||
belegt. Der Rootledger enthält die unveränderten ursprünglichen18 Zeilen
|
||||
plus genau einen abgeschlossenen Verbrauch:19 verbraucht,0 ungeklärt.
|
||||
|
||||
Das [feste harmlose Skript](script-console-job-acceptance.md) umfasst130
|
||||
UTF-8-Bytes, SHA256 `c878ba5b5c37fa3f1b9485c6994d6c57f6f37d01d99d4239c64d264d4ed95336`.
|
||||
Es liest die UID, wartet zwölf Sekunden und schreibt feste Markierungen.
|
||||
Belegt: UID0, Exit0, erwartetes Fullprofil, bestandene stdout-Nachbedingung,
|
||||
keine Trunkierung und kein angeforderter Reboot; Limits30s/4096Byte.
|
||||
|
||||
| Unveränderte Ausgabe | Bytes | SHA256 des tatsächlichen WebUI-Downloads |
|
||||
| --- | ---: | --- |
|
||||
| stdout: `0\nRMM_FULL_CONSOLE_LINUX_V1\n` | 28 | `056c51deff395a12541cc977f62ad20dad80ccf2dff9f81c2ad8a2bdf09c3c7a` |
|
||||
| stderr: `RMM_FULL_CONSOLE_STDERR_V1\n` | 27 | `4b810603627a8d0836bc820087c6d566a503a6c1ca5bd06fff7e6f8910fa3311` |
|
||||
|
||||
Die Ergebnisse wurden tatsächlich in der WebUI geöffnet; beide Rohbytebuttons
|
||||
wurden angeklickt und die heruntergeladenen Dateien bytegenau verglichen.
|
||||
Der tatsächliche MCP-Getter liefert dasselbe vollständige Ergebnis.
|
||||
Zwei authentisierte MCP-Abfragen mit dem bestehenden anderen Mandanten
|
||||
(`jobs.get`, `inventory.get_device`) ergaben jeweils `NOT_FOUND`, leere
|
||||
Details, HTTP200 mit MCP-Fehler. Dafür wurde kein weiterer Job erzeugt.
|
||||
|
||||
## Abschluss und Grenzen
|
||||
|
||||
Der Scope wurde nach Erfolg geschlossen. Ein separater lesender Readback
|
||||
bestätigt wieder die originalen abgelaufenen Policybytes
|
||||
`cf15cbb68b590475df6def28e7dcffb7d88e0ca2d2555a06174fb654eeff05f4`,
|
||||
Eigentümer10001:10001, Modus0600 und ursprüngliche mtime. Die atomare
|
||||
Wiederherstellung hat einen neuen Inode; der historische Inode bleibt im
|
||||
Originalbeleg erhalten. Keine dauerhafte zentrale Fullfreigabe bleibt offen.
|
||||
|
||||
Privater Endbeleg `passed.json`, SHA256
|
||||
`89dcb583fb62d8af6cb87e9a386e973451016be6bd7077ac1a8e5f8db3fa2128`.
|
||||
Browserbelege liegen unter `output/playwright/51c274c9…/evidence/`;
|
||||
Rohdaten, Zugangsdaten und Browserzustand bleiben gitignoriert.
|
||||
|
||||
Im Browser tatsächlich beobachtet wurden `pending_approval`, `queued` und
|
||||
`succeeded`; der laufende Zwischenzustand wurde trotz des Warteabschnitts
|
||||
verpasst. Kein zweiter Lauf wurde dafür erzeugt. Der Nachbeleg bindet die
|
||||
Originalgrant-/Signatur-/Request-/Outcomebytes; er enthält keine zweite
|
||||
unabhängige Ed25519-Verifikation und keinen separat erfassten Kindprozess-
|
||||
Startzeitpunkt. Die feste Frist ist anhand der nativen Startreservierung
|
||||
belegt. Timeout, Abbruch, Offlinebetrieb und eine fremde Linux-Prozessgruppe
|
||||
sind durch diesen erfolgreichen Einzelfall nicht zusätzlich nativ abgenommen.
|
||||
Der ältere SSE-Fehlversuch bleibt [fehlgeschlagen und unverändert](script-console-job-acceptance-v2.md).
|
||||
|
||||
Weiter offen: Windowsclock und native PowerShell-/SYSTEM-Abnahme,
|
||||
Selbstupdater-Runtime und deren Linux-/Windows-Applynachweise sowie
|
||||
abschließende Integration und konsistente aktuelle Runtimeindizes.
|
||||
Reference in New Issue
Block a user