|
| 1 | +# CodeQL Configuration for TMI |
| 2 | +# https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning |
| 3 | + |
| 4 | +name: "TMI CodeQL Config" |
| 5 | + |
| 6 | +# Use security-extended queries for comprehensive analysis |
| 7 | +queries: |
| 8 | + - uses: security-extended |
| 9 | + - uses: security-and-quality |
| 10 | + |
| 11 | +# Path filters - exclude generated code and development-only scripts |
| 12 | +paths-ignore: |
| 13 | + # Auto-generated OpenAPI code (contains many false positives from oapi-codegen) |
| 14 | + - api/api.go |
| 15 | + # Development-only Python scripts (OAuth testing harness, deployment tools) |
| 16 | + # These intentionally log OAuth tokens/credentials for debugging purposes |
| 17 | + - scripts/oauth-client-callback-stub.py |
| 18 | + - scripts/setup-heroku-env.py |
| 19 | + - scripts/parse-cats-results.py |
| 20 | + |
| 21 | +# Query filters to reduce false positives |
| 22 | +query-filters: |
| 23 | + # Exclude clear-text logging alerts from Python dev scripts |
| 24 | + # These are development-only tools that intentionally log OAuth tokens for debugging |
| 25 | + - exclude: |
| 26 | + id: py/clear-text-logging-sensitive-data |
| 27 | + |
| 28 | +# ============================================================================= |
| 29 | +# KNOWN FALSE POSITIVES - GORM Map-Based Queries (go/sql-injection) |
| 30 | +# ============================================================================= |
| 31 | +# CodeQL flags GORM's map-based Where() queries as SQL injection vulnerabilities. |
| 32 | +# These are FALSE POSITIVES because GORM parameterizes all values internally. |
| 33 | +# |
| 34 | +# Pattern flagged: |
| 35 | +# db.Where(map[string]interface{}{"column_name": userValue}).First(&entity) |
| 36 | +# |
| 37 | +# Why it's safe: |
| 38 | +# 1. Map keys are hard-coded field names (not user input) |
| 39 | +# 2. GORM converts keys to column names via its naming strategy |
| 40 | +# 3. Values are parameterized - GORM generates "WHERE column = ?" with bound params |
| 41 | +# 4. This pattern is used for Oracle cross-database compatibility |
| 42 | +# |
| 43 | +# Affected files (dismiss these alerts in GitHub): |
| 44 | +# - auth/repository/user_repository.go:64 (GetByProviderID) |
| 45 | +# - api/database_store_gorm.go:42,49,55 (resolveUserIdentifierToUUID) |
| 46 | +# - api/authorization_enrichment.go:64,70,93,97,180 (user lookup queries) |
| 47 | +# - api/administrator_store_gorm.go:200,337 (group lookups) |
| 48 | +# |
| 49 | +# To dismiss: Go to Security > Code scanning alerts > Select alert > Dismiss as "False positive" |
| 50 | +# Reason: "GORM map-based queries are parameterized internally" |
| 51 | +# ============================================================================= |
0 commit comments