Skip to content

Commit 595bb8c

Browse files
Clarify some statements
These attempt to resolve comments from @epicfaace Signed-off-by: David A. Wheeler <[email protected]>
1 parent dd9aba3 commit 595bb8c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

secure_software_development_fundamentals.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,11 +2382,11 @@ For databases, there are well-known solutions that are far easier to use securel
23822382

23832383
SQL injection vulnerabilities are one of the most common and devastating vulnerabilities, especially in web applications. They are also easy to counter, once you know how to do it.
23842384

2385-
*Parameterized statements*, aka *parameterized queries*, are perhaps the best way to counter SQL injection attacks if you are directly creating SQL commands that need to be secure. Parameterized statements let you identify placeholders (often a “**?**”) for data that needs to be escaped. A pre-existing library that you call then escapes the data properly for that specific implementation. The exact syntax for placeholders depends on the library and/or database you're using.
2385+
*Parameterized statements*, aka *parameterized queries*, are perhaps the best way to counter SQL injection attacks if you are directly creating SQL commands that need to be secure. Parameterized statements are statements that let you identify placeholders (often a “**?**”) for data that needs to be escaped. A pre-existing library that you call then takes those parameters and in effect escapes the data properly for that specific implementation. The exact syntax for placeholders depends on the library and/or database you're using.
23862386

2387-
For our purposes, a *prepared statement* prepares the statement with the database system ahead-of-time so that a later request can be executed more efficiently. Preparing a statement with a database ahead-of-time can help performance if the statement will be executed multiple times. Prepared statement APIs generally include support for parameterized statements, and many people (and APIs) use the terms "prepared statement" and "parameterized statement" as synonyms.
2387+
For our purposes, a *prepared statement* compiles the statement with the database system ahead-of-time so that a later request with specific data can be executed more efficiently. Preparing a statement with a database ahead-of-time can improve performance if the statement will be executed multiple times. Prepared statement APIs generally include support for parameterized statements, and many people (and APIs) use the terms "prepared statement" and "parameterized statement" as synonyms.
23882388

2389-
For security, the key is to use an API with parameterized statements (including a prepared statement API) and ensure that every untrusted input is sent as a parameter though it. Make sure that you do *not* normally include untrusted input by concatenating it as a string into a request.
2389+
For security, the key is to use an API with parameterized statements (including a prepared statement API) and ensure that every untrusted input is sent as a separate parameter. Make sure that you do *not* normally include untrusted input by concatenating untrusted data as a string into a request.
23902390

23912391
##### Advantages of parameterized/prepared statements
23922392

@@ -2507,11 +2507,11 @@ in stored procedures, see your library's documentation, the
25072507
[OWASP Query Parameterization Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Query_Parameterization_Cheat_Sheet.html#stored-procedure-examples), and the
25082508
[OWASP SQL Injection Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html)
25092509

2510-
##### When Parameterized Interfaces Won't Work
2510+
##### When Parameterized Statements Won't Work
25112511

25122512
In some situations parameterized statements (including
25132513
prepared statements) will *not* work.
2514-
Many parameterized interface APIs only allow replacing SQL values, so
2514+
Many parameterized statement APIs only allow replacing SQL values, so
25152515
they do not allow varying information such as the names of tables, the names
25162516
of columns, or the sort order direction.
25172517

0 commit comments

Comments
 (0)