From 09fa3b9723362634eb5877b2dd60fb884cb1f341 Mon Sep 17 00:00:00 2001 From: Ilya Khivrich Date: Mon, 21 Oct 2024 23:01:52 +0300 Subject: [PATCH 1/2] add jfrog-sast flow --- code-scanning/jfrog-sast.yml | 54 +++++++++++++++++++ .../properties/jfrog-sast.properties.json | 15 ++++++ 2 files changed, 69 insertions(+) create mode 100644 code-scanning/jfrog-sast.yml create mode 100644 code-scanning/properties/jfrog-sast.properties.json diff --git a/code-scanning/jfrog-sast.yml b/code-scanning/jfrog-sast.yml new file mode 100644 index 0000000000..aba617d86d --- /dev/null +++ b/code-scanning/jfrog-sast.yml @@ -0,0 +1,54 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# JFrog SAST performs 1st party source code security analysis +# For more information, see +# https://docs.jfrog-applications.jfrog.io/jfrog-security-features/sast + +name: "JFrog SAST Scan" + +on: + push: + branches: [ $default-branch, $protected-branches ] + pull_request: + branches: [ $default-branch, $protected-branches ] + schedule: + - cron: $cron-weekly + +env: + # [Mandatory] + # JFrog platform URL and access token for + # a JFrog platform instance with active + # JFrog Advanced Security subscription + JF_URL: ${{ secrets.JF_URL }} + JF_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }} +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + + - name: Install and configure JFrog CLI + run: | + npm install -g jfrog-cli-v2-jf + jf c add --interactive=false --url=$JF_URL --access-token=$JF_TOKEN + + - name: Run JFrog SAST + run: | + jf audit --sast --format=sarif > jfrog_sast.sarif + + + - name: Upload output to generate autofix + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: jfrog_sast.sarif \ No newline at end of file diff --git a/code-scanning/properties/jfrog-sast.properties.json b/code-scanning/properties/jfrog-sast.properties.json new file mode 100644 index 0000000000..093d9c252a --- /dev/null +++ b/code-scanning/properties/jfrog-sast.properties.json @@ -0,0 +1,15 @@ +{ + "name": "JFrog SAST", + "description": "Scan for security vulnerabilities in source code using JFrog SAST", + "iconName": "frogbot", + "categories": + [ + "Code Scanning", + "python", + "java", + "javascript", + "typescript", + "go" + ], + "creator": "JFrog" +} \ No newline at end of file From 7f50c702183846c848e2eb13df950a942ffd2374 Mon Sep 17 00:00:00 2001 From: Ilya Khivrich Date: Tue, 22 Oct 2024 11:53:35 +0300 Subject: [PATCH 2/2] pass token over stdin, add security to properties --- code-scanning/jfrog-sast.yml | 2 +- code-scanning/properties/jfrog-sast.properties.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/code-scanning/jfrog-sast.yml b/code-scanning/jfrog-sast.yml index aba617d86d..4ff7ef7e06 100644 --- a/code-scanning/jfrog-sast.yml +++ b/code-scanning/jfrog-sast.yml @@ -41,7 +41,7 @@ jobs: - name: Install and configure JFrog CLI run: | npm install -g jfrog-cli-v2-jf - jf c add --interactive=false --url=$JF_URL --access-token=$JF_TOKEN + echo $JF_TOKEN | jf c add --interactive=false --url=$JF_URL --access-token-stdin - name: Run JFrog SAST run: | diff --git a/code-scanning/properties/jfrog-sast.properties.json b/code-scanning/properties/jfrog-sast.properties.json index 093d9c252a..7ffa897e9f 100644 --- a/code-scanning/properties/jfrog-sast.properties.json +++ b/code-scanning/properties/jfrog-sast.properties.json @@ -5,6 +5,7 @@ "categories": [ "Code Scanning", + "security", "python", "java", "javascript",