-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CHANGE @W-17312010@ Adding PMD AppExchange rule docs to keep links fu…
…nctional (#1697)
- Loading branch information
1 parent
c4b9e64
commit 7be3a6e
Showing
47 changed files
with
924 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidApiSessionId[](#avoidapisessionid) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Session ID use may not be approved. | ||
|
||
|
||
**Priority:** High (2) | ||
|
||
**Description:** | ||
|
||
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. | ||
|
||
**Example(s):** | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidApiSessionIdInXML[](#avoidapisessionidinxml) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Session ID use is not approved. | ||
|
||
|
||
**Priority:** High (2) | ||
|
||
**Description:** | ||
|
||
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. | ||
|
||
**Example(s):** | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidAuraAppWithLockerDisabled[](#avoidauraappwithlockerdisabled) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
To enable Lightning Locker, update the apiVersion to version 40 or greater. | ||
|
||
|
||
**Priority:** Critical (1) | ||
|
||
**Description:** | ||
|
||
Detects use of API versions with Lightning Locker disabled in Aura components. Use API version 40 or greater. | ||
|
||
**Example(s):** | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidAuraCmpWithLockerDisabled[](#avoidauracmpwithlockerdisabled) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
To enable Lightning Locker, update the apiVersion to version 40 or greater. | ||
|
||
|
||
**Priority:** Critical (1) | ||
|
||
**Description:** | ||
|
||
Detects use of API versions with Lightning Locker disabled in Aura components. Use API version 40 or greater. | ||
|
||
**Example(s):** | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidChangeProtectionUnprotected[](#avoidchangeprotectionunprotected) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Ensure appropriate authorization checks are in-place before invoking FeatureManagement.changeProtection called with 'UnProtected' argument. | ||
|
||
|
||
**Priority:** Critical (1) | ||
|
||
**Description:** | ||
|
||
Detects potential misuse of FeatureManagement.changeProtection. | ||
|
||
**Example(s):** | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
AvoidCreateElementScriptLinkTag[](#avoidcreateelementscriptlinktag) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Load JavaScript/CSS only from static resources. | ||
|
||
|
||
**Priority:** High (2) | ||
|
||
**Description:** | ||
|
||
Detects dynamic creation of script or link tags | ||
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`. | ||
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` | ||
|
||
**Example(s):** | ||
|
||
|
||
|
||
``` | ||
<script src="{!$Resource.jquery}"/> | ||
``` | ||
|
||
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidDisableProtocolSecurity[](#avoiddisableprotocolsecurity) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Protocol security setting is disabled | ||
|
||
|
||
**Priority:** Medium (3) | ||
|
||
**Description:** | ||
|
||
Detects if "Disable Protocol Security" setting is checked/true | ||
|
||
**Example(s):** | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidDisableProtocolSecurityInXML[](#avoiddisableprotocolsecurityinxml) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Protocol security setting is disabled | ||
|
||
|
||
**Priority:** Medium (3) | ||
|
||
**Description:** | ||
|
||
Detects if "Disable Protocol Security" setting is checked/true | ||
|
||
**Example(s):** | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
AvoidGetInstanceWithTaint[](#avoidgetinstancewithtaint) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
getInstance() is invoked with a potentially tainted parameter. | ||
|
||
|
||
**Priority:** Medium (3) | ||
|
||
**Description:** | ||
|
||
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. | ||
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. | ||
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. | ||
|
||
**Example(s):** | ||
|
||
|
||
|
23 changes: 23 additions & 0 deletions
23
pmd-appexchange/docs/AvoidGlobalInstallUninstallHandlers.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
AvoidGlobalInstallUninstallHandlers[](#avoidglobalinstalluninstallhandlers) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Install and Uninstall handlers should be public and not global | ||
|
||
|
||
**Priority:** Critical (1) | ||
|
||
**Description:** | ||
|
||
Detects Install and Uninstall handlers declared as global. Install and Uninstall Handlers don't need to be global classes. | ||
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. | ||
Depending on the logic in these handlers, there could potentially unintended consequences. | ||
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. | ||
Or | ||
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. | ||
|
||
**Example(s):** | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidHardCodedCredentialsInAura[](#avoidhardcodedcredentialsinaura) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Detected use of hard coded credentials in Aura component | ||
|
||
|
||
**Priority:** High (2) | ||
|
||
**Description:** | ||
|
||
Detected use of hard coded credentials in Aura component | ||
|
||
**Example(s):** | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidHardCodedSecretsInVFAttrs[](#avoidhardcodedsecretsinvfattrs) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Hard coded secrets detected in attributes | ||
|
||
|
||
**Priority:** High (2) | ||
|
||
**Description:** | ||
|
||
Detects Hard coded secrets in VF attributes | ||
|
||
**Example(s):** | ||
|
||
|
||
|
19 changes: 19 additions & 0 deletions
19
pmd-appexchange/docs/AvoidHardcodedCredentialsInFieldDecls.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
AvoidHardcodedCredentialsInFieldDecls[](#avoidhardcodedcredentialsinfielddecls) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Hard-coded credentials found in source code. | ||
|
||
|
||
**Priority:** Medium (3) | ||
|
||
**Description:** | ||
|
||
Identifies hard-coded credentials in source code that must be protected using Protected Custom metadata or Protected Custom settings. | ||
Protected custom setttings or protected custom metadata should be used to store secrets. | ||
Refer to the [Protect Secrets Using Platform Features](https://trailhead.salesforce.com/content/learn/modules/secure-secrets-storage/protect-secrets-using-platform-features) Trailhead module for more guidance. | ||
|
||
|
||
**Example(s):** | ||
|
17 changes: 17 additions & 0 deletions
17
pmd-appexchange/docs/AvoidHardcodedCredentialsInHttpHeader.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
AvoidHardcodedCredentialsInHttpHeader[](#avoidhardcodedcredentialsinhttpheader) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Hard-coded credentials found in source code. | ||
|
||
|
||
**Priority:** Medium (3) | ||
|
||
**Description:** | ||
|
||
Identifies hard-coded credentials in source code that must be protected using Protected Custom metadata or Protected Custom settings. | ||
Protected custom setttings or protected custom metadata should be used to store secrets. | ||
Refer to the [Protect Secrets Using Platform Features](https://trailhead.salesforce.com/content/learn/modules/secure-secrets-storage/protect-secrets-using-platform-features) Trailhead module for more guidance. | ||
|
||
**Example(s):** |
18 changes: 18 additions & 0 deletions
18
pmd-appexchange/docs/AvoidHardcodedCredentialsInSetPassword.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidHardcodedCredentialsInSetPassword[](#avoidhardcodedcredentialsinsetpassword) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Avoid using hard-coded credentials with setPassword | ||
|
||
|
||
**Priority:** Critical (1) | ||
|
||
**Description:** | ||
|
||
Detects hard-coded credentials in the call to setPassword(). | ||
|
||
**Example(s):** | ||
|
||
|
||
|
23 changes: 23 additions & 0 deletions
23
pmd-appexchange/docs/AvoidHardcodedCredentialsInVarAssign.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
AvoidHardcodedCredentialsInVarAssign[](#avoidhardcodedcredentialsinvarassign) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Hard-coded credentials found in source code. | ||
|
||
|
||
**Priority:** Medium (3) | ||
|
||
**Description:** | ||
|
||
Identifies hard-coded credentials in source code that must be protected using Protected Custom metadata or Protected Custom settings. | ||
Protected custom setttings or protected custom metadata should be used to store secrets. | ||
Refer to the [Protect Secrets Using Platform Features](https://trailhead.salesforce.com/content/learn/modules/secure-secrets-storage/protect-secrets-using-platform-features) Trailhead module for more guidance. | ||
|
||
**Example(s):** | ||
``` | ||
19 changes: 19 additions & 0 deletions
19
pmd-appexchange/docs/AvoidHardcodedCredentialsInVarDecls.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
AvoidHardcodedCredentialsInVarDecls[](#avoidhardcodedcredentialsinvardecls) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Hard-coded credentials found in source code. | ||
|
||
|
||
**Priority:** Medium (3) | ||
|
||
**Description:** | ||
|
||
Identifies hard-coded credentials in source code that must be protected using Protected Custom metadata or Protected Custom settings. | ||
Protected custom setttings or protected custom metadata should be used to store secrets. | ||
Refer to the [Protect Secrets Using Platform Features](https://trailhead.salesforce.com/content/learn/modules/secure-secrets-storage/protect-secrets-using-platform-features) Trailhead module for more guidance. | ||
|
||
|
||
**Example(s):** | ||
|
18 changes: 18 additions & 0 deletions
18
pmd-appexchange/docs/AvoidInsecureHttpRemoteSiteSetting.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidInsecureHttpRemoteSiteSetting[](#avoidinsecurehttpremotesitesetting) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Avoid using insecure http urls in Remote Site Settings. | ||
|
||
|
||
**Priority:** Medium (3) | ||
|
||
**Description:** | ||
|
||
Detects instances of a Remote Site Settings that use HTTP.Use HTTPS instead. | ||
|
||
**Example(s):** | ||
|
||
|
||
|
18 changes: 18 additions & 0 deletions
18
pmd-appexchange/docs/AvoidInsecureHttpRemoteSiteSettingInXML.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AvoidInsecureHttpRemoteSiteSettingInXML[](#avoidinsecurehttpremotesitesettinginxml) | ||
------------------------------------------------------------------------------------------------------------------------------------------------------ | ||
|
||
**Violation:** | ||
|
||
Avoid using insecure http urls in Remote Site Settings. | ||
|
||
|
||
**Priority:** Medium (3) | ||
|
||
**Description:** | ||
|
||
Detects instances of a Remote Site Settings that use HTTP.Use HTTPS instead. | ||
|
||
**Example(s):** | ||
|
||
|
||
|
Oops, something went wrong.