Skip to content

Commit

Permalink
Merge pull request #1309 from forcedotcom/d/W-13222948-b
Browse files Browse the repository at this point in the history
NEW (PMD): @W-13222948@: Added AppExchange PMD subvariant
  • Loading branch information
jfeingold35 authored Jan 5, 2024
2 parents a7d4a8e + ce6ab3e commit 306b901
Show file tree
Hide file tree
Showing 66 changed files with 1,205 additions and 419 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"/messages",
"/npm-shrinkwrap.json",
"/oclif.manifest.json",
"/pmd-appexchange",
"/html-templates",
"/retire-js",
"/oclif.lock"
Expand Down
18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidApiSessionId.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidApiSessionId[](#avoidapisessionid)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Session ID use is not approved.


**Priority:** High (2)

**Description:**

Detects use of Api.Session_ID to retrieve a session ID.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidAuraWithLockerDisabled.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidAuraWithLockerDisabled[](#avoidaurawithlockerdisabled)
------------------------------------------------------------------------------------------------------------------------------------------------------

**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):**



Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidCallingSystemResetPasswordWithEmailTemplate[](#avoidcallingsystemresetpasswordwithemailtemplate)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Before calling System.resetPasswordWithEmailTemplate(), perform the necessary authorization checks.


**Priority:** Critical (1)

**Description:**

Detects where System.resetPasswordWithEmailTemplate() exists in Apex code. Use this method with caution.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidChangeProtection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidChangeProtection[](#avoidchangeprotection)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Update your code to avoid using FeatureManagement.changeProtection.


**Priority:** High (2)

**Description:**

Detects potential misuse of FeatureManagement.changeProtection.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidChangeProtectionUnprotected.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidChangeProtectionUnprotected[](#avoidchangeprotectionunprotected)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Update your code to avoid using FeatureManagement.changeProtection called by an UnProtected argument.


**Priority:** Critical (1)

**Description:**

Detects potential misuse of FeatureManagement.changeProtection.

**Example(s):**



47 changes: 47 additions & 0 deletions pmd-appexchange/docs/AvoidHardcodedCredentials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
AvoidHardcodedCredentials[](#avoidhardcodedcredentials)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Remove hard-coded credentials from 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.

**Example(s):**

Correct Method

```
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<customSettingsType>List</customSettingsType>
<enableFeeds>false</enableFeeds>
<label>Username</label>
<visibility>Protected</visibility>
</CustomObject>
```

Incorrect Method

```
public with sharing class test3 {
public test3() {
String key = 'supersecurepassword';
HttpRequest req = new HttpRequest();
req.setEndpoint('https://www.example.com/test?APIKEY='+key);
req.setMethod('GET');
Http http = new Http();
HTTPResponse res = http.send(req);
return res.getBody();
}
```




18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidJavaScriptCustomRule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidJavaScriptCustomRule[](#avoidjavascriptcustomrule)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Avoid using JavaScript to execute custom button actions.


**Priority:** High (2)

**Description:**

Detects use of custom JavaScript actions in custom rules.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidJavaScriptHomePageComponent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidJavaScriptHomePageComponent[](#avoidjavascripthomepagecomponent)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Avoid JavaScript in a home page component body.


**Priority:** High (2)

**Description:**

Detects use of custom JavaScript actions in home page components.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidJavaScriptWeblink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidJavaScriptWeblink[](#avoidjavascriptweblink)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Avoid using JavaScript in web links.


**Priority:** High (2)

**Description:**

Detects use of custom JavaScript actions in web links.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidJsLinksInCustomObject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidJsLinksInCustomObject[](#avoidjslinksincustomobject)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Avoid clickable JavaScript-style URLs.


**Priority:** Critical (1)

**Description:**

Detects instances of JavaScript-style URLs (javascript:) in Salesforce DOM components, such as web links and buttons. Avoid JavaScript-style URLs in managed packages.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidJsLinksInWebLinks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidJsLinksInWebLinks[](#avoidjslinksinweblinks)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Avoid clickable JavaScript-style URLs.


**Priority:** Critical (1)

**Description:**

Detects instances of JavaScript-style URLs (javascript:) in Salesforce DOM components, such as web links and buttons. Avoid JavaScript-style URLs in managed packages.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidLmcIsExposedTrue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidLmcIsExposedTrue[](#avoidlmcisexposedtrue)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Use Lightning Message Channel with isExposed set to false.


**Priority:** High (2)

**Description:**

Detects a Lightning Message Channel with isExposed=true, which isn’t allowed in managed packages.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidLwcBubblesComposedTrue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidLwcBubblesComposedTrue[](#avoidlwcbubblescomposedtrue)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Avoid setting both Lightning Web component bubbles and composed=true at the same time.


**Priority:** Medium (3)

**Description:**

Detects Lightning Web Component event configurations where bubbles and composed are both set to true. To avoid sharing sensitive information unintentionally, use this configuration with caution.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidSystemModeInFlows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidSystemModeInFlows[](#avoidsystemmodeinflows)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Reconfigure to avoid running flows in system mode.


**Priority:** Medium (3)

**Description:**

Detects where default mode must be used in flows instead of system mode.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidUnauthorizedApiSessionIdInApex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidUnauthorizedApiSessionIdInApex[](#avoidunauthorizedapisessionidinapex)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Use of API.Session_ID might not be authorized.


**Priority:** High (2)

**Description:**

Detects use of Api.Session_ID to retrieve a session ID.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidUnauthorizedApiSessionIdInFlows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidUnauthorizedApiSessionIdInFlows[](#avoidunauthorizedapisessionidinflows)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

$Api.Session_ID usage is not approved.


**Priority:** High (2)

**Description:**

Detects use of session ID in SOAP API calls in flows.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidUnauthorizedApiSessionIdVisualforce.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidUnauthorizedApiSessionIdVisualforce[](#avoidunauthorizedapisessionidvisualforce)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Retrieval of session ID using API.Session_ID is not authorized.


**Priority:** Medium (3)

**Description:**

Detects use of Api.Session_ID to retrieve a session ID in Visualforce code.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidUnauthorizedGetSessionIdInApex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidUnauthorizedGetSessionIdInApex[](#avoidunauthorizedgetsessionidinapex)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Use of UserInfo.getSessionId might not be authorized.


**Priority:** Medium (3)

**Description:**

Detects use of UserInfo.getSessionId() to retrieve a session ID.

**Example(s):**



18 changes: 18 additions & 0 deletions pmd-appexchange/docs/AvoidUnauthorizedGetSessionIdInVisualforce.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AvoidUnauthorizedGetSessionIdInVisualforce[](#avoidunauthorizedgetsessionidinvisualforce)
------------------------------------------------------------------------------------------------------------------------------------------------------

**Violation:**

Use of session ID with GETSESSIONID is not authorized.


**Priority:** High (2)

**Description:**

Detects use of GETSESSIONID() to retrieve a session ID in Visualforce code.

**Example(s):**



Loading

0 comments on commit 306b901

Please sign in to comment.