-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: adoption of sfdx-scan-pull-request by mitch spano #6
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2b2a4d2
ci: update to use sfdx-scan-pull-request
mmoyaferrer e68a79e
ci: only trigger on force-app folder changes
mmoyaferrer b17426f
chore: some mock changes to test quality scans, this commit will be u…
mmoyaferrer ed3f971
fix: add action version
mmoyaferrer 07ec7f2
ci: using comments report mode
mmoyaferrer 892f77e
chore: undo mock static resource add
mmoyaferrer ac67eb2
ci: update eslintignore
mmoyaferrer 63df1e8
ci: clean eslint
mmoyaferrer df8b0e5
ci: undo mock changes in metadataa
mmoyaferrer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -8,15 +8,22 @@ jobs: | |
PMD: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
- name: Setup Salesforce CLI | ||
run: | | ||
yarn global add @salesforce/cli | ||
sf plugins:install @salesforce/sfdx-scanner | ||
- name: SF Code Analyzer - PMD | ||
run: | | ||
sf scanner:run --engine pmd --target force-app --pmdconfig=config/pmd/ruleset.xml --format table --severity-threshold 3 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
- name: Setup Salesforce CLI | ||
run: | | ||
yarn global add @salesforce/cli | ||
sf plugins:install @salesforce/sfdx-scanner | ||
- name: SF Code Analyzer - PMD - Report findings as comments | ||
uses: mitchspano/[email protected] | ||
with: | ||
report-mode: comments | ||
engine: pmd | ||
pmdconfig: config/pmd/ruleset.xml | ||
severity-threshold: 4 | ||
strictly-enforced-rules: '[{ "engine": "pmd", "category": "Performance", "rule": "AvoidDebugStatements" }]' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
RetireJS: | ||
runs-on: ubuntu-latest | ||
|
@@ -27,11 +34,16 @@ jobs: | |
run: | | ||
yarn global add @salesforce/cli | ||
sf plugins:install @salesforce/sfdx-scanner | ||
- name: SF Code Analyzer - RetireJS | ||
run: | | ||
sf scanner:run --engine "retire-js" --target force-app --format table --severity-threshold 3 | ||
- name: SF Code Analyzer - RetireJS - Report findings as comments | ||
uses: mitchspano/[email protected] | ||
with: | ||
report-mode: comments | ||
engine: retire-js | ||
severity-threshold: 4 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
GraphEngine: | ||
ESLint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -40,11 +52,20 @@ jobs: | |
run: | | ||
yarn global add @salesforce/cli | ||
sf plugins:install @salesforce/sfdx-scanner | ||
- name: SF Code Analyzer - Data Flow Analysis | ||
- name: Install deps | ||
run: | | ||
sf scanner:run:dfa --target force-app --projectdir force-app --format table --severity-threshold 3 | ||
yarn install | ||
- name: SF Code Analyzer - ESLint - Report findings as comments | ||
uses: mitchspano/[email protected] | ||
with: | ||
report-mode: comments | ||
engine: eslint | ||
eslintconfig: .eslintrc.json | ||
severity-threshold: 4 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
ESLint: | ||
GraphEngine: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -53,9 +74,6 @@ jobs: | |
run: | | ||
yarn global add @salesforce/cli | ||
sf plugins:install @salesforce/sfdx-scanner | ||
- name: Install deps | ||
run: | | ||
yarn install | ||
- name: SF Code Analyzer - ESLint | ||
- name: SF Code Analyzer - Data Flow Analysis | ||
run: | | ||
sf scanner:run --engine eslint --eslintconfig=.eslintrc.json --target "force-app/**/*.js" --format table --severity-threshold 3 | ||
sf scanner:run:dfa --target force-app --projectdir force-app --format table --severity-threshold 3 |
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 |
---|---|---|
|
@@ -4,6 +4,8 @@ on: | |
push: | ||
branches: | ||
- main | ||
paths: | ||
- force-app/** | ||
|
||
jobs: | ||
code-analyze: | ||
|
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 |
---|---|---|
|
@@ -2,6 +2,10 @@ name: Pull Request | |
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- force-app/** | ||
|
||
jobs: | ||
code-analyze: | ||
|
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,6 @@ | ||
public class Greeter { | ||
// this is another test | ||
public static String greet(String name) { | ||
return 'Hello ' + name + ' from Greeter'; | ||
} | ||
} |
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,5 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>50.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
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,7 @@ | ||
@isTest | ||
private class Test_Greeter { | ||
@isTest | ||
static void greet() { | ||
System.assertEquals(Greeter.greet('John'), 'Hello John from Greeter'); | ||
} | ||
} |
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,5 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>50.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
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,8 @@ | ||||||||||||||||||
// Note: This class contains a FLS vulnerability to demo Salesforce Code Analyzer | ||||||||||||||||||
public without sharing class UglyUpdateCtrl { | ||||||||||||||||||
@AuraEnabled | ||||||||||||||||||
public void execute(Account account) { | ||||||||||||||||||
account.Description = 'My code should not perform DML without enforcing field level security'; | ||||||||||||||||||
update account; | ||||||||||||||||||
} | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||
} |
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,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>57.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
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
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
<template> Hello World </template> | ||
<template> | ||
|
||
</template> |
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 | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,3 +1,10 @@ | ||||||||||||||||||||||||||||||||||
import { LightningElement } from 'lwc'; | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
export default class HelloWorld extends LightningElement {} | ||||||||||||||||||||||||||||||||||
export default class HelloWorld extends LightningElement { | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
connectedCallback() { | ||||||||||||||||||||||||||||||||||
// Vulnerable code snippet | ||||||||||||||||||||||||||||||||||
var userInput = "<script>alert('XSS vulnerability!');</script>"; | ||||||||||||||||||||||||||||||||||
document.getElementById("output").innerHTML = userInput; | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||||||||||||||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>58.0</apiVersion> | ||
<apiVersion>57.0</apiVersion> | ||
<isExposed>false</isExposed> | ||
</LightningComponentBundle> | ||
</LightningComponentBundle> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.