Skip to content

Commit a36456b

Browse files
Small wording wording change and regenerated SKILL.md with apex language mapping
1 parent 92920fc commit a36456b

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

skills/software-security/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ When writing or reviewing code:
2929

3030
| Language | Rule Files to Apply |
3131
|----------|---------------------|
32+
| apex | codeguard-0-input-validation-injection.md |
3233
| c | codeguard-0-additional-cryptography.md, codeguard-0-api-web-services.md, codeguard-0-authentication-mfa.md, codeguard-0-authorization-access-control.md, codeguard-0-client-side-web-security.md, codeguard-0-data-storage.md, codeguard-0-file-handling-and-uploads.md, codeguard-0-framework-and-languages.md, codeguard-0-iac-security.md, codeguard-0-input-validation-injection.md, codeguard-0-logging.md, codeguard-0-safe-c-functions.md, codeguard-0-session-management-and-cookies.md, codeguard-0-xml-and-serialization.md |
3334
| cpp | codeguard-0-safe-c-functions.md |
3435
| d | codeguard-0-iac-security.md |

skills/software-security/rules/codeguard-0-input-validation-injection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ SOQL and SOSL are query/search languages (no SQL-style DDL/DML). Data changes ar
5757
- Primary risk: data exfiltration by bypassing intended query filters/business logic; impact is amplified when Apex runs with elevated access (system mode) or when CRUD/FLS aren't enforced.
5858
- Second-order risk (conditional): if queried records are passed to DML, injection can broaden the record set and cause unintended mass updates/deletes.
5959
- Prefer static SOQL/SOSL with bind variables: `[SELECT Id FROM Account WHERE Name = :userInput]` or `FIND :term`.
60-
- For dynamic SOQL, use `Database.queryWithBinds()`; for dynamic SOSL, use `Search.query()`. Allowlist any dynamic identifiers. If concatenation is unavoidable, escape string values with `String.escapeSingleQuotes()`.
60+
- For dynamic SOQL, use `Database.queryWithBinds()`; for dynamic SOSL, use `Search.query()`. Allow‑list any dynamic identifiers. If concatenation is unavoidable, escape string values with `String.escapeSingleQuotes()`.
6161
- Enforce CRUD/FLS with `WITH USER_MODE` or `WITH SECURITY_ENFORCED` (don't combine both). Enforce record sharing with `with sharing` or user-mode operations. Use `Security.stripInaccessible()` before DML.
6262

6363
### LDAP Injection Prevention

sources/core/codeguard-0-input-validation-injection.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
description: Input validation and injection defense (SQL/LDAP/OS), parameterization,
3-
prototype pollution
2+
description: Input validation and injection defense (SQL/SOQL/LDAP/OS), parameterization, prototype pollution
43
languages:
4+
- apex
55
- c
66
- go
77
- html
@@ -50,6 +50,16 @@ pstmt.setString( 1, custname);
5050
ResultSet results = pstmt.executeQuery( );
5151
```
5252

53+
### SOQL/SOSL Injection (Salesforce)
54+
55+
SOQL and SOSL are query/search languages (no SQL-style DDL/DML). Data changes are performed via Apex DML or Database methods. Note: SOQL can lock rows via `FOR UPDATE`.
56+
57+
- Primary risk: data exfiltration by bypassing intended query filters/business logic; impact is amplified when Apex runs with elevated access (system mode) or when CRUD/FLS aren't enforced.
58+
- Second-order risk (conditional): if queried records are passed to DML, injection can broaden the record set and cause unintended mass updates/deletes.
59+
- Prefer static SOQL/SOSL with bind variables: `[SELECT Id FROM Account WHERE Name = :userInput]` or `FIND :term`.
60+
- For dynamic SOQL, use `Database.queryWithBinds()`; for dynamic SOSL, use `Search.query()`. Allow‑list any dynamic identifiers. If concatenation is unavoidable, escape string values with `String.escapeSingleQuotes()`.
61+
- Enforce CRUD/FLS with `WITH USER_MODE` or `WITH SECURITY_ENFORCED` (don't combine both). Enforce record sharing with `with sharing` or user-mode operations. Use `Security.stripInaccessible()` before DML.
62+
5363
### LDAP Injection Prevention
5464
- Always apply context‑appropriate escaping:
5565
- DN escaping for `\ # + < > , ; " =` and leading/trailing spaces

0 commit comments

Comments
 (0)