Skip to content

Commit 5093e5c

Browse files
authored
Merge pull request #713 from handrews/unknown-targets
Note undefined behavior with unknown $ref targets
2 parents ff48a42 + e741b8e commit 5093e5c

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

jsonschema-core.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,41 @@
15401540
</t>
15411541
</section>
15421542

1543+
<section title="References to Possible Non-Schemas">
1544+
<t>
1545+
Subschema objects (or booleans) are recognized by their use with known
1546+
applicator keywords. These keywords may be the standard applicators
1547+
from this document, or extension keywords from a known vocabulary, or
1548+
implementation-specific custom keywords.
1549+
</t>
1550+
<t>
1551+
Multi-level structures of unknown keywords are capable of introducing
1552+
nested subschemas, which would be subject to the processing rules for
1553+
"$id". Therefore, having a reference target in such an unrecognized
1554+
structure cannot be reliably implemented, and the resulting behavior
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>
1568+
</t>
1569+
<t>
1570+
Note that single-level custom keywords with identical syntax and
1571+
semantics to "$defs" do not allow for any intervening "$id" keywords,
1572+
and therefore will behave correctly under implementations that attempt
1573+
to use any reference target as a schema. However, this behavior is
1574+
implementation-specific and MUST NOT be relied upon for interoperability.
1575+
</t>
1576+
</section>
1577+
15431578
<section title="Loading a referenced schema">
15441579
<t>
15451580
The use of URIs to identify remote schemas does not necessarily mean anything is downloaded,

jsonschema-validation.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,8 +887,9 @@
887887
</artwork>
888888
<postamble>
889889
Instances described by this schema should be strings containing HTML, using
890-
whatever character set the JSON string was decoded into (default is
891-
Unicode).
890+
whatever character set the JSON string was decoded into. Per section 8.1 of
891+
<xref target="RFC8259">RFC 8259</xref>, outside of an entirely closed
892+
system, this MUST be UTF-8.
892893
</postamble>
893894
</figure>
894895

0 commit comments

Comments
 (0)