brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
codeql-security-scanner用于通过 CodeQL 执行语义代码扫描、安全查询、自定义规则、SARIF 报告和 GitHub Code Scanning 集成。
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this skill when the user wants deep semantic code scanning, GitHub Advanced Security style analysis, custom CodeQL queries, SARIF output, or vulnerability investigation with CodeQL databases.
Good trigger phrases:
Inspect the repository:
rg --files | sed -n '1,160p'
Determine:
codeql version
If missing, use official GitHub CodeQL CLI installation guidance. For GitHub-hosted workflows, prefer github/codeql-action.
For compiled languages, provide the real build command:
codeql database create codeql-db --language=java --command="mvn -DskipTests package"
For JavaScript or TypeScript:
codeql database create codeql-db --language=javascript-typescript
For Python:
codeql database create codeql-db --language=python
If database creation fails, fix dependency installation or build steps before analyzing.
Default query suite:
codeql database analyze codeql-db --format=sarif-latest --output=codeql.sarif
Security extended suite:
codeql database analyze codeql-db codeql/javascript-queries:codeql-suites/javascript-security-extended.qls --format=sarif-latest --output=codeql.sarif
Adapt the query pack path to the detected language and installed CodeQL pack layout.
For each alert:
Prioritize:
Use custom queries when a project has its own framework wrappers:
/**
* @name Example dangerous API use
* @kind problem
* @problem.severity warning
* @security-severity 6.0
* @id custom/dangerous-api
*/
import javascript
from CallExpr call
where call.getCalleeName() = "dangerousEval"
select call, "Avoid dangerousEval with untrusted input."
Keep custom queries versioned with tests where possible.
name: codeql
on:
pull_request:
push:
branches: [main]
jobs:
analyze:
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v3
with:
languages: javascript-typescript
queries: security-extended
- uses: github/codeql-action/analyze@v3
1. Reproduce the alert with CodeQL CLI.
2. Open path explanation and inspect each step.
3. Confirm source is user-controllable.
4. Confirm sink is security-sensitive.
5. Fix with framework-native safe API.
6. Add regression test.
7. Re-run the relevant query.
## CodeQL Alert
- Query:
- Severity:
- Location:
- Source:
- Sink:
- Path summary:
- Exploit condition:
- Fix:
- Test: