This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org
Difference between revisions of "OWASP Java Encoder Project"
From OWASP
(→OWASP Java Encoder Project) |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts (primarily JavaScript) are injected into otherwise trusted web sites. You can read more about Cross Site Scripting here: [[Cross-site_Scripting_%28XSS%29]]. One of the primary defenses to stop Cross Site Scripting is a technique called <i>Contextual Output Encoding</i>. <b>WARNING</b>: Please note that XSS prevention requires other defensive strategies besides encoding! For more information, please read about Cross Site Scripting prevention here: [[XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet]]. | Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts (primarily JavaScript) are injected into otherwise trusted web sites. You can read more about Cross Site Scripting here: [[Cross-site_Scripting_%28XSS%29]]. One of the primary defenses to stop Cross Site Scripting is a technique called <i>Contextual Output Encoding</i>. <b>WARNING</b>: Please note that XSS prevention requires other defensive strategies besides encoding! For more information, please read about Cross Site Scripting prevention here: [[XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet]]. | ||
− | As of | + | As of September 16, 2018 there are no security issues submitted against this project! [https://github.com/OWASP/owasp-java-encoder/issues https://github.com/OWASP/owasp-java-encoder/issues]. We actively track project issues and seek to remediate any issues that arise. The project owners feel this project is stable and ready for production use and are seeking project status promotion. |
==Introduction== | ==Introduction== | ||
Line 18: | Line 18: | ||
==Quick Overview== | ==Quick Overview== | ||
− | The OWASP Java Encoder library is intended for quick contextual encoding with very little overhead, either in performance or usage. To get started, simply add the encoder-1.2. | + | The OWASP Java Encoder library is intended for quick contextual encoding with very little overhead, either in performance or usage. To get started, simply add the encoder-1.2.2.jar, import org.owasp.encoder.Encode and start encoding. |
− | Please look at the [http://search.maven.org/remotecontent?filepath=org/owasp/encoder/encoder/1.2. | + | Please look at the [http://search.maven.org/remotecontent?filepath=org/owasp/encoder/encoder/1.2.2/encoder-1.2.2-javadoc.jar javadoc for Encode] to see the variety of contexts for which you can encode. Tag libraries and JSP EL functions can be found in the encoder-jsp-1.2.2.jar. |
Happy Encoding! | Happy Encoding! | ||
Line 66: | Line 66: | ||
== Quick Download == | == Quick Download == | ||
− | * [https://search.maven.org/remotecontent?filepath=org/owasp/encoder/encoder/1.2. | + | * [https://search.maven.org/remotecontent?filepath=org/owasp/encoder/encoder/1.2.2/encoder-1.2.2.jar encoder-1.2.2.jar] |
− | * [https://search.maven.org/remotecontent?filepath=org/owasp/encoder/encoder-jsp/1.2. | + | * [https://search.maven.org/remotecontent?filepath=org/owasp/encoder/encoder-jsp/1.2.2/encoder-jsp-1.2.2.jar encoder-jsp-1.2.2.jar] |
== News and Events == | == News and Events == | ||
+ | * [14 September 2018] 1.2.2 Released! | ||
* [19 February 2017] 1.2.1 Released! | * [19 February 2017] 1.2.1 Released! | ||
* [11 June 2016] No reported issues and library use is strong! | * [11 June 2016] No reported issues and library use is strong! | ||
Line 200: | Line 201: | ||
= Deploy the Java Encoder Project = | = Deploy the Java Encoder Project = | ||
− | The OWASP Java Encoder version 1.2. | + | The OWASP Java Encoder version 1.2.2 is now available in central! |
[http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.owasp.encoder%22 OWASP Encoder at Maven Central]. | [http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.owasp.encoder%22 OWASP Encoder at Maven Central]. | ||
== Core == | == Core == | ||
− | Direct Download: [http://search.maven.org/remotecontent?filepath=org/owasp/encoder/encoder/1.2. | + | Direct Download: [http://search.maven.org/remotecontent?filepath=org/owasp/encoder/encoder/1.2.2/encoder-1.2.2.jar encoder-1.2.2.jar] |
=== Maven === | === Maven === | ||
<dependency> | <dependency> | ||
<groupId>org.owasp.encoder</groupId> | <groupId>org.owasp.encoder</groupId> | ||
<artifactId>encoder</artifactId> | <artifactId>encoder</artifactId> | ||
− | <version>1.2. | + | <version>1.2.2</version> |
</dependency> | </dependency> | ||
== JSP Tag Library == | == JSP Tag Library == | ||
− | Direct Download: [https://search.maven.org/remotecontent?filepath=org/owasp/encoder/encoder-jsp/1.2. | + | Direct Download: [https://search.maven.org/remotecontent?filepath=org/owasp/encoder/encoder-jsp/1.2.2/encoder-jsp-1.2.2.jar encoder-jsp-1.2.2.jar] |
=== Maven === | === Maven === | ||
<dependency> | <dependency> | ||
<groupId>org.owasp.encoder</groupId> | <groupId>org.owasp.encoder</groupId> | ||
<artifactId>encoder-jsp</artifactId> | <artifactId>encoder-jsp</artifactId> | ||
− | <version>1.2. | + | <version>1.2.2</version> |
</dependency> | </dependency> | ||
Line 285: | Line 286: | ||
# Filter out the accent grave from any user input | # Filter out the accent grave from any user input | ||
# Clean up grave accents when using an innerHTML copy | # Clean up grave accents when using an innerHTML copy | ||
+ | |||
+ | == OWASP Java Encoder Library Related Changes == | ||
+ | |||
+ | The OWASP Java Encoder Library at its core is intended to be a XSS safe _encoding_ library. The grave accent is a legitimate and frequently used character, that cannot be encoded to avoid this bug in unpatched versions of IE. With enough user feedback, we may update the library to include one of the following options: (1) alternate, drop-in build that filters grave accents, with unchanged API, (2) new filtering methods. | ||
= Encoding and Template Literals = | = Encoding and Template Literals = | ||
− | Several users of the Java Encoder have asked | + | Several users of the Java Encoder have asked how to properly use the OWASP Java Encoder in combination with template literals. |
The best way to encode template literal variables is to first escape the untrusted data in a JavaScript variable and then place that variable in the template literal. | The best way to encode template literal variables is to first escape the untrusted data in a JavaScript variable and then place that variable in the template literal. | ||
Line 298: | Line 303: | ||
`Hello ${"<%= Encode.forJavaScript(user) $>"}, here is your total ${total}` | `Hello ${"<%= Encode.forJavaScript(user) $>"}, here is your total ${total}` | ||
− | |||
− | |||
− | |||
− | |||
= Roadmap = | = Roadmap = |