Skip to content

Commit 7be3a6e

Browse files
authored
CHANGE @W-17312010@ Adding PMD AppExchange rule docs to keep links functional (#1697)
1 parent c4b9e64 commit 7be3a6e

File tree

47 files changed

+924
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+924
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
AvoidApiSessionId[](#avoidapisessionid)
2+
------------------------------------------------------------------------------------------------------------------------------------------------------
3+
4+
**Violation:**
5+
6+
Session ID use may not be approved.
7+
8+
9+
**Priority:** High (2)
10+
11+
**Description:**
12+
13+
Detects use of Api.Session_ID to retrieve a session ID. For more guidance on approved use cases, read the [Session Id Guidance][https://partners.salesforce.com/sfc/servlet.shepherd/version/download/0684V00000O83jT?asPdf=false&operationContext=CHATTER] document.
14+
15+
**Example(s):**
16+
17+
18+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
AvoidApiSessionIdInXML[](#avoidapisessionidinxml)
2+
------------------------------------------------------------------------------------------------------------------------------------------------------
3+
4+
**Violation:**
5+
6+
Session ID use is not approved.
7+
8+
9+
**Priority:** High (2)
10+
11+
**Description:**
12+
13+
Detects use of Api.Session_ID to retrieve a session ID. For more guidance on approved use cases, read the [Session Id Guidance][https://partners.salesforce.com/sfc/servlet.shepherd/version/download/0684V00000O83jT?asPdf=false&operationContext=CHATTER] document.
14+
15+
**Example(s):**
16+
17+
18+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
AvoidAuraAppWithLockerDisabled[](#avoidauraappwithlockerdisabled)
2+
------------------------------------------------------------------------------------------------------------------------------------------------------
3+
4+
**Violation:**
5+
6+
To enable Lightning Locker, update the apiVersion to version 40 or greater.
7+
8+
9+
**Priority:** Critical (1)
10+
11+
**Description:**
12+
13+
Detects use of API versions with Lightning Locker disabled in Aura components. Use API version 40 or greater.
14+
15+
**Example(s):**
16+
17+
18+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
AvoidAuraCmpWithLockerDisabled[](#avoidauracmpwithlockerdisabled)
2+
------------------------------------------------------------------------------------------------------------------------------------------------------
3+
4+
**Violation:**
5+
6+
To enable Lightning Locker, update the apiVersion to version 40 or greater.
7+
8+
9+
**Priority:** Critical (1)
10+
11+
**Description:**
12+
13+
Detects use of API versions with Lightning Locker disabled in Aura components. Use API version 40 or greater.
14+
15+
**Example(s):**
16+
17+
18+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
AvoidChangeProtectionUnprotected[](#avoidchangeprotectionunprotected)
2+
------------------------------------------------------------------------------------------------------------------------------------------------------
3+
4+
**Violation:**
5+
6+
Ensure appropriate authorization checks are in-place before invoking FeatureManagement.changeProtection called with 'UnProtected' argument.
7+
8+
9+
**Priority:** Critical (1)
10+
11+
**Description:**
12+
13+
Detects potential misuse of FeatureManagement.changeProtection.
14+
15+
**Example(s):**
16+
17+
18+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
AvoidCreateElementScriptLinkTag[](#avoidcreateelementscriptlinktag)
2+
------------------------------------------------------------------------------------------------------------------------------------------------------
3+
4+
**Violation:**
5+
6+
Load JavaScript/CSS only from static resources.
7+
8+
9+
**Priority:** High (2)
10+
11+
**Description:**
12+
13+
Detects dynamic creation of script or link tags
14+
Note: This rule identifies the `<script>` block where `createElement` is detected; but can only show the line number where the `<script>` tag begins and not the line number for `createElement`.
15+
That means if there are multiple `createElement` calls with `script` as input, you'll see multiple issues reported with the line number of the `<script>` tag. This is a known issue; developers are expected to go through the `<script>` block to identify the use of `createElement`
16+
17+
**Example(s):**
18+
19+
20+
21+
```
22+
<script src="{!$Resource.jquery}"/>
23+
```
24+
25+
See more examples on properly using static resources here: https://developer.salesforce.com/docs/atlas.en-us.236.0.secure_coding_guide.meta/secure_coding_guide/secure_coding_cross_site_scripting.htm
26+
27+
28+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
AvoidDisableProtocolSecurity[](#avoiddisableprotocolsecurity)
2+
------------------------------------------------------------------------------------------------------------------------------------------------------
3+
4+
**Violation:**
5+
6+
Protocol security setting is disabled
7+
8+
9+
**Priority:** Medium (3)
10+
11+
**Description:**
12+
13+
Detects if "Disable Protocol Security" setting is checked/true
14+
15+
**Example(s):**
16+
17+
18+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
AvoidDisableProtocolSecurityInXML[](#avoiddisableprotocolsecurityinxml)
2+
------------------------------------------------------------------------------------------------------------------------------------------------------
3+
4+
**Violation:**
5+
6+
Protocol security setting is disabled
7+
8+
9+
**Priority:** Medium (3)
10+
11+
**Description:**
12+
13+
Detects if "Disable Protocol Security" setting is checked/true
14+
15+
**Example(s):**
16+
17+
18+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
AvoidGetInstanceWithTaint[](#avoidgetinstancewithtaint)
2+
------------------------------------------------------------------------------------------------------------------------------------------------------
3+
4+
**Violation:**
5+
6+
getInstance() is invoked with a potentially tainted parameter.
7+
8+
9+
**Priority:** Medium (3)
10+
11+
**Description:**
12+
13+
Detects use of getInstance(userId)/getInstance(profileId). Hierarchy Custom Settings return the record owned by the current user when `getInstance()` is invoked without any parameters.
14+
But if a tainted/end-user controlled `userId` or `profileId` is passed as a parameter to `getInstance()` that will allow the code to access records owned by other users on the org.
15+
Protected Custom Settings are the recommended approach to store subscriber owned secrets. Passing `userId` or `proileId` parameters to `getInstance()` could allow a user access to secrets that belong other other users on the org.
16+
17+
**Example(s):**
18+
19+
20+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
AvoidGlobalInstallUninstallHandlers[](#avoidglobalinstalluninstallhandlers)
2+
------------------------------------------------------------------------------------------------------------------------------------------------------
3+
4+
**Violation:**
5+
6+
Install and Uninstall handlers should be public and not global
7+
8+
9+
**Priority:** Critical (1)
10+
11+
**Description:**
12+
13+
Detects Install and Uninstall handlers declared as global. Install and Uninstall Handlers don't need to be global classes.
14+
Using `global` for these handlers means global methods in these classes act as controllers and can be invoked by untrusted code outside the context of post-install/uninstall scenarios.
15+
Depending on the logic in these handlers, there could potentially unintended consequences.
16+
For ex: Sometimes post install handlers are used to generate an encryption key to be stored in a protected custom settings object. But if the classes are global, then other untrusted code in the org can invoke the global method and the encryption key may be over-written.
17+
Or
18+
Helper classes for post-install handlers are recommended to be used "without sharing" - which is acceptable in the context of post-install exectution; but could lead to potential security concerns if "without sharing" classes are invoked by untrusted code.
19+
20+
**Example(s):**
21+
22+
23+

0 commit comments

Comments
 (0)