|
19 | 19 | steps: |
20 | 20 | - name: "Checkout" |
21 | 21 | uses: actions/checkout@v5 |
| 22 | + with: |
| 23 | + submodules: true |
22 | 24 |
|
23 | 25 | - name: "Check for changes" |
24 | 26 | uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 |
|
67 | 69 | run: | |
68 | 70 | ./scripts/run-tests.sh "ql/test/${{ matrix.test-folders }}" |
69 | 71 |
|
| 72 | + scanning: |
| 73 | + runs-on: ubuntu-latest |
| 74 | + needs: [tests] |
| 75 | + |
| 76 | + strategy: |
| 77 | + matrix: |
| 78 | + project: ["hashicorp/terraform-guides", "akamai/terraform-examples", "aws-samples/aws-sam-terraform-examples"] |
| 79 | + |
| 80 | + steps: |
| 81 | + - name: "Checkout" |
| 82 | + uses: actions/checkout@v5 |
| 83 | + with: |
| 84 | + submodules: true |
| 85 | + |
| 86 | + - name: "Checkout" |
| 87 | + uses: actions/checkout@v5 |
| 88 | + with: |
| 89 | + repository: ${{ matrix.project }} |
| 90 | + path: project |
| 91 | + |
| 92 | + - name: "Check for changes" |
| 93 | + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 |
| 94 | + id: extractor-changes |
| 95 | + with: |
| 96 | + filters: | |
| 97 | + src: |
| 98 | + - 'extractor/**' |
| 99 | + - 'rust-toolchain.toml' |
| 100 | + - 'Cargo.*' |
| 101 | +
|
| 102 | + - name: "Download Extracter" |
| 103 | + if: steps.extractor-changes.outputs.src == 'false' |
| 104 | + env: |
| 105 | + GH_TOKEN: ${{ github.token }} |
| 106 | + run: | |
| 107 | + set -e |
| 108 | + gh release list -L 1 -R "advanced-security/codeql-extractor-iac" |
| 109 | +
|
| 110 | + gh release download \ |
| 111 | + -R "advanced-security/codeql-extractor-iac" \ |
| 112 | + --clobber \ |
| 113 | + --pattern 'extractor-iac.tar.gz' |
| 114 | +
|
| 115 | + tar -zxf extractor-iac.tar.gz |
| 116 | +
|
| 117 | + - uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable |
| 118 | + if: steps.extractor-changes.outputs.src == 'true' |
| 119 | + |
| 120 | + - name: "Build Extractor" |
| 121 | + if: steps.extractor-changes.outputs.src == 'true' |
| 122 | + env: |
| 123 | + GH_TOKEN: ${{ github.token }} |
| 124 | + run: | |
| 125 | + set -e |
| 126 | + gh extensions install github/gh-codeql |
| 127 | + gh codeql set-version latest |
| 128 | +
|
| 129 | + ./scripts/create-extractor-pack.sh |
| 130 | +
|
| 131 | + gh codeql resolve languages --format=json --search-path ./extractor-pack |
| 132 | +
|
| 133 | + - name: "Run CodeQL Analysis" |
| 134 | + env: |
| 135 | + GH_TOKEN: ${{ github.token }} |
| 136 | + PROJECT_REPO: ${{ matrix.project }} |
| 137 | + run: | |
| 138 | + set -e |
| 139 | + gh extensions install github/gh-codeql |
| 140 | + gh codeql set-version latest |
| 141 | +
|
| 142 | + gh codeql database create iac-db --language=hcl --source-root=./project --search-path ./extractor-pack |
| 143 | +
|
| 144 | + gh codeql database analyze iac-db "codeql-queries/iac-queries" --format=sarifv2.1.0 --output="iac-${PROJECT_REPO}.sarif" |
| 145 | +
|
| 146 | +
|
70 | 147 | docs: |
71 | 148 | runs-on: ubuntu-latest |
72 | 149 | steps: |
|
0 commit comments