Skip to content

Commit def7b8e

Browse files
fix: remove apex semgrep rules (#135)
Remove Semgrep Apex rules from the template. Apex rules require the Pro version of semgrep, which CLI does not support right now.
1 parent 3e978a2 commit def7b8e

File tree

3 files changed

+0
-911
lines changed

3 files changed

+0
-911
lines changed

integration-tests/init-with-token/expected/tools-configs/semgrep.yaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,4 @@
11
rules:
2-
- id: apex.lang.security.ncino.endpoints.namedcredentialsconstantmatch.named-credentials-constant-match
3-
languages:
4-
- apex
5-
message: Named Credentials (and callout endpoints) should be used instead of hard-coding credentials. 1. Hard-coded credentials are hard to maintain when mixed in with application code. 2. It is particularly hard to update hard-coded credentials when they are used amongst different classes. 3. Granting a developer access to the codebase means granting knowledge of credentials, and thus keeping a two-level access is not possible. 4. Using different credentials for different environments is troublesome and error-prone.
6-
metadata:
7-
category: security
8-
confidence: HIGH
9-
cwe:
10-
- 'CWE-540: Inclusion of Sensitive Information in Source Code'
11-
impact: HIGH
12-
likelihood: LOW
13-
references:
14-
- https://cwe.mitre.org/data/definitions/540.html
15-
subcategory:
16-
- vuln
17-
technology:
18-
- salesforce
19-
min-version: 1.44.0
20-
mode: taint
21-
pattern-sinks:
22-
- patterns:
23-
- pattern: req.setHeader($X, ...);
24-
- focus-metavariable: $X
25-
pattern-sources:
26-
- pattern: '...String $X = ''Authorization'';'
27-
severity: ERROR
282
- id: clojure.lang.security.use-of-md5.use-of-md5
293
languages:
304
- clojure

integration-tests/init-without-token/expected/tools-configs/semgrep.yaml

Lines changed: 0 additions & 275 deletions
Original file line numberDiff line numberDiff line change
@@ -1,279 +1,4 @@
11
rules:
2-
- id: apex.lang.security.ncino.dml.apexcsrfconstructor.apex-csrf-constructor
3-
languages:
4-
- apex
5-
message: 'Having DML operations in Apex class constructor or initializers can have unexpected side effects: By just accessing a page, the DML statements would be executed and the database would be modified. Just querying the database is permitted.'
6-
metadata:
7-
category: security
8-
confidence: HIGH
9-
cwe:
10-
- 'CWE-352: Cross-Site Request Forgery (CSRF)'
11-
cwe2020-top25': true
12-
cwe2021-top25': true
13-
cwe2022-top25': true
14-
impact: HIGH
15-
likelihood: MEDIUM
16-
owasp:
17-
- A01:2021 - Broken Access Control
18-
references:
19-
- https://cwe.mitre.org/data/definitions/352.html
20-
subcategory:
21-
- vuln
22-
technology:
23-
- salesforce
24-
min-version: 1.44.0
25-
paths:
26-
exclude:
27-
- '*Test*'
28-
- '*test*'
29-
patterns:
30-
- pattern-either:
31-
- pattern-inside: public class $CLASSNAME {...}
32-
- pattern-inside: private class $CLASSNAME {...}
33-
- pattern-inside: public $SOME sharing class $CLASSNAME {...}
34-
- pattern-inside: private $SOME sharing class $CLASSNAME {...}
35-
- pattern-either:
36-
- pattern-inside: public $CLASSNAME() {...}
37-
- pattern-inside: private $CLASSNAME() {...}
38-
- pattern-either:
39-
- pattern: |
40-
insert $DATA;
41-
- pattern: |
42-
update $DATA;
43-
- pattern: |
44-
upsert $DATA;
45-
- pattern: |
46-
delete $DATA;
47-
severity: ERROR
48-
- id: apex.lang.security.ncino.dml.apexcsrfstaticconstructor.apex-csrf-static-constructor
49-
languages:
50-
- generic
51-
message: 'Having DML operations in Apex class constructor or initializers can have unexpected side effects: By just accessing a page, the DML statements would be executed and the database would be modified. Just querying the database is permitted.'
52-
metadata:
53-
category: security
54-
confidence: HIGH
55-
cwe:
56-
- 'CWE-352: Cross-Site Request Forgery (CSRF)'
57-
cwe2020-top25': true
58-
cwe2021-top25': true
59-
cwe2022-top25': true
60-
impact: HIGH
61-
likelihood: MEDIUM
62-
owasp:
63-
- A01:2021 - Broken Access Control
64-
references:
65-
- https://cwe.mitre.org/data/definitions/352.html
66-
subcategory:
67-
- vuln
68-
technology:
69-
- salesforce
70-
min-version: 1.44.0
71-
paths:
72-
exclude:
73-
- '*Test*'
74-
- '*test*'
75-
patterns:
76-
- pattern-inside: static {...}
77-
- pattern-either:
78-
- pattern: |
79-
insert $DATA;
80-
- pattern: |
81-
update $DATA;
82-
- pattern: |
83-
upsert $DATA;
84-
- pattern: |
85-
delete $DATA;
86-
severity: ERROR
87-
- id: apex.lang.security.ncino.endpoints.insecurehttprequest.insecure-http-request
88-
languages:
89-
- apex
90-
message: The software transmits sensitive or security-critical data in cleartext in a communication channel that can be sniffed by unauthorized actors.
91-
metadata:
92-
category: security
93-
confidence: MEDIUM
94-
cwe:
95-
- 'CWE-319: Cleartext Transmission of Sensitive Information'
96-
impact: MEDIUM
97-
likelihood: LOW
98-
references:
99-
- https://cwe.mitre.org/data/definitions/319.html
100-
subcategory:
101-
- vuln
102-
technology:
103-
- salesforce
104-
min-version: 1.44.0
105-
paths:
106-
exclude:
107-
- '*Test*'
108-
- '*test*'
109-
patterns:
110-
- pattern-regex: http[:][/][/]
111-
- pattern-not-regex: //.*
112-
- pattern-not-regex: '[*].*'
113-
severity: ERROR
114-
- id: apex.lang.security.ncino.endpoints.namedcredentialsconstantmatch.named-credentials-constant-match
115-
languages:
116-
- apex
117-
message: Named Credentials (and callout endpoints) should be used instead of hard-coding credentials. 1. Hard-coded credentials are hard to maintain when mixed in with application code. 2. It is particularly hard to update hard-coded credentials when they are used amongst different classes. 3. Granting a developer access to the codebase means granting knowledge of credentials, and thus keeping a two-level access is not possible. 4. Using different credentials for different environments is troublesome and error-prone.
118-
metadata:
119-
category: security
120-
confidence: HIGH
121-
cwe:
122-
- 'CWE-540: Inclusion of Sensitive Information in Source Code'
123-
impact: HIGH
124-
likelihood: LOW
125-
references:
126-
- https://cwe.mitre.org/data/definitions/540.html
127-
subcategory:
128-
- vuln
129-
technology:
130-
- salesforce
131-
min-version: 1.44.0
132-
mode: taint
133-
pattern-sinks:
134-
- patterns:
135-
- pattern: req.setHeader($X, ...);
136-
- focus-metavariable: $X
137-
pattern-sources:
138-
- pattern: '...String $X = ''Authorization'';'
139-
severity: ERROR
140-
- id: apex.lang.security.ncino.endpoints.namedcredentialsstringmatch.named-credentials-string-match
141-
languages:
142-
- apex
143-
message: Named Credentials (and callout endpoints) should be used instead of hard-coding credentials. 1. Hard-coded credentials are hard to maintain when mixed in with application code. 2. It is particularly hard to update hard-coded credentials when they are used amongst different classes. 3. Granting a developer access to the codebase means granting knowledge of credentials, and thus keeping a two-level access is not possible. 4. Using different credentials for different environments is troublesome and error-prone.
144-
metadata:
145-
category: security
146-
confidence: HIGH
147-
cwe:
148-
- 'CWE-540: Inclusion of Sensitive Information in Source Code'
149-
impact: HIGH
150-
likelihood: LOW
151-
references:
152-
- https://cwe.mitre.org/data/definitions/540.html
153-
subcategory:
154-
- vuln
155-
technology:
156-
- salesforce
157-
min-version: 1.44.0
158-
pattern: $REQUEST.setHeader('Authorization', $AUTHSTRING);
159-
severity: ERROR
160-
- id: apex.lang.security.ncino.injection.apexsoqlinjectionfromunescapedurlparam.soql-injection-unescaped-url-param
161-
languages:
162-
- apex
163-
message: If a dynamic query must be used,leverage nFORCE Query Builder. In other programming languages, the related flaw is known as SQL injection. Apex doesn't use SQL, but uses its own database query language, SOQL. SOQL is much simpler and more limited in functionality than SQL. The risks are much lower for SOQL injection than for SQL injection, but the attacks are nearly identical to traditional SQL injection. SQL/SOQL injection takes user-supplied input and uses those values in a dynamic SOQL query. If the input isn't validated, it can include SOQL commands that effectively modify the SOQL statement and trick the application into performing unintended commands.
164-
metadata:
165-
category: security
166-
confidence: HIGH
167-
cwe:
168-
- 'CWE-943: Improper Neutralization of Special Elements in Data Query Logic'
169-
impact: HIGH
170-
likelihood: HIGH
171-
owasp:
172-
- A03:2021 - Injection
173-
references:
174-
- https://cwe.mitre.org/data/definitions/943.html
175-
subcategory:
176-
- vuln
177-
technology:
178-
- salesforce
179-
min-version: 1.44.0
180-
mode: taint
181-
pattern-sanitizers:
182-
- pattern: String.escapeSingleQuotes(...)
183-
pattern-sinks:
184-
- patterns:
185-
- pattern: Database.query($SINK,...);
186-
- focus-metavariable: $SINK
187-
pattern-sources:
188-
- by-side-effect: true
189-
pattern: ApexPage.getCurrentPage().getParameters.get($URLPARAM);
190-
severity: ERROR
191-
- id: apex.lang.security.ncino.injection.apexsoqlinjectionunescapedparam.soql-injection-unescaped-param
192-
languages:
193-
- apex
194-
message: If a dynamic query must be used,leverage nFORCE Query Builder. In other programming languages, the related flaw is known as SQL injection. Apex doesn't use SQL, but uses its own database query language, SOQL. SOQL is much simpler and more limited in functionality than SQL. The risks are much lower for SOQL injection than for SQL injection, but the attacks are nearly identical to traditional SQL injection. SQL/SOQL injection takes user-supplied input and uses those values in a dynamic SOQL query. If the input isn't validated, it can include SOQL commands that effectively modify the SOQL statement and trick the application into performing unintended commands.
195-
metadata:
196-
category: security
197-
confidence: HIGH
198-
cwe:
199-
- 'CWE-943: Improper Neutralization of Special Elements in Data Query Logic'
200-
impact: HIGH
201-
likelihood: HIGH
202-
owasp:
203-
- A03:2021 - Injection
204-
references:
205-
- https://cwe.mitre.org/data/definitions/943.html
206-
subcategory:
207-
- vuln
208-
technology:
209-
- salesforce
210-
min-version: 1.44.0
211-
mode: taint
212-
pattern-sanitizers:
213-
- pattern-either:
214-
- pattern: String.escapeSingleQuotes($P)
215-
- pattern: Database.query(<... String.escapeSingleQuotes($P) ...>)
216-
pattern-sinks:
217-
- pattern: Database.query(<... $P ...>)
218-
pattern-sources:
219-
- by-side-effect: true
220-
patterns:
221-
- pattern: $M(...,String $P,...) { ... }
222-
- focus-metavariable: $P
223-
severity: ERROR
224-
- id: apex.lang.security.ncino.sharing.specifysharinglevel.specify-sharing-level
225-
languages:
226-
- apex
227-
message: Every Apex class should have an explicit sharing mode declared. Use the `with sharing` or `without sharing` keywords on a class to specify whether sharing rules must be enforced. Use the `inherited sharing` keyword on an Apex class to run the class in the sharing mode of the class that called it.
228-
metadata:
229-
category: security
230-
confidence: HIGH
231-
cwe:
232-
- 'CWE-284: Improper Access Control'
233-
impact: MEDIUM
234-
likelihood: MEDIUM
235-
owasp:
236-
- A04:2021 - Insecure Design
237-
references:
238-
- https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm
239-
- https://cwe.mitre.org/data/definitions/284.html
240-
- https://owasp.org/Top10/A04_2021-Insecure_Design/
241-
subcategory:
242-
- vuln
243-
technology:
244-
- salesforce
245-
min-version: 1.44.0
246-
patterns:
247-
- pattern-regex: (private|public|global).*\s(class)\s.*[{]
248-
- pattern-not-regex: (private|public|global).*[with|without|inherited]\s[sharing].*\s(class)\s.*[{]
249-
- pattern-not-regex: (private|public|global).*\s(class)\s.*(extends)\s(Exception).*[{]
250-
severity: WARNING
251-
- id: apex.lang.security.ncino.system.systemdebug.system-debug
252-
languages:
253-
- apex
254-
message: In addition to debug statements potentially logging data excessively, debug statements also contribute to longer transactions and consume Apex CPU time even when debug logs are not being captured.
255-
metadata:
256-
category: security
257-
confidence: HIGH
258-
cwe:
259-
- 'CWE-489: Active Debug Code'
260-
- 'CWE-779: Logging of Excessive Data'
261-
impact: MEDIUM
262-
likelihood: LOW
263-
references:
264-
- https://cwe.mitre.org/data/definitions/489.html
265-
- https://cwe.mitre.org/data/definitions/779.html
266-
subcategory:
267-
- vuln
268-
technology:
269-
- vuln
270-
min-version: 1.44.0
271-
paths:
272-
exclude:
273-
- '*Test*'
274-
- '*test*'
275-
pattern: System.debug(...)
276-
severity: WARNING
2772
- id: bash.curl.security.curl-eval.curl-eval
2783
languages:
2794
- bash

0 commit comments

Comments
 (0)