-
Notifications
You must be signed in to change notification settings - Fork 0
feat: enabled CodeQL #492
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
feat: enabled CodeQL #492
Changes from all commits
2485c5e
ebe44b7
bff1388
54571a0
34d4f39
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,8 @@ | ||
| # ref: | ||
| # for `javascript-typescript` codeql-suites: https://github.com/github/codeql/tree/main/javascript/ql/src/codeql-suites | ||
| # for `actions` codeql-suites: https://github.com/github/codeql/tree/main/actions/ql/src/codeql-suites | ||
|
|
||
| name: "CodeQL configurations" | ||
|
|
||
| queries: | ||
| - uses: security-and-quality |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: CodeQL | ||
|
|
||
| on: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| codeql: | ||
| name: CodeQL | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| permissions: | ||
| actions: read | ||
| contents: read | ||
| security-events: write | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| # https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#changing-the-languages-that-are-analyzed | ||
| language: | ||
| - 'javascript-typescript' | ||
| - 'actions' | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Initialize CodeQL | ||
| uses: github/codeql-action/init@v3 | ||
| with: | ||
| languages: ${{ matrix.language }} | ||
| config-file: ./.github/config/codeql.yaml | ||
|
|
||
| - name: Perform CodeQL Analysis | ||
| uses: github/codeql-action/analyze@v3 | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,62 @@ | ||||||||||||||||||||||||||
| name: Tests CI | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||
| # triggered only when PR created with its target to main | ||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||
| - 'main' | ||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||
| - 'api-server/**' | ||||||||||||||||||||||||||
| - 'web-frontend/**' | ||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||
| tests: | ||||||||||||||||||||||||||
| name: Tests | ||||||||||||||||||||||||||
| runs-on: ubuntu-24.04 | ||||||||||||||||||||||||||
hwakabh marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||
| issues: write | ||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||
| - name: Checkout | ||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Filter Path | ||||||||||||||||||||||||||
| uses: dorny/paths-filter@v3 | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| id: filter | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| filters: '.github/config/paths-filter.yaml' | ||||||||||||||||||||||||||
| # https://github.com/dorny/paths-filter | ||||||||||||||||||||||||||
|
Comment on lines
+26
to
+31
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. 🛠️ Refactor suggestion Pin third-party action to specific commit. For security, pin the - uses: dorny/paths-filter@v3
+ uses: dorny/paths-filter@4512585405ef951d0fe8899ba468f8d5e711e2e3 # v3📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: CodeQL[warning] 23-23: Unpinned tag for a non-immutable Action in workflow |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Setup node.js environment | ||||||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| node-version: 20.9.0 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Run only for Backend | ||||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||||
| if: steps.filter.outputs.api == 'true' | ||||||||||||||||||||||||||
| working-directory: ./api-server | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| npm ci | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Run Jest | ||||||||||||||||||||||||||
| if: steps.filter.outputs.api == 'true' | ||||||||||||||||||||||||||
| working-directory: ./api-server | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| npx jest | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Run only for Frontend | ||||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||||
| if: steps.filter.outputs.ui == 'true' | ||||||||||||||||||||||||||
| working-directory: ./web-frontend | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| npm ci | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Run Vitest for compoenent testings | ||||||||||||||||||||||||||
| if: steps.filter.outputs.ui == 'true' | ||||||||||||||||||||||||||
| working-directory: ./web-frontend | ||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| npx vitest run | ||||||||||||||||||||||||||
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.
🛠️ Refactor suggestion
Add workflow-level permissions declaration.
Following the principle of least privilege, explicitly declare workflow-level permissions: