Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

chore: codeQL config #617

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/qlpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: my-custom-queries
version: 0.0.0
libraryPathDependencies: codeql-javascript
12 changes: 12 additions & 0 deletions .github/sync.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* @kind problem
* @id sync-methods
* @severity medium
*/

import javascript

from CallExpr c
where c.getCalleeName() = "existsSync" or c.getCalleeName() = "readFileSync"
select c, "Sync method warning"

9 changes: 5 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
name: "CodeQL"

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
Expand Down Expand Up @@ -43,18 +44,18 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
queries: ./.github/sync.ql, security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,4 +69,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
6 changes: 6 additions & 0 deletions faulty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const fs = require("fs");


if (fs.existsSync("./package.json")) {

Check warning

Code scanning / CodeQL

Sync method warning

Sync method warning
console.log("ok");
}