-
Notifications
You must be signed in to change notification settings - Fork 0
Add GitHub Action: Qwiet AI by Harness Static Analysis #21
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,62 @@ | ||||||
| --- | ||||||
| # This workflow integrates Harness SAST and SCA with GitHub | ||||||
| # Visit https://docs.shiftleft.io for help | ||||||
| name: Harness SAST and SCA | ||||||
|
|
||||||
| on: | ||||||
| pull_request: | ||||||
| workflow_dispatch: | ||||||
|
|
||||||
| jobs: | ||||||
| NextGen-Static-Analysis: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - uses: actions/checkout@v3 | ||||||
|
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. P2: actions/checkout@v3 is inconsistent with the rest of the repo — all other workflows use @v4. The v3 tag runs on Node 16 (deprecated by GitHub Actions) and will produce deprecation warnings. Upgrade to actions/checkout@v4 for consistency and to avoid runtime warnings. Prompt for AI agents
Suggested change
|
||||||
| - name: Setup Java JDK v11 | ||||||
| uses: actions/setup-java@v3 | ||||||
|
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. P2: actions/setup-java@v3 runs on Node 16 which is deprecated by GitHub Actions. Upgrade to @v4 to use Node 20 and avoid deprecation warnings. The distribution and java-version parameters remain the same. Prompt for AI agents |
||||||
| with: | ||||||
| distribution: zulu | ||||||
| java-version: 11 | ||||||
|
|
||||||
| - name: Download Harness SAST and SCA CLI | ||||||
| run: | | ||||||
| curl https://cdn.shiftleft.io/download/sl > ${GITHUB_WORKSPACE}/sl && chmod a+rx ${GITHUB_WORKSPACE}/sl | ||||||
|
|
||||||
| - name: Static Analysis | ||||||
| run: | | ||||||
|
Check failure on line 26 in .github/workflows/shiftleft.yml
|
||||||
|
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. "github.head_ref" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs\.github\.com/en/actions/reference/security/secure\-use\#good\-practices\-for\-mitigating\-script\-injection\-attacks for more details [actionlint:expression] |
||||||
| ${GITHUB_WORKSPACE}/sl --version | ||||||
| ${GITHUB_WORKSPACE}/sl analyze --strict --wait \ | ||||||
| --app Center \ | ||||||
| --tag branch=${{ github.head_ref }} \ | ||||||
|
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. Bug: The Suggested FixProvide a fallback value for the branch tag when Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. 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. P1: Using env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: |
... --tag branch=${BRANCH_NAME} ...Prompt for AI agentsThere 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. P2: Prompt for AI agents |
||||||
| --jssrc . | ||||||
| env: | ||||||
| SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }} | ||||||
| SHIFTLEFT_API_HOST: www.shiftleft.io | ||||||
| SHIFTLEFT_GRPC_TELEMETRY_HOST: telemetry.shiftleft.io:443 | ||||||
| SHIFTLEFT_GRPC_API_HOST: api.shiftleft.io:443 | ||||||
|
|
||||||
| # Build-Rules: | ||||||
| # runs-on: ubuntu-latest | ||||||
| # permissions: write-all | ||||||
| # needs: NextGen-Static-Analysis | ||||||
| # steps: | ||||||
| # - uses: actions/checkout@v3 | ||||||
| # - name: Download Harness SAST and SCA CLI | ||||||
| # run: | | ||||||
| # curl https://cdn.shiftleft.io/download/sl > ${GITHUB_WORKSPACE}/sl && chmod a+rx ${GITHUB_WORKSPACE}/sl | ||||||
| # - name: Validate Build Rules | ||||||
| # run: | | ||||||
| # ${GITHUB_WORKSPACE}/sl check-analysis --app Center \ | ||||||
| # --github-pr-number=${{github.event.number}} \ | ||||||
| # --github-pr-user=${{ github.repository_owner }} \ | ||||||
| # --github-pr-repo=${{ github.event.repository.name }} \ | ||||||
| # --github-token=${{ secrets.GITHUB_TOKEN }} | ||||||
| # env: | ||||||
| # # SHIFTLEFT_ACCESS_TOKEN: ${{ secrets.SHIFTLEFT_ACCESS_TOKEN }} | ||||||
| # | ||||||
| # SHIFTLEFT_API_HOST: www.shiftleft.io | ||||||
| # SHIFTLEFT_GRPC_TELEMETRY_HOST: telemetry.shiftleft.io:443 | ||||||
| # SHIFTLEFT_GRPC_API_HOST: api.shiftleft.io:443 | ||||||
| # | ||||||
|
Comment on lines
+12
to
+60
|
||||||
|
|
||||||
|
|
||||||
|
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. |
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| version: 2 | ||
| build_rules: | ||
| - id: Allow no critical findings | ||
| severities: | ||
| - critical | ||
| - id: Allow one OSS or container finding | ||
| finding_types: | ||
| - oss_vuln | ||
| - container | ||
| threshold: 1 | ||
| - id: Allow no reachable OSS vulnerability | ||
| finding_types: | ||
| - oss_vuln | ||
| options: | ||
| reachable: true |
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.
P2: This workflow does not declare a
permissionsblock, so theGITHUB_TOKENreceives the repository's default permissions (often broad write access). Add a top-levelpermissionsblock to follow the principle of least privilege. A minimal starting point for this workflow would be:Prompt for AI agents