mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
chore(build): enable CodeQL (#1026)
* Create codeql.yml * setup pnpm * sq.Eq{"ras.status": params.Filters.PushStatus} * enable extended and quality * fix: code scanning alert #58 #57 https://github.com/autobrr/autobrr/security/code-scanning/58 https://github.com/autobrr/autobrr/security/code-scanning/57 * fix: linting issues for code scanning 60, 59, 56 https://github.com/autobrr/autobrr/security/code-scanning/60 https://github.com/autobrr/autobrr/security/code-scanning/59 https://github.com/autobrr/autobrr/security/code-scanning/56 --------- Co-authored-by: Fabricio Silva <hi@fabricio.dev>
This commit is contained in:
parent
a78a5d1bf8
commit
98df0c9040
5 changed files with 107 additions and 9 deletions
97
.github/workflows/codeql.yml
vendored
Normal file
97
.github/workflows/codeql.yml
vendored
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "develop", "master" ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ "develop" ]
|
||||||
|
schedule:
|
||||||
|
- cron: '20 13 * * 6'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||||
|
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||||
|
# - https://gh.io/supported-runners-and-hardware-resources
|
||||||
|
# - https://gh.io/using-larger-runners
|
||||||
|
# Consider using larger runners for possible analysis time improvements.
|
||||||
|
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
||||||
|
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'go', 'javascript' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
|
||||||
|
# Use only 'java' to analyze code written in Java, Kotlin or both
|
||||||
|
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
|
||||||
|
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: '18.17.0'
|
||||||
|
|
||||||
|
- name: Set up corepack
|
||||||
|
run: corepack enable
|
||||||
|
|
||||||
|
# It can not be done before enable corepack
|
||||||
|
- name: Set up cache
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
cache: pnpm
|
||||||
|
cache-dependency-path: web/pnpm-lock.yaml
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
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.
|
||||||
|
|
||||||
|
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||||
|
queries: security-extended,security-and-quality
|
||||||
|
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||||
|
|
||||||
|
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||||
|
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||||
|
|
||||||
|
# - run: |
|
||||||
|
# echo "Run, Build Application using script"
|
||||||
|
# ./location_of_script_within_repo/buildscript.sh
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v2
|
||||||
|
with:
|
||||||
|
category: "/language:${{matrix.language}}"
|
|
@ -200,7 +200,7 @@ func (repo *ReleaseRepo) findReleases(ctx context.Context, tx *Tx, params domain
|
||||||
|
|
||||||
if params.Filters.PushStatus != "" {
|
if params.Filters.PushStatus != "" {
|
||||||
subQueryBuilder = subQueryBuilder.InnerJoin("release_action_status ras ON r.id = ras.release_id").Where(sq.Eq{"ras.status": params.Filters.PushStatus})
|
subQueryBuilder = subQueryBuilder.InnerJoin("release_action_status ras ON r.id = ras.release_id").Where(sq.Eq{"ras.status": params.Filters.PushStatus})
|
||||||
countQuery = countQuery.InnerJoin("release_action_status ras ON r.id = ras.release_id").Where("ras.status = '" + params.Filters.PushStatus + `'`)
|
countQuery = countQuery.InnerJoin("release_action_status ras ON r.id = ras.release_id").Where(sq.Eq{"ras.status": params.Filters.PushStatus})
|
||||||
}
|
}
|
||||||
|
|
||||||
subQuery, subArgs, err := subQueryBuilder.ToSql()
|
subQuery, subArgs, err := subQueryBuilder.ToSql()
|
||||||
|
|
|
@ -50,7 +50,7 @@ export async function HttpClient<T = unknown>(
|
||||||
for (const [key, value] of Object.entries(config.queryString)) {
|
for (const [key, value] of Object.entries(config.queryString)) {
|
||||||
const serializedKey = encodeRFC3986URIComponent(key);
|
const serializedKey = encodeRFC3986URIComponent(key);
|
||||||
|
|
||||||
if (typeof(value) === undefined) {
|
if (typeof(value) === "undefined") {
|
||||||
// Skip case when the value is undefined.
|
// Skip case when the value is undefined.
|
||||||
// The solution in this case is to use the request body instead with JSON
|
// The solution in this case is to use the request body instead with JSON
|
||||||
continue;
|
continue;
|
||||||
|
@ -59,7 +59,7 @@ export async function HttpClient<T = unknown>(
|
||||||
// e.g. ?a=1&a=2&a=3
|
// e.g. ?a=1&a=2&a=3
|
||||||
value.forEach((child) => {
|
value.forEach((child) => {
|
||||||
// Skip undefined member values
|
// Skip undefined member values
|
||||||
const v = typeof(child) !== undefined ? String(child) : "";
|
const v = typeof(child) !== "undefined" ? String(child) : "";
|
||||||
if (v.length) {
|
if (v.length) {
|
||||||
params.push(`${serializedKey}=${encodeRFC3986URIComponent(v)}`);
|
params.push(`${serializedKey}=${encodeRFC3986URIComponent(v)}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ export function useToggle(initialValue = false): [boolean, () => void] {
|
||||||
return [value, toggle];
|
return [value, toggle];
|
||||||
}
|
}
|
||||||
|
|
||||||
const isBrowser = typeof window !== "undefined";
|
const isBrowser = typeof(window) !== "undefined";
|
||||||
|
|
||||||
const getInitialState = (query: string, defaultState?: boolean) => {
|
const getInitialState = (query: string, defaultState?: boolean) => {
|
||||||
// Prevent a React hydration mismatch when a default value is provided by not defaulting to window.matchMedia(query).matches.
|
// Prevent a React hydration mismatch when a default value is provided by not defaulting to window.matchMedia(query).matches.
|
||||||
|
|
|
@ -21,7 +21,7 @@ class ParserFilter {
|
||||||
|
|
||||||
public OnParseLine(key: string, value: string) {
|
public OnParseLine(key: string, value: string) {
|
||||||
if (key in CONST.FILTER_SUBSTITUTION_MAP) {
|
if (key in CONST.FILTER_SUBSTITUTION_MAP) {
|
||||||
key = CONST.FILTER_SUBSTITUTION_MAP[key]
|
key = CONST.FILTER_SUBSTITUTION_MAP[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -202,8 +202,9 @@ class ParserIrcChannel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// erm.. todo?
|
// erm.. todo?
|
||||||
const TRACKER = "tracker" as const;
|
// const TRACKER = "tracker" as const;
|
||||||
const OPTIONS = "options" as const;
|
// const OPTIONS = "options" as const;
|
||||||
|
|
||||||
// *cough* later dude, trust me *cough*
|
// *cough* later dude, trust me *cough*
|
||||||
const FILTER = "filter" as const;
|
const FILTER = "filter" as const;
|
||||||
const SERVER = "server" as const;
|
const SERVER = "server" as const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue