fix: scope release proofs and bind PCB opening consent

This commit is contained in:
阿白叔 committed 2026-11-12 16:02:53 +08:00
1 parent 42d0cebc54
commit 466f400514
33 files changed
+1358 -61

No files matched your search

+23
View File
@@ -161,6 +161,29 @@ def test_recorded_export_pid_reuse_requires_matching_creation_identity(export_ca
with prove_export_copies_released(library): pass
@pytest.mark.parametrize('in_memory', [False, True])
def test_preexisting_process_misrecorded_as_descendant_does_not_retain_copy(export_case, monkeypatch, in_memory):
import win32api, win32con
from cbb_refresh_verify import native_engineering_identity as identity
from cbb_refresh_verify.native_export_guard import prove_export_copies_released
library, root, *_ = export_case
record = dict(pid=123456, observed_pids=[123456, os.getpid()], process_identities=[
dict(pid=123456, created='20261112120000.000000+480', executable='native'),
dict(pid=os.getpid(), created='20261111120000.000000+480', executable='other')])
(root/'ascii-process.json').write_text(json.dumps(record),'utf-8')
monkeypatch.setattr(identity, '_process_snapshot', lambda: [dict(pid=os.getpid(), name='other.exe',
parent=123456, created='20261111120000.000000+480', executable='other', command='')])
handle = win32api.OpenProcess(win32con.SYNCHRONIZE, False, os.getpid())
try:
if in_memory:
monkeypatch.setattr(identity, '_retained_exports', [(SimpleNamespace(pid=123456,poll=lambda: 0),
{os.getpid(): handle}, dict(library=str(library),analysis_root=str(root)))])
with prove_export_copies_released(library) as copies:
assert copies == [str(root/'project')]
finally:
handle.Close()
@pytest.mark.parametrize('active', [False, True])
def test_unknown_checkpoint_requires_explicit_full_proof_and_no_native_export_owner(tmp_path, monkeypatch, active):
import cbb_refresh_verify.native_engineering_identity as identity