Dashboard › institutional-transition-lab › Session 0PqYjpjyrWXQ
0PqYjpjyrWXQ6HyIHPerform a fresh read-only security audit of only ZIP structure and decompression verification for issue #4 in /home/byk/Code/institutional-transition-lab. This replaces a reviewer that returned empty twice and is disjoint from descriptor-read, JSON/pin, and CLI reviewers. Never edit files and never inspect governance bodies, coding decisions, outcomes, reports, dates, detector output, or source-adjudication scopes.
Scope only: in-memory artifact ZIP parsing and directly related limits/tests; entry-count, compressed and expanded size limits; duplicate names; normalized/path/case/backslash collisions; absolute/parent paths; directory/symlink/special/encrypted entries; unsupported compression methods; local-vs-central metadata inconsistencies where the library exposes them; decompression bombs; truncated/corrupt streams; actual bytes-read enforcement; exact uniqueness and byte comparison for required documents.json and v1.2-adjudication-package.json. Do not review file opening, JSON parsing, frozen pins/hashes, or CLI outputs.
Review current working copy. Run narrow read-only tests/probes. Return substantive evidence, never empty. Findings first, severity ordered, exact current file:line references, PASS/CONCERN/MUST-FIX/BLOCKED labels. Every defect needs a deterministic regression. If clean, state PASS with tests/probes and residual risks. End exactly MERGE or DO-NOT-MERGE.
<path>/home/byk/Code/institutional-transition-lab</path> <type>directory</type> <entries> .git/ .github/ .gitignore .lore.md .pytest_cache/ .ruff_cache/ .venv/ AGENTS.md cases/ data/ docs/ node_modules/ package-lock.json package.json PROTOCOL.md pyproject.toml README.md research/ schema/ scripts/ src/ tests/ uv.lock (23 entries) </entries>
Found 10 matches /home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py: Line 8: import zipfile Line 65: with zipfile.ZipFile(paths["artifact"], "w") as archive: Line 703: with zipfile.ZipFile(artifact, "w") as archive: Line 743: with zipfile.ZipFile(artifact, "w") as archive: Line 890: zipfile.ZipFile(paths["artifact"], "a") as archive, Line 913: with zipfile.ZipFile(paths["artifact"], "a") as archive: /home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py: Line 10: import zipfile Line 180: with zipfile.ZipFile(io.BytesIO(artifact)) as archive: Line 181: infos = archive.infolist() Line 207: except zipfile.BadZipFile as error:
Found 14 matches
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py:
Line 67: MAX_ARCHIVE_MEMBERS = 128
Line 68: MAX_ARCHIVE_MEMBER_BYTES = 16 * 1024 * 1024
Line 69: MAX_ARCHIVE_EXPANDED_BYTES = 64 * 1024 * 1024
Line 182: if len(infos) > MAX_ARCHIVE_MEMBERS:
Line 188: if sum(info.file_size for info in infos) > MAX_ARCHIVE_EXPANDED_BYTES:
Line 189: raise ValueError("artifact expanded size exceeds limit")
Line 191: "documents.json": documents,
Line 192: "v1.2-adjudication-package.json": coding_package,
Line 199: if info.file_size > MAX_ARCHIVE_MEMBER_BYTES:
Line 200: raise ValueError(f"artifact member exceeds size limit: {member_name}")
Line 202: member_bytes = source.read(MAX_ARCHIVE_MEMBER_BYTES + 1)
Line 203: if len(member_bytes) > MAX_ARCHIVE_MEMBER_BYTES:
Line 204: raise ValueError(f"artifact member exceeds size limit: ...
Found 23 matches
/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py:
Line 36: ROOT = Path(__file__).parents[1]
Line 195: "source_text_truncated": False,
Line 197: "patch_selection_truncated": False,
Line 210: "source_text_truncated": False,
Line 212: "patch_selection_truncated": False,
Line 331: @pytest.mark.parametrize("mutation", ["duplicate", "missing"])
Line 334: if mutation == "duplicate":
Line 379: ("evidence_bounds", {"source_text_truncated": True}),
Line 426: documents["documents"][0]["evidence_bounds"]["source_text_truncated"] = True
Line 813: @pytest.mark.parametrize("alias_kind", ["direct", "symlink", "hardlink"])
Line 825: elif alias_kind == "symlink":
Line 826: paths["summary_json"].symlink_to(paths[input_name])
Line 848: def test_cli_rejects_duplicate_manifest_keys(
Line 864: with pytest.raises(ValueError, match="duplicate JSON key: artifact_sha256"):
Line 883: def ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
1: from __future__ import annotations
2:
3: import argparse
4: import hashlib
5: import io
6: import json
7: import os
8: import stat
9: import tempfile
10: import zipfile
11: from collections import Counter
12: from contextlib import suppress
13: from dataclasses import dataclass
14: from pathlib import Path
15: from typing import Any
16:
17: from jsonschema import Draft202012Validator, FormatChecker
18:
19: from institution_lab.governance_coding import validate_response
20:
21: DECISIONS = {"accept", "revise", "reject", "abstain"}
22: INSTITUTIONAL_CLASSES = {
23: "effective_institutional_change",
24: "announced_institutional_change",
25: "proposal_only",
26: }
27: REVIEWER_TYPES = {"human", "llm", "human_llm_assisted"}
28: REVIEWER_ROLES = {"source_adjudicator", "evidence_auditor", "synthesizer"}
29: RESPONSE_SOURCES = {"luna_a", "luna_b", ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
160: artifact: bytes,
161: documents: bytes,
162: coding_package: bytes,
163: protocol: bytes,
164: coding_schema: bytes,
165: adjudication_schema: bytes,
166: ) -> VerifiedInputBundle:
167: _validate_manifest_identity(manifest)
168: computed = {
169: "artifact_sha256": _bytes_sha256(artifact),
170: "documents_file_sha256": _bytes_sha256(documents),
171: "coding_package_file_sha256": _bytes_sha256(coding_package),
172: "protocol_sha256": _bytes_sha256(protocol),
173: "coding_schema_sha256": _bytes_sha256(coding_schema),
174: "adjudication_schema_sha256": _bytes_sha256(adjudication_schema),
175: }
176: for field, value in computed.items():
177: if manifest.get(field) != value:
178: raise ValueError(f"input manifest mismatch: {field}")
179: try:
180: with zipfile.ZipFile(io.BytesIO(artifact)) as archive:
181: infos = ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
150: if type(manifest.get("artifact_id")) is not int or manifest["artifact_id"] < 1:
151: raise ValueError("input manifest artifact_id is invalid")
152: for field, value in FROZEN_INPUT_PINS.items():
153: if manifest.get(field) != value:
154: raise ValueError(f"input manifest does not identify frozen issue #4 input: {field}")
155:
156:
157: def _verify_input_payloads(
158: manifest: Any,
159: *,
160: artifact: bytes,
161: documents: bytes,
162: coding_package: bytes,
163: protocol: bytes,
164: coding_schema: bytes,
165: adjudication_schema: bytes,
166: ) -> VerifiedInputBundle:
167: _validate_manifest_identity(manifest)
(Showing lines 150-167 of 946. Use offset=168 to continue.)
</content>
Found 15 matches /home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py: Line 66: MAX_ARTIFACT_BYTES = 32 * 1024 * 1024 Line 67: MAX_ARCHIVE_MEMBERS = 128 Line 68: MAX_ARCHIVE_MEMBER_BYTES = 16 * 1024 * 1024 Line 69: MAX_ARCHIVE_EXPANDED_BYTES = 64 * 1024 * 1024 Line 113: return _bytes_sha256(_read_regular_file(path, max_bytes=MAX_ARTIFACT_BYTES)) Line 157: def _verify_input_payloads( Line 182: if len(infos) > MAX_ARCHIVE_MEMBERS: Line 188: if sum(info.file_size for info in infos) > MAX_ARCHIVE_EXPANDED_BYTES: Line 199: if info.file_size > MAX_ARCHIVE_MEMBER_BYTES: Line 202: member_bytes = source.read(MAX_ARCHIVE_MEMBER_BYTES + 1) Line 203: if len(member_bytes) > MAX_ARCHIVE_MEMBER_BYTES: Line 231: return _verify_input_payloads( Line 233: artifact=_read_regular_file(artifact, max_bytes=MAX_ARTIFACT_BYTES), Line 916: bundle = _verify_input_payloads( Line 918: ...
Found 11 matches
/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py:
Line 66: archive.writestr("documents.json", paths["documents"].read_bytes())
Line 67: archive.writestr(
Line 704: archive.writestr("documents.json", documents.read_bytes())
Line 705: archive.writestr("v1.2-adjudication-package.json", coding_package.read_bytes())
Line 744: archive.writestr("documents.json", b"different documents")
Line 745: archive.writestr("v1.2-adjudication-package.json", coding_package.read_bytes())
Line 772: with pytest.raises(ValueError, match="artifact member mismatch: documents.json"):
Line 892: archive.writestr("documents.json", paths["documents"].read_bytes())
Line 896: with pytest.raises(ValueError, match="artifact member is not unique: documents.json"):
Line 915: archive.writestr(f"padding/{index}", b"")
Line 919: with pytest.raises(ValueError, match="artifact member count exceeds limit"):
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
680: assert summary["canonicalization_gate"] == "closed"
681:
682:
683: def test_input_manifest_rejects_changed_file_bytes(
684: tmp_path: Path,
685: monkeypatch: pytest.MonkeyPatch,
686: ) -> None:
687: artifact = tmp_path / "artifact.zip"
688: documents = tmp_path / "documents.json"
689: coding_package = tmp_path / "coding-package.json"
690: protocol = tmp_path / "protocol.md"
691: coding_schema = tmp_path / "coding-schema.json"
692: adjudication_schema = tmp_path / "adjudication-schema.json"
693: paths = {
694: "artifact": artifact,
695: "documents": documents,
696: "coding_package": coding_package,
697: "protocol": protocol,
698: "coding_schema": coding_schema,
699: "adjudication_schema": adjudication_schema,
700: }
701: for path in paths.values():
702: path.write_text(path.name)
703: with zipfile.ZipFile(artifact, "w") as ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
875: documents=Path("unused"),
876: coding_package=Path("unused"),
877: protocol=Path("unused"),
878: coding_schema=Path("unused"),
879: adjudication_schema=Path("unused"),
880: )
881:
882:
883: def test_input_manifest_rejects_duplicate_artifact_members(
884: tmp_path: Path,
885: monkeypatch: pytest.MonkeyPatch,
886: ) -> None:
887: manifest, paths = _write_pinned_cli_inputs(tmp_path, monkeypatch)
888: with (
889: pytest.warns(UserWarning, match="Duplicate name"),
890: zipfile.ZipFile(paths["artifact"], "a") as archive,
891: ):
892: archive.writestr("documents.json", paths["documents"].read_bytes())
893: manifest["artifact_sha256"] = file_sha256(paths["artifact"])
894: monkeypatch.setattr(governance_adjudication, "FROZEN_INPUT_PINS", dict(manifest))
895:
896: with pytest.raises(ValueError, match="artifact member is not unique: ...
Found 8 matches /home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py: Line 14: from institution_lab.governance_adjudication import ( Line 37: MAX_TEST_ARCHIVE_MEMBERS = 256 Line 302: from institution_lab.governance_adjudication import canonical_sha256 Line 431: from institution_lab.governance_adjudication import canonical_sha256 Line 706: from institution_lab.governance_adjudication import file_sha256 Line 746: from institution_lab.governance_adjudication import file_sha256 Line 914: for index in range(MAX_TEST_ARCHIVE_MEMBERS): Line 940: "from institution_lab.governance_adjudication import _read_regular_file; "
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path> <type>file</type> <content> 1: from __future__ import annotations 2: 3: import copy 4: import json 5: import os 6: import subprocess 7: import sys 8: import zipfile 9: from pathlib import Path 10: 11: import pytest 12: 13: from institution_lab import governance_adjudication 14: from institution_lab.governance_adjudication import ( 15: DECISIONS, 16: FROZEN_INPUT_PINS, 17: REQUIRED_INPUT_PINS, 18: REVIEWER_ROLES, 19: REVIEWER_TYPES, 20: canonical_sha256, 21: file_sha256, 22: validate_adjudication, 23: validate_adjudication_fragment, 24: validate_against_schema, 25: verify_input_manifest, 26: ) 27: from institution_lab.governance_coding import ( 28: BODY_PATCH_RELATIONS, 29: CHANGE_STATUSES, 30: DIRECTIONS, 31: EVENT_KINDS, 32: RECORD_CLASSES, 33: RIGHT_KINDS, 34: ) 35: 36: ROOT = Path(__file__).parents[1] 37: MAX_TEST_ARCHIVE_MEMBERS = 256 38: 39: 40: def ...
No files found
?? src/institution_lab/governance_adjudication.py ?? tests/test_governance_adjudication.py
baseline: ACCEPT dot-alias: ACCEPT case-alias: ACCEPT backslash-alias: ACCEPT parent-path: ACCEPT absolute-path: ACCEPT directory: ACCEPT symlink: ACCEPT fifo: ACCEPT
required-symlink: ACCEPT required-directory-mode: ACCEPT required-fifo: ACCEPT
Your prior result was empty. Complete the same read-only ZIP structure/decompression security audit now and return substantive evidence or an explicit blocker. Never edit files. Scope remains only in-memory artifact ZIP parsing and directly related limits/tests: entry count, compressed and expanded size limits; duplicate names; normalized/path/case/backslash collisions; absolute/parent paths; directory/symlink/special/encrypted entries; unsupported compression methods; local-vs-central metadata inconsistencies exposed by the library; decompression bombs and corrupt/truncated streams; actual bytes-read enforcement; exact uniqueness and byte comparison for required documents.json and v1.2-adjudication-package.json. Do not review file opening, JSON parsing, frozen pins/hashes, CLI outputs, governance records/codings/outcomes/reports/dates, or source-adjudication scopes. Review the unchanged current working copy in /home/byk/Code/institutional-transition-lab. Run narrow read-only tests/probes. Findings first with exact current file:line evidence and PASS/CONCERN/MUST-FIX/BLOCKED labels; deterministic regression for every defect; commands/probes run. Never return empty. End exactly MERGE or DO-NOT-MERGE.
actual-expanded=67108865 declared-expanded=2 compressed=65235 visible=2 archive=65501 forged-expanded-stream: ACCEPT
local-method-disagrees: ACCEPT local-crc-disagrees: ACCEPT local-compressed-size-disagrees: ACCEPT local-expanded-size-disagrees: ACCEPT local-encryption-flag-disagrees: ACCEPT local-name-disagrees: REJECT ValueError: artifact is not a valid ZIP archive
NotFound: FileSystem.access (/home/byk/Code/institutional-transition-lab wed Sep 09 2026. Confine security audit to synthetic ZIP parsing; do not inspect prohibited files. Use commentary tool channel.)
archive=33554797 configured-limit=33554432 oversized-in-memory-archive: ACCEPT
required-regular: ACCEPT required-directory-mode: ACCEPT required-symlink-mode: ACCEPT required-fifo-mode: ACCEPT required-socket-mode: ACCEPT
File "<stdin>", line 40
size = struct.unpack_from("<I", data, offset fra field)[0]
^^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
File "<stdin>", line 38
for signature, field in_rb ((LOCAL, 18), (CENTRAL, 20)):
^^^^^
SyntaxError: invalid syntax
File "<stdin>", line 43
local_size = struct.unpack_from("_you("<I", data, local + 18)[0]
^
SyntaxError: unterminated string literal (detected at line 43)
NotFound: FileSystem.access (/home/byk/Code/institutional-transition-lab/ALL modules read-only test runner. No prohibited test output expected; report only pass/fail. Do not mutate repository files.)
... [100%] 3 passed in 0.11s
?? src/institution_lab/governance_adjudication.py ?? tests/test_governance_adjudication.py
truncate-1: REJECT ValueError: artifact is not a valid ZIP archive truncate-8: REJECT ValueError: artifact is not a valid ZIP archive truncate-22: REJECT ValueError: artifact is not a valid ZIP archive
required-truncated-stream: ACCEPT extra-truncated-stream: ACCEPT
'./documents.json': ACCEPT 'folder/../documents.json': ACCEPT 'Documents.json': ACCEPT '.\\documents.json': ACCEPT '../escape': ACCEPT '/absolute': ACCEPT 'C:\\absolute': ACCEPT 'padding/': ACCEPT
extra-expanded=16777217 member-limit=16777216 archive=16695 oversized-extra-member: ACCEPT
... [100%] 3 passed in 0.10s
?? src/institution_lab/governance_adjudication.py ?? tests/test_governance_adjudication.py
Python 3.13.11