45
.github/workflows/codeql.yml
vendored
Normal file
45
.github/workflows/codeql.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
name: "CodeQL Advanced"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * 0'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze (${{ matrix.language }})
|
||||||
|
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
packages: read
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- language: actions
|
||||||
|
build-mode: none
|
||||||
|
- language: rust
|
||||||
|
build-mode: none
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v4
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
build-mode: ${{ matrix.build-mode }}
|
||||||
|
config-file: .github/codeql/codeql-config.yml
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v4
|
||||||
|
with:
|
||||||
|
category: "/language:${{ matrix.language }}"
|
||||||
20
.github/workflows/queries/common/ProductionOnly.qll
vendored
Normal file
20
.github/workflows/queries/common/ProductionOnly.qll
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import rust
|
||||||
|
|
||||||
|
predicate isTestOnly(Item i) {
|
||||||
|
exists(ConditionalCompilation cc |
|
||||||
|
cc.getItem() = i and
|
||||||
|
cc.getCfg().toString() = "test"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
predicate hasTestAttribute(Item i) {
|
||||||
|
exists(Attribute a |
|
||||||
|
a.getItem() = i and
|
||||||
|
a.getName() = "test"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
predicate isProductionCode(Item i) {
|
||||||
|
not isTestOnly(i) and
|
||||||
|
not hasTestAttribute(i)
|
||||||
|
}
|
||||||
4
.github/workflows/queries/qlpack.yml
vendored
Normal file
4
.github/workflows/queries/qlpack.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
name: rust-production-only
|
||||||
|
version: 0.0.1
|
||||||
|
dependencies:
|
||||||
|
codeql/rust-all: "*"
|
||||||
Reference in New Issue
Block a user