Skip to content

SDKS-3771 Setup Mend SAST scan #474

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

Merged
merged 1 commit into from
Apr 21, 2025
Merged

SDKS-3771 Setup Mend SAST scan #474

merged 1 commit into from
Apr 21, 2025

Conversation

spetrov
Copy link
Contributor

@spetrov spetrov commented Apr 15, 2025

JIRA Ticket

SDKS-3771 Setup Mends SAST scan

Description

Setup Mend SAST scan.
A few notes:

  • Currently, the pipeline will fail if some Critical or High vulnerabilities are found! Mediums and Lows won't fail the pipeline! We can change that easily if needed...
  • Currently the .build directory is excluded from the scans. This is controlled by the MEND_SAST_PATH_EXCLUSIONS env variable. To modify the list we can simply change the github action variable MEND_SAST_PATH_EXCLUSIONS here...
  • The pipeline attaches/publishes the SAST scan results as an attachment to the pipeline execution run
  • The results are pushed to our Mend project - direct URL is available through the attached results and also in the slack message:
image

Copy link

codecov bot commented Apr 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.44%. Comparing base (2c7326e) to head (fea1608).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #474      +/-   ##
=============================================
+ Coverage      64.43%   64.44%   +0.01%     
- Complexity      1677     1679       +2     
=============================================
  Files            257      257              
  Lines           8676     8676              
  Branches         924      924              
=============================================
+ Hits            5590     5591       +1     
- Misses          2672     2673       +1     
+ Partials         414      412       -2     
Flag Coverage Δ
unit-tests 64.44% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@spetrov spetrov force-pushed the SDKS-3771 branch 24 times, most recently from 3e5bd02 to 33bfcd9 Compare April 18, 2025 20:18
@@ -25,14 +25,6 @@ jobs:
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0

# Setup JDK and cache and restore dependencies.
Copy link
Contributor Author

@spetrov spetrov Apr 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to setup JDK on the runner for Mend CLI scans... and thus I removed this part...

@@ -49,45 +41,118 @@ jobs:
- if: ${{ steps.cache-mend.outputs.cache-hit != 'true' }}
name: Download Mend CLI executable (cache miss...)
continue-on-error: true
shell: bash
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though GitHub defaults to bash on Ubuntu runners, it's safer to be explicit for portability...

- name: Fail if Critical or High SCA vulnerabilities are found
shell: bash
run: |
if [ "$MEND_SCA_CRITICAL_COUNT" -gt 0 ] || [ "$MEND_SCA_HIGH_COUNT" -gt 0 ]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the job fails only if some Critical or High vulnerabilities are found! Mediums and Lows won't fail the pipeline!

MEND_URL: ${{ vars.MEND_SERVER_URL }}
shell: bash
run: |
mend code --report --filename ${{ vars.MEND_SAST_REPORT_NAME }} --formats json,pdf --non-interactive --scope ${{ vars.MEND_PRODUCT_NAME }}//${{ vars.MEND_PROJECT_NAME }} > mend-sast-scan-result.txt
Copy link
Contributor Author

@spetrov spetrov Apr 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We run the mend SAST scan and produce 2 files - json and pdf + the report is published to Mend under ${{ vars.MEND_PRODUCT_NAME }}//${{ vars.MEND_PROJECT_NAME }}
The json file is used to parse the results. The pdf is attached to the pipeline run... (see below...)

run: |
if [ '${{ env.MEND_CRITICAL_COUNT }}' -gt '0' ] || [ '${{ env.MEND_HIGH_COUNT }}' -gt '0' ]; then
if [ "$MEND_SAST_CRITICAL_COUNT" -gt 0 ] || [ "$MEND_SAST_HIGH_COUNT" -gt 0 ]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, the job fails only if some Critical or High vulnerabilities are found! Mediums and Lows won't fail the pipeline!

Copy link
Contributor

@rodrigoareis rodrigoareis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good to me

@spetrov spetrov merged commit ae02259 into develop Apr 21, 2025
18 of 20 checks passed
@spetrov spetrov deleted the SDKS-3771 branch April 21, 2025 18:05
spetrov added a commit that referenced this pull request Apr 28, 2025
* SDKS-3843 WebAuthn supports new response payload

* Add mend SAST scan (#474)

* SDKS-3641 Clearly define external guidelines for PRs against SDKs (#473)

* SDKS-3641 Clearly define external guidelines for PRs against SDKs

* Addressing comments from Chris and Stoyan

* SDKS-3684 Handle push device token updates (#471)

* SDKS-3684 Handle push device token updates

* SDKS-3684 Handle push device token updates

* Addressing comments from Andy

* Updating copyright, enhancing unit tests

* Minor change to align behavior with iOS implementation

* SDKS-3961 Update logic to handle push device token updates

* Fixing issue with unit tests

* SDKS-3990 Address missing error and warning exception logging. This change ensures these critical events are properly recorded. (#476)

* SDKS-3993 Avoid crash upon user returning from centralize login after app process was killed and restored. (#477)

* ForgeRock Android SDK 4.8.0 Release preparation (#475)

* ForgeRock Android SDK 4.8.0 Release preparation

* SDKS-3819 Update copyright header to reference Ping Identity and current year

* Updated changelog

---------

Co-authored-by: Rodrigo Reis <[email protected]>

* Disable Mend reports temporary (#479)

---------

Co-authored-by: Andy Witrisna <[email protected]>
Co-authored-by: Rodrigo Reis <[email protected]>
Co-authored-by: Andy Witrisna <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants