...
For example, an application's strategy for avoiding Cross Site Scripting (XSS) vulnerabilities may include forbidding <script>
tags in inputs. Such black-listing mechanisms are a useful part of a security strategy, even though they are insufficient for complete input validation and sanitization. When implemented, this form of validation must be performed only after normalizing the input.
Character information in Java 1.6 is based on the Unicode Standard, version 4.0. Character information in Java 1.6 is based on the Unicode Standard, version 6.0.0.
Wiki Markup |
---|
According to the Unicode Standard \[[Davis 2008|AA. Bibliography#Davis 08]\], annex #15, Unicode Normalization Forms |
When implementations keep strings in a normalized form, they can be assured that equivalent strings have a unique binary representation.
Normalization Forms KC and KD must not be blindly applied to arbitrary text. Because they erase many formatting distinctions, they will prevent round-trip conversion to and from many legacy character sets, and unless supplanted by formatting markup, they may remove distinctions that are important to the semantics of the text. It is best to think of these Normalization Forms as being like uppercase or lowercase mappings: useful in certain contexts for identifying core meanings, but also performing modifications to the text that may not always be appropriate. They can be applied more freely to domains with restricted character sets ...
The Frequently, the most suitable normalization form for performing input validation on arbitrarily-encoded strings is KC (NFKC), because normalizing to KC transforms the input into an equivalent canonical form that can be safely compared with the required input form.
Another domain where normalization is required before validation is in sanitizing untrusted path names in a file system. This is addressed by rule IDS21-J. Canonicalize path names before validating them.
Noncompliant Code Example
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f812653fce63a80b-7a0f6a00-4e6f454b-9803b4c7-924bc70daa6e3ae382ccf1c2"><ac:plain-text-body><![CDATA[ | [[MITRE 2009 | AA. Bibliography#MITRE 09]] | [CWE ID 289 | http://cwe.mitre.org/data/definitions/289.html] "Authentication Bypass by Alternate Name" ]]></ac:plain-text-body></ac:structured-macro> |
| CWE ID 180 "Incorrect Behavior Order: Validate Before Canonicalize" |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3a236ab151ae48f7-2ea83258-48b64716-8b1498a5-e201c7429d79e1b34d9a9f5c"><ac:plain-text-body><![CDATA[ | [[API 2006 | AA. Bibliography#API 06]] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4ebc4e83230dc9e2-5d375625-41d3490c-998e86d9-e2c8202f28c1eb46b1ddace1"><ac:plain-text-body><![CDATA[ | [[Davis 2008 | AA. Bibliography#Davis 08]] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e3ef2e8cc7f51fdf-8a216d24-46164368-91e3b28a-2b95e826bde0497b1a42fb1f"><ac:plain-text-body><![CDATA[ | [[Weber 2009 | AA. Bibliography#Weber 09]] | ]]></ac:plain-text-body></ac:structured-macro> |
...