Skip to content

Commit 6b1d135

Browse files
committed
Clarify non-schema $ref targets
Whether the target is definitely not a schema or simply unknown and therefore not necessarily a schema, the result of $ref-ing it is undefined. Only references to targets that the implementation can determine with certainty to be schemas have well-defined behavior.
1 parent c1eff7f commit 6b1d135

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

jsonschema-core.xml

+13-1
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,19 @@
15521552
nested subschemas, which would be subject to the processing rules for
15531553
"$id". Therefore, having a reference target in such an unrecognized
15541554
structure cannot be reliably implemented, and the resulting behavior
1555-
is undefined.
1555+
is undefined. Similarly, a reference target under a known keyword,
1556+
for which the value is known not to be a schema, results in undefined
1557+
behavior in order to avoid burdening implementations with the need
1558+
to detect such targets.
1559+
<cref>
1560+
These scenarios are analogous to fetching a schema over HTTP
1561+
but receiving a response with a Content-Type other than
1562+
application/schema+json. An implementation can certainly
1563+
try to interpret it as a schema, but the origin server
1564+
offered no guarantee that it actually is any such thing.
1565+
Therefore, interpreting it as such has security implications
1566+
and may produce unpredictable results.
1567+
</cref>
15561568
</t>
15571569
<t>
15581570
Note that single-level custom keywords with identical syntax and

0 commit comments

Comments
 (0)