Repository navigation
Description
What is wrong
Contributor: Raghuvar Durga (@drk-ram)
On main (e1560f3), four conformance modules in conformance/src/trace_tests/modules/ have URI, explicit-null, and non-string digest coercion gaps that allow schema-invalid records to pass or skip conformance checks:
-
TR-RTE-003(conformance/src/trace_tests/modules/tr_rte.py, lines 90-104):- Checks only
if rim_uri is None: Status.SKIPandelif isinstance(rim_uri, str) and rim_uri.startswith("https://"): Status.PASS. - As a result:
- Explicit
{"rim_uri": None}(nullin JSON, which failsschema/trace-claim.jsonbecauseruntime.rim_uriis"type": "string") returnsStatus.SKIPinstead ofStatus.FAIL(unlikeTR-APR-003andTR-APR-004, which fail on explicitnull). rim_uri = "https://"(empty authority/host),rim_uri = "https://ex ample.com/rim"(contains whitespace),rim_uri = "https://example.com/\x01"(contains control characters), andrim_uri = "https://["(unparseable IPv6 host) all returnStatus.PASS!
- Explicit
- Checks only
-
TR-ANC-001(conformance/src/trace_tests/modules/tr_anc.py, lines 21-42):- Uses
urlparse(transparency)and checks onlyparsed.scheme != "https" or not parsed.netloc. - Because
urllib.parse.urlparsedoes not reject whitespace or control characters,transparency = "https://rekor.sigstore.dev/api/v1/log/entries/bad uri"or"https://rekor.sigstore.dev/api/v1/log/entries/x\n"returnsStatus.PASSonTR-ANC-001(whereasTR-POL-003andTR-APR-002/003explicitly reject whitespace and control characters).
- Uses
-
TR-TXN-002(conformance/src/trace_tests/modules/tr_txn.py, lines 31-34):- Checks
call_count = txn.get("call_count"); if call_count is None: Status.SKIP. - When
"call_count": nullis explicitly present intool_transcript("call_count" in txn and txn["call_count"] is None),schema/trace-claim.jsonrejects it ("type": "integer"), butTR-TXN-002returnsStatus.SKIPinstead ofStatus.FAIL.
- Checks
-
Non-string digest coercion via
str(...)inTR-RTE-002,TR-SCA-002,TR-TXN-001, andTR-POL-001:tr_rte.py(_DIGEST_RE.fullmatch(str(measurement))),tr_sca.py(_DIGEST_RE.fullmatch(str(digest))),tr_txn.py(_DIGEST_RE.fullmatch(str(h))), andtr_pol.py(_DIGEST_RE.fullmatch(str(bundle_hash))) coerce non-strings viastr(...)before matching_DIGEST_RE, instead of requiringisinstance(..., str).
Spec section or file
conformance/src/trace_tests/modules/tr_rte.py(TR-RTE-002,TR-RTE-003)conformance/src/trace_tests/modules/tr_anc.py(TR-ANC-001)conformance/src/trace_tests/modules/tr_txn.py(TR-TXN-001,TR-TXN-002)conformance/src/trace_tests/modules/tr_sca.py(TR-SCA-002)conformance/src/trace_tests/modules/tr_pol.py(TR-POL-001)
Expected behavior
TR-RTE-003should skip only when"rim_uri" not in runtime, fail whenrim_uriisNoneor not astr, and require a validhttpsURI with non-empty host (netloc) and no whitespace or control characters.TR-ANC-001should rejecttransparencyURIs containing whitespace or control characters withStatus.FAIL.TR-TXN-002should skip only when"call_count" not in txn, and fail withStatus.FAILwhen"call_count"is explicitlyNone.TR-RTE-002,TR-SCA-002,TR-TXN-001, andTR-POL-001should requireisinstance(value, str)before matching_DIGEST_RE.
Impact
Prevents trace-tests from passing malformed runtime.rim_uri ("https://" or URIs with spaces/control characters) and transparency URIs with spaces/control characters, or skipping explicit null values on runtime.rim_uri and tool_transcript.call_count.
Activity
conformance: harden URI, explicit-null, and string-digest checks (age…
conformance: harden URI, explicit-null, and string-digest checks in T…