Dashboard › institutional-transition-lab › Session 0p9JdvcfJjZl
0p9JdvcfJjZl0b0LLPerform a fresh, smaller, read-only security audit of only ZIP decompression resource accounting for issue #4 in /home/byk/Code/institutional-transition-lab. This replaces a ZIP-stream reviewer that returned empty twice. Never edit files or inspect governance bodies, codings, outcomes, reports, dates, detector output, or source-adjudication scopes.
Scope only: actual decompressed-byte reads; per-member and aggregate expanded-byte limits; compression-bomb behavior; declared-vs-actual uncompressed size mismatches; short/partial read accumulation; deterministic cleanup and bounded failure. Do not review archive entry names/path/mode/encryption/count metadata, required-member identity/content comparisons, _read_regular_file, JSON, pins/hashes, or CLI outputs.
Primary files: only the relevant ZIP read/limit code in src/institution_lab/governance_adjudication.py and narrow tests in tests/test_governance_adjudication.py. Run read-only tests/probes. Return substantive evidence, never empty. Findings first, severity ordered, exact current file:line references, PASS/CONCERN/MUST-FIX/BLOCKED labels; deterministic regression for each defect. If clean, state PASS with probes and residual risks. End exactly MERGE or DO-NOT-MERGE.
Found 10 matches
/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py:
Line 10: import zipfile
Line 69: MAX_ARCHIVE_EXPANDED_BYTES = 64 * 1024 * 1024
Line 106: payload = source.read(max_bytes + 1)
Line 180: with zipfile.ZipFile(io.BytesIO(artifact)) as archive:
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 199: if info.file_size > MAX_ARCHIVE_MEMBER_BYTES:
Line 202: member_bytes = source.read(MAX_ARCHIVE_MEMBER_BYTES + 1)
Line 207: except zipfile.BadZipFile as error:
Line 208: raise ValueError("artifact is not a valid ZIP archive") from error
Found 21 matches
/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py:
Line 8: import zipfile
Line 37: MAX_TEST_ARCHIVE_MEMBERS = 256
Line 52: "artifact": tmp_path / "artifact.zip",
Line 65: with zipfile.ZipFile(paths["artifact"], "w") as archive:
Line 66: archive.writestr("documents.json", paths["documents"].read_bytes())
Line 67: archive.writestr(
Line 687: artifact = tmp_path / "artifact.zip"
Line 703: with zipfile.ZipFile(artifact, "w") as archive:
Line 704: archive.writestr("documents.json", documents.read_bytes())
Line 705: archive.writestr("v1.2-adjudication-package.json", coding_package.read_bytes())
Line 733: artifact = tmp_path / "artifact.zip"
Line 743: with zipfile.ZipFile(artifact, "w") as archive:
Line 744: archive.writestr("documents.json", b"different documents")
Line 745: archive.writestr("v1.2-adjudication-package.json", coding_package.read_bytes())
Line 890: ...
No files found
Found 10 matches /home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py: Line 25: verify_input_manifest, Line 661: verify_input_manifest( Line 726: verify_input_manifest(manifest, **paths) Line 773: verify_input_manifest(manifest, **paths) Line 783: original_verify = governance_adjudication.verify_input_manifest Line 792: "verify_input_manifest", Line 872: verify_input_manifest( Line 897: verify_input_manifest( Line 920: verify_input_manifest( Line 966: verified = verify_input_manifest(
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path> <type>file</type> <content> 60: "announced_on", 61: "effective_on", 62: "affected_scope", 63: "body_patch_relation", 64: } 65: MAX_INPUT_BYTES = 16 * 1024 * 1024 66: MAX_ARTIFACT_BYTES = 32 * 1024 * 1024 67: MAX_ARCHIVE_MEMBERS = 128 68: MAX_ARCHIVE_MEMBER_BYTES = 16 * 1024 * 1024 69: MAX_ARCHIVE_EXPANDED_BYTES = 64 * 1024 * 1024 70: 71: 72: @dataclass(frozen=True) 73: class VerifiedInputBundle: 74: pins: dict[str, Any] 75: documents: dict[str, Any] 76: coding_package: dict[str, Any] (Showing lines 60-76 of 946. Use offset=77 to continue.) </content>
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
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 = archive.infolist()
182: if len(infos) > MAX_ARCHIVE_MEMBERS:
183: raise ValueError("artifact member count exceeds limit")
184: ...
<path>/home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py</path>
<type>file</type>
<content>
850: monkeypatch: pytest.MonkeyPatch,
851: ) -> None:
852: manifest, paths = _write_pinned_cli_inputs(tmp_path, monkeypatch)
853: _stub_cli_validation(monkeypatch)
854: manifest_text = json.dumps(manifest)
855: paths["input_manifest"].write_text(
856: manifest_text.replace(
857: '"artifact_sha256":',
858: '"artifact_sha256": "forged", "artifact_sha256":',
859: 1,
860: )
861: )
862: paths["summary_json"].write_text('{"canonicalization_gate":"open"}\n')
863:
864: with pytest.raises(ValueError, match="duplicate JSON key: artifact_sha256"):
865: _run_cli(monkeypatch, paths)
866:
867: assert json.loads(paths["summary_json"].read_text())["canonicalization_gate"] == "closed"
868:
869:
870: def test_input_manifest_rejects_non_object() -> None:
871: with pytest.raises(ValueError, match="input manifest must be an object"):
872: ...
Found 3 matches /home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py: Line 883: def test_input_manifest_rejects_duplicate_artifact_members( Line 908: def test_input_manifest_rejects_excessive_artifact_member_count( Line 979: def test_committed_partial_fragment_validates_but_cannot_be_the_full_envelope() -> None:
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
145: raise ValueError("input manifest must be an object")
146: if set(manifest) != REQUIRED_INPUT_PINS:
147: raise ValueError("input manifest has missing or unexpected keys")
148: if type(manifest.get("workflow_run_id")) is not int or manifest["workflow_run_id"] < 1:
149: raise ValueError("input manifest workflow_run_id is invalid")
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: ...
Found 35 matches /home/byk/Code/institutional-transition-lab/tests/test_governance_adjudication.py: Line 120: def test_adjudication_schema_matches_validator_ontology() -> None: Line 142: def test_schema_enforces_uri_and_date_formats(field: str, value: str) -> None: Line 312: def test_one_abstention_keeps_canonicalization_gate_closed() -> None: Line 332: def test_record_ids_must_match_frozen_documents_exactly_once(mutation: str) -> None: Line 345: def test_accept_must_equal_the_named_frozen_response() -> None: Line 355: def test_resolved_decision_cannot_leave_final_coding_abstained() -> None: Line 382: def test_source_audit_must_match_complete_frozen_document(field: str, value: object) -> None: Line 406: def test_institutional_class_and_dates_must_agree( Line 423: def test_bounded_source_requires_explicit_evidence_limitation() -> None: Line 450: def test_accept_edge_revision_uses_the_accepted_response() -> None: Line 460: def ...
<path>/home/byk/Code/institutional-transition-lab/src/institution_lab/governance_adjudication.py</path>
<type>file</type>
<content>
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)
168: computed = {
(Showing lines 151-168 of 946. Use offset=169 to continue.)
</content>
deflate: actual=25165824 declared=2 archive=24733 accepted=True traced_peak=33634956 bzip2: actual=25165824 declared=2 archive=354 accepted=True traced_peak=55939492 lzma: actual=25165824 declared=2 archive=3920 accepted=True traced_peak=64368714
Your first result was empty. Complete the same narrow read-only ZIP decompression resource-accounting audit now and return substantive evidence or an explicit blocker. Never edit files. Scope only in /home/byk/Code/institutional-transition-lab: actual decompressed-byte reads; per-member and aggregate expanded-byte limits; compression-bomb behavior; declared-vs-actual uncompressed-size mismatches; short/partial read accumulation; deterministic cleanup and bounded failure; narrowly corresponding code/tests in src/institution_lab/governance_adjudication.py and tests/test_governance_adjudication.py. Do not review archive name/path/mode/encryption/count metadata, required-member identity/content comparison, _read_regular_file, JSON, pins/hashes, CLI output, governance records/codings/outcomes/reports/dates, or source adjudication. Review unchanged current working copy and run narrow read-only probes. Findings first with exact file:line evidence and PASS/CONCERN/MUST-FIX/BLOCKED labels; deterministic regression for each defect; commands/probes run. Never return empty. End exactly MERGE or DO-NOT-MERGE.
failure=ValueError streams=1 stream_closed=True archive_closed=True