Skip to content

Commit 1ed71e1

Browse files
author
Stephan Brandauer
committed
apply docreview feedback
1 parent 2278e7f commit 1ed71e1

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

javascript/ql/src/Security/CWE-830/FunctionalityFromUntrustedSource.qhelp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,43 @@
66
<p>
77
Including a resource from an untrusted source or using an untrusted channel may
88
allow an attacker to include arbitrary code in the response.
9-
When including an external resource (eg., a <code>script</code> element or an
9+
When including an external resource (for example, a <code>script</code> element or an
1010
<code>iframe</code> element) on a page, it is important to ensure that the received
1111
data is not malicious.
1212
</p>
1313

1414
<p>
15-
When including external resources, it is possible to verify that the origin (the server
16-
that responds to the request) is the intended one by using an <code>https</code> URL.
15+
When including external resources, it is possible to verify that the responding server
16+
is the intended one by using an <code>https</code> URL.
1717
This prevents a MITM (man-in-the-middle) attack where an attacker might have been able
1818
to spoof a server response.
1919
</p>
2020

2121
<p>
22-
Even when <code>https</code> is used, an attacker might still compromise the origin server.
23-
When using a <code>script</code> element, checking for <em>subresource integrity</em>
24-
(checking the contents of the data received by supplying a cryptographic digest of the
25-
expected sources to the script element) is possible. The script will only load sources
26-
that match the digest and an attacker will be unable to modify the script even when the
27-
server is compromised.
22+
Even when <code>https</code> is used, an attacker might still compromise the server.
23+
When you use a <code>script</code> element, you can check for subresource integrity -
24+
that is, you can check the contents of the data received by supplying a cryptographic
25+
digest of the expected sources to the <code>script</code> element. The script will only
26+
load sources that match the digest and an attacker will be unable to modify the script
27+
even when the server is compromised.
2828
</p>
2929

3030
<p>
3131
Subresource integrity checking is commonly recommended when importing a fixed version of
32-
a library, eg., from a CDN (content-delivery network). Then, the fixed digest of that
33-
version of the library can easily be added to the <code>script</code> element's
32+
a library - for example, from a CDN (content-delivery network). Then, the fixed digest
33+
of that version of the library can easily be added to the <code>script</code> element's
3434
<code>integrity</code> attribute.
3535
</p>
3636
</overview>
3737

3838
<recommendation>
3939
<p>
40-
When an <code>iframe</code> element is used to embed a page, it is important to use a
40+
When an <code>iframe</code> element is used to embed a page, it is important to use an
4141
<code>https</code> URL.
4242
</p>
4343

4444
<p>
45-
When using a <code>script</code> element to load a script, it is important to use a
45+
When using a <code>script</code> element to load a script, it is important to use an
4646
<code>https</code> URL and to consider checking subresource integrity.
4747
</p>
4848
</recommendation>

javascript/ql/src/Security/CWE-830/FunctionalityFromUntrustedSource.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @name Inclusion of functionality from untrusted source.
2+
* @name Inclusion of functionality from an untrusted source
33
* @description Including functionality from an untrusted source may allow
44
* an attacker to control the functionality and execute arbitrary code.
55
* @kind problem

javascript/ql/src/change-notes/2022-02-14-functionality-from-untrusted-source.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
category: newQuery
33
---
44
* A new query, `js/functionality-from-untrusted-source`, has been added to the query suite. It finds DOM elements
5-
that load functionality from untrusted sources, like a `script`- or `iframe`-element using http-links.
5+
that load functionality from untrusted sources, like `script` or `iframe` elements using `http` links.
66
The query is run by default.

0 commit comments

Comments
 (0)