Skip to content

Commit 19e59d1

Browse files
Tweaks so markdown is unambiguous
Signed-off-by: David A. Wheeler <[email protected]>
1 parent 044f610 commit 19e59d1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

secure_software_development_fundamentals.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,7 @@ imagine that an attacker manages to provide
25992599
the JavaScript *object* `{password = 1}` as the password parameter
26002600
(this is not just a string, but an actual JavaScript object).
26012601
Now imagine that this object is used in the SQL query
2602-
<tt>SELECT * FROM accounts WHERE username = ? AND password = ?</tt>
2602+
<tt>SELECT &#42; FROM accounts WHERE username = ? AND password = ?</tt>
26032603
(note that this is parameterized).
26042604
The library will internally expand the expression after `AND`
26052605
into <tt>password = &#96;password&#96; = 1</tt> because the library does simple
@@ -3213,7 +3213,7 @@ In that case, where possible, use libraries *already designed* to allow only wha
32133213

32143214
We have focused on escaping HTML, because that is the biggest problem in web applications. But HTML can embed other kinds of data, and of those, perhaps the most common are URLs.
32153215

3216-
Embedded URLs must also be escaped, and the rules for escaping URLs are different. The URL syntax is generally **scheme&#58;[//authority]path[?query][#fragment]**. For example, in the URL **<https://www.linuxfoundation.org/about/>**, the scheme is “**https**”, authority “<b>www.linuxfoundation.org</b>”, path is “**/about/**”, and this example has no query or fragment part. Sometimes you need special characters in the path, query, or fragment. The conventional way to escape those parts of the URLs is to first ensure the data is encoded with UTF-8, and escape as “**%hh**” (where **hh** is the hexadecimal representation) all bytes except for “safe” bytes, which are typically **A-Z**, **a-z**, **0-9**, “**.**”, “**-**”, “**&#42;**”, and “**&#95;**”. The Java routine **java.net.URLEncoder.encode()** turns all spaces into “**+**” instead of “**%20**”; both the “**+**” and “**%20**” conventions are in wide use.
3216+
Embedded URLs must also be escaped, and the rules for escaping URLs are different. The URL syntax is generally **scheme&#58;[//authority]path[?query][&#35;fragment]**. For example, in the URL **<https://www.linuxfoundation.org/about/>**, the scheme is “**https**”, authority “<b>www.linuxfoundation.org</b>”, path is “**/about/**”, and this example has no query or fragment part. Sometimes you need special characters in the path, query, or fragment. The conventional way to escape those parts of the URLs is to first ensure the data is encoded with UTF-8, and escape as “**%hh**” (where **hh** is the hexadecimal representation) all bytes except for “safe” bytes, which are typically **A-Z**, **a-z**, **0-9**, “**.**”, “**-**”, “**&#42;**”, and “**&#95;**”. The Java routine **java.net.URLEncoder.encode()** turns all spaces into “**+**” instead of “**%20**”; both the “**+**” and “**%20**” conventions are in wide use.
32173217

32183218
#### XSS Alternatives
32193219

@@ -3503,7 +3503,7 @@ This is true! Yes, this is a weird and subtle point. There is reason to hope tha
35033503

35043504
A Uniform Resource Locator (URL) is a way to refer to a specific web resource by location. Technically, a URL is a specific type of Uniform Resource Identifier (URI), but for our purposes we will use the terms interchangeably. As specified in [IETF RFC 3986](https://tools.ietf.org/html/rfc3986), a generic URI has this syntax:
35053505

3506-
**scheme:[//authority]path[?query][#fragment]**
3506+
**scheme:[//authority]path[?query][&#35;fragment]**
35073507

35083508
And **authority** has this syntax:
35093509

0 commit comments

Comments
 (0)