-
-
Notifications
You must be signed in to change notification settings - Fork 0
Create codeql.yml #76
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,74 @@ | |||||||||||||||||||||||||||||
| --- | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| name: "CodeQL Advanced" | |||||||||||||||||||||||||||||
| run-name: "CodeQL Advanced" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| push: | |||||||||||||||||||||||||||||
| branches: | |||||||||||||||||||||||||||||
| - 'main' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||||||||
| branches: | |||||||||||||||||||||||||||||
| - 'main' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| schedule: | |||||||||||||||||||||||||||||
| - cron: '35 18 * * 0' | |||||||||||||||||||||||||||||
| - cron: '17 22 * * 5' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| analyze: | |||||||||||||||||||||||||||||
| name: "Analyze (${{ matrix.language }})" | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| permissions: | |||||||||||||||||||||||||||||
| security-events: write | |||||||||||||||||||||||||||||
| packages: read | |||||||||||||||||||||||||||||
| actions: read | |||||||||||||||||||||||||||||
| contents: read | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| strategy: | |||||||||||||||||||||||||||||
| fail-fast: false | |||||||||||||||||||||||||||||
| matrix: | |||||||||||||||||||||||||||||
| language: | |||||||||||||||||||||||||||||
| - 'actions' | |||||||||||||||||||||||||||||
| - 'javascript-typescript' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: "Checkout" | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: "Initialize CodeQL" | |||||||||||||||||||||||||||||
| uses: github/codeql-action/init@v3 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| languages: ${{ matrix.language }} | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: "Perform CodeQL Analysis" | |||||||||||||||||||||||||||||
| uses: github/codeql-action/analyze@v3 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| category: "/language:${{ matrix.language }}" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| dependency-scan: | |||||||||||||||||||||||||||||
| name: Dependency Scan | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: "Checkout repository" | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: "Scan for dependencies" | |||||||||||||||||||||||||||||
| uses: github/dependabot-action@v2 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| sub-directory: "/" | |||||||||||||||||||||||||||||
| open-pull-requests-limit: 5 | |||||||||||||||||||||||||||||
| package-ecosystem: "github-actions" | |||||||||||||||||||||||||||||
| directory: "/" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| secret-scan: | |||||||||||||||||||||||||||||
| name: "Secret Scan" | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: "Checkout" | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: "Scan for secrets" | |||||||||||||||||||||||||||||
| uses: github/secret-scanning@v2 | |||||||||||||||||||||||||||||
|
Comment on lines
+67
to
+74
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 10 months ago To fix the problem, we should add a
Suggested changeset
1
.github/workflows/codeql.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 10 months ago
To fix the problem, add a
permissionsblock to thedependency-scanjob in.github/workflows/codeql.yml. This block should grant only the minimal required permissions. Since the job only checks out code and runs a dependency scan,contents: readis sufficient. Thepermissionsblock should be added at the same indentation level asruns-onandstepswithin thedependency-scanjob, ideally immediately afterruns-onfor clarity.