Repository navigation
feat: Add FAA scan action for SSC and FoD modules and integrate it in to CI workflows #1133
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
Open
SangameshV
wants to merge
6
commits into
dev/v3.x
Choose a base branch
from
feat/v3.x/faa-scan-actions
base: dev/v3.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9b3963e
feat: Add FAA scan action for SSC and FoD modules and integrate it in…
SangameshV 5eef2ad
chore: fix option name
SangameshV 33cb3a7
Update ci env vars help doc and fix faa-scan action options
SangameshV a799561
ci(doc): Update help documentation
SangameshV d38fc29
feat: Integrate faa-scan action in to ci actions of both SSC and FoD.
SangameshV c3db6ec
fix: Move SAST results download step from CI action to faa-scan action
SangameshV 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 hidden or 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 hidden or 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 hidden or 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
117 changes: 117 additions & 0 deletions
117
fcli-core/fcli-fod/src/main/resources/com/fortify/cli/fod/actions/zip/faa-scan.yaml
This file contains hidden or 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,117 @@ | ||
| # yaml-language-server: $schema=https://fortify.github.io/fcli/schemas/action/fcli-action-schema-dev-2.x.json | ||
|
|
||
| author: Fortify | ||
|
SangameshV marked this conversation as resolved.
Resolved
|
||
| usage: | ||
| header: (PREVIEW) Run Fortify Agentic Analyzer Scan | ||
| description: | | ||
| This action runs a Fortify Agentic Analyzer (FAA) scan on the project source code | ||
| and imports the results to FoD as a SARIF report. | ||
|
|
||
| The action automatically downloads the latest SAST scan results for the specified | ||
| release. FAA uses this context to avoid reporting duplicate issues that were already | ||
| found by SAST, resulting in higher quality analysis results. If no SAST results are | ||
| available, FAA runs without SAST context. | ||
|
|
||
| NOTE: SAST context is taken from the latest SAST scan results available in FoD at the | ||
| time this action runs. If a more recent SAST scan hasn't completed yet, results from an | ||
| earlier SAST scan will be used. The fcli 'ci' action waits for SAST scan completion | ||
| (unless waiting is disabled) before running this action. The imported SARIF results are | ||
| processed asynchronously by FoD; this action doesn't wait for import completion. | ||
|
|
||
| config: | ||
| output: immediate | ||
| rest.target.default: fod | ||
| run.fcli.status.log.default: true | ||
| run.fcli.status.check.default: true | ||
| mcp: exclude # FAA is a specialized tool requiring specific setup | ||
|
|
||
| cli.options: | ||
| sourceDir: | ||
| names: --source-dir, -d | ||
| description: >- | ||
| Source directory on which to run Fortify Agentic Analyzer scan. | ||
| Defaults to environment variable `SOURCE_DIR` if not specified. | ||
| required: false | ||
| default: ${#env('SOURCE_DIR')} | ||
| release: | ||
| names: --release, --rel | ||
| description: >- | ||
| FoD release for which to download SAST results and import FAA scan results. | ||
| Release must already exist in FoD. | ||
| required: true | ||
| default: ${#env('FOD_RELEASE')} | ||
| faaOutput: | ||
| names: --output, -o | ||
| description: >- | ||
| Output SARIF file path where FAA scan results will be written. | ||
| Defaults to fortifyaa-scan.sarif in the current working directory. | ||
| required: false | ||
| default: fortifyaa-scan.sarif | ||
| faaPath: | ||
| names: --faa-path, -p | ||
| description: >- | ||
| Path to a pre-installed Fortify Agentic Analyzer (FAA) installation. | ||
| FAA must be pre-installed on the system before running this action; | ||
| this action only registers the existing installation with fcli. | ||
| Defaults to the FAA_HOME environment variable. | ||
| If not specified and FAA_HOME is not set, the system PATH will be searched. | ||
| required: false | ||
| default: ${#env('FAA_HOME')} | ||
| extraScanOpts: | ||
| names: --extra-scan-opts | ||
| description: >- | ||
| Extra options to be passed to the 'fortifyaa -scan' command. | ||
| required: false | ||
|
|
||
| steps: | ||
| - var.set: | ||
| # Used for passing extra options from ci action without bothering about escaping | ||
| extraScanOpts: ${#join(" ", {cli.extraScanOpts, global.faaScan?.extraOpts})} | ||
| sastFprFile: faa_input_${#action.runID().replace('-','_')}.fpr | ||
| fprArg: '' | ||
|
|
||
| # Register FAA with self-test to fail early if FAA is not found or not properly configured | ||
| - run.fcli: | ||
| SETUP_TOOLS: | ||
| cmd: >- | ||
| fcli tool env init "--tools=fortifyaa${#isNotBlank(cli.faaPath) ? ':' + cli.faaPath : ''}" | ||
|
|
||
| # Download latest SAST results for the release | ||
| - run.fcli: | ||
| DOWNLOAD_LATEST_SAST_FPR: | ||
| cmd: fcli fod sast-scan download-latest --rel "${cli.release}" -f "${sastFprFile}" | ||
| status.check: false | ||
| on.success: | ||
| - var.set: | ||
| fprArg: '--fpr "${sastFprFile}"' | ||
| on.fail: | ||
| - log.warn: | ||
| msg: Unable to download latest SAST FPR for release '${cli.release}'; FAA scan will run without SAST context. | ||
| cause: ${lastException} | ||
|
|
||
| # Run FAA scan with SAST FPR context if available, otherwise run without SAST context | ||
| - run.fcli: | ||
| RUN_FAA_SCAN: | ||
| cmd: > | ||
| fcli tool fortifyaa run -- | ||
| -clean | ||
| -scan "${cli.sourceDir}" | ||
| ${fprArg} | ||
| -o "${cli.faaOutput}" | ||
| ${extraScanOpts} | ||
| stdout: collect | ||
| stderr: collect | ||
| on.success: | ||
| - out.write: | ||
| stdout: ${RUN_FAA_SCAN.stdout} | ||
| stderr: ${RUN_FAA_SCAN.stderr} | ||
| on.fail: | ||
| - out.write: | ||
| stdout: ${RUN_FAA_SCAN.stdout} | ||
| stderr: ${RUN_FAA_SCAN.stderr} | ||
| - throw: FAA Scan failed with errors. | ||
| IMPORT_SARIF: | ||
| cmd: > | ||
| fcli fod sast-scan import-sarif | ||
| --rel "${cli.release}" | ||
| -f "${cli.faaOutput}" | ||
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.