You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #90 from project-codeguard/develop
Updated codeguard-1-crypto-algorithms.md rule to include guidance on post quantum cryptography
Updated ClaudeCodeSkills to a more generic class AgentSkills after Agent Skills are adopted as a standard.
Fixed codeguard-1-digital-certificates.md so that the agent does not assume certificate parsing capabilities.
Updated codeguard-0-input-validation-injection.md to include guidance on SOQL along with SQL.
Added documentation for generating custom rule files.
Copy file name to clipboardExpand all lines: skills/software-security/rules/codeguard-0-input-validation-injection.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
---
2
-
description: Input validation and injection defense (SQL/LDAP/OS), parameterization, prototype pollution
2
+
description: Input validation and injection defense (SQL/SOQL/LDAP/OS), parameterization, prototype pollution
3
3
languages:
4
+
- apex
4
5
- c
5
6
- go
6
7
- html
@@ -49,6 +50,16 @@ pstmt.setString( 1, custname);
49
50
ResultSet results = pstmt.executeQuery( );
50
51
```
51
52
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
+
52
63
### LDAP Injection Prevention
53
64
- Always apply context‑appropriate escaping:
54
65
- DN escaping for `\ # + < > , ; " =` and leading/trailing spaces
Reason: These are cryptographically broken and vulnerable to collision or man-in-the-middle attacks.
21
20
22
-
The following algorithms are not outright broken, but have known weaknesses, or are considered obsolete. **NEVER** generate or use code with these algorithms.
23
-
Examples:
21
+
## 2. Deprecated (Legacy/Weak) Algorithms
24
22
25
-
* Hash: `SHA-1`
26
-
* Symmetric: `AES-CBC`, `AES-ECB`
27
-
* Signature: RSA with `PKCS#1 v1.5` padding
28
-
* Key Exchange: DHE with weak/common primes
23
+
The following algorithms have known weaknesses or are considered obsolete. Avoid in new designs and prioritize migration.
29
24
25
+
* Hash: `SHA-1`
26
+
* Symmetric: `AES-CBC`, `AES-ECB`
27
+
* Signature: RSA with `PKCS#1 v1.5` padding
28
+
* Key Exchange: DHE with weak/common primes
30
29
31
-
## Deprecated SSL/Crypto APIs - FORBIDDEN
32
-
NEVER use these deprecated functions. Use the replacement APIs listed below:
30
+
## 3. Recommended & Post-Quantum Ready Algorithms
33
31
34
-
### Symmetric Encryption (AES)
32
+
Implement these modern, secure algorithms to ensure resistance against both classical and quantum threats.
0 commit comments