@davoodmehraban89 / Aram-1 / commits / 07d382c
Fork 0

test(security): cover invalid and oversized mapping archives

davoodmehraban89 committed Nov 1, 2026 at 15:09 UTC 07d382c3ef4fe57962aa4f3f0d7473308d3a29d6
1 file changed +11
backend/tests/test_mapping_source_parser.py
+11
@@ -105,3 +105,14 @@ def test_normalizes_integral_numeric_account_codes_without_decimal_suffix():
105 records = list(parse_mapping_source(mapping_bytes(valid_row(**{"کد حساب": 8161.0}))))
106
107 assert records[0].account_code == "8161"
108 +
109 +def test_rejects_invalid_zip_archive_before_workbook_parsing():
110 + with pytest.raises(MappingSourceParseError, match="archive is invalid"):
111 + list(parse_mapping_source(b"not-an-xlsx-archive"))
112 +
113 +
114 +def test_rejects_oversized_mapping_input_before_workbook_parsing():
115 + from aram_backend.mapping_source_parser import MAX_MAPPING_INPUT_BYTES
116 +
117 + with pytest.raises(MappingSourceParseError, match="size is invalid"):
118 + list(parse_mapping_source(b"x" * (MAX_MAPPING_INPUT_BYTES + 1)))