Skip to content

Commit 64704c1

Browse files
committed
Usage: add a section about "Security model".
1 parent e8f72d6 commit 64704c1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

usage.html

+11
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,17 @@ <h2>Parsing a style sheet</h2>
319319
<pre class="code"><code class="language-java">sheet.getCssRules().clear();
320320
</code></pre>
321321
</div>
322+
<div class="tema" id="securitymodel">
323+
<h2>Security model</h2>
324+
<p>Linked style sheets accessed through DOM are automatically fetched, but if your <code>LINK</code> element or <code>@import</code>
325+
rule point to a <code>file:</code> or <code>jar:</code> URL, the style sheet won't be retrieved unless you set the <code>documentURI</code>
326+
of your document to one of those URIs.</p>
327+
<p>A similar reasoning applies to the contents of the <code>href</code> attribute in the <code>BASE</code> element. If you load a
328+
document that contains a <code>&lt;base href="file:///some/path"&gt;</code>, that won't take effect until you call <code>setDocumentURI()</code>
329+
to set a URI with a <code>file:</code> or <code>jar:</code> scheme. This prevents denial of service attacks that could cause thread starvation
330+
(for example by linking to <code>file:///dev/zero</code>) or deplete the pool of entropy in your server (<code>file:///dev/random</code>),
331+
as well as <code>jar:</code> decompression bombs.</p>
332+
</div>
322333
<div class="tema" id="legacycompat">
323334
<h2>Compatibility with legacy browsers</h2>
324335
<p>Today's style sheets often contain non-conformant styles that target specific versions of old web browsers, like Internet Explorer.

0 commit comments

Comments
 (0)