From 8a0d5585dc9e2d256907028f648b6dfaea8061cc Mon Sep 17 00:00:00 2001 From: Xuyang Cao Date: Tue, 9 Jun 2026 15:38:18 +0800 Subject: [PATCH] feat: Enable CodeQL Advanced Security scanning Add CodeQL workflow for Python and JavaScript/TypeScript scanning. This plugin contains utility scripts for Java project analysis: - build_knowledge_graph.py: Tree-sitter based code analysis (2048 lines) - decompose.py: Project decomposition tool (2156 lines) - install_grammars.py: Grammar installation helper (70 lines) Configuration includes query filters for common patterns in CLI tools: - Shell command execution for build system integration - Path handling for local project analysis - Logging of analysis results These filters reduce false positives while maintaining security coverage. --- .github/codeql/codeql-config.yml | 26 ++++++++++++++++++ .github/workflows/codeql.yml | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .github/codeql/codeql-config.yml create mode 100644 .github/workflows/codeql.yml diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml new file mode 100644 index 0000000..bd4fd43 --- /dev/null +++ b/.github/codeql/codeql-config.yml @@ -0,0 +1,26 @@ +name: "CodeQL Configuration for Copilot Modernization Plugin" + +# Query filters to reduce false positives for tool/utility scripts +query-filters: + # These scripts are build/analysis tools, not user-facing applications + # They process local files and don't expose network endpoints + + - exclude: + id: py/shell-command-constructed-from-input + # These are CLI tools that intentionally run commands + # Input is from local file analysis, not untrusted user input + + - exclude: + id: py/path-injection + # File path construction for local project analysis + # Paths are scoped to the analyzed project directory + + - exclude: + id: py/clear-text-logging-sensitive-data + # Logging analysis results and build information + # No credentials or secrets are processed + +# Custom queries configuration +queries: + # Use security-extended query suite for comprehensive coverage + - uses: security-extended diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..71b7739 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,46 @@ +name: "CodeQL Advanced Security" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + # Run weekly on Monday at 00:00 UTC + - cron: '0 0 * * 1' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + # Required for all workflows + security-events: write + # Required for workflows in private repositories + contents: read + actions: read + + strategy: + fail-fast: false + matrix: + language: [ 'python', 'javascript-typescript' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + queries: security-extended + config-file: ./.github/codeql/codeql-config.yml + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{ matrix.language }}" + upload: true