Skip to content

Fix CodeQL security warnings in Flask app#29

Merged
hyperpolymath merged 1 commit intomainfrom
claude/fix-codeql-flask-security-018YbVK86qBYP9xXzWDDeLug
Dec 7, 2025
Merged

Fix CodeQL security warnings in Flask app#29
hyperpolymath merged 1 commit intomainfrom
claude/fix-codeql-flask-security-018YbVK86qBYP9xXzWDDeLug

Conversation

@hyperpolymath
Copy link
Owner

  • Fix Flask debug mode: Use environment variable FLASK_DEBUG instead of hardcoded debug=True to prevent running in debug mode in production

  • Fix unsafe HTML construction in JavaScript client library:

    • Replace innerHTML with safe DOM API methods (createElement, textContent)
    • Add sanitizeUrl helper to prevent javascript:/data: protocol XSS attacks
    • Build SVG elements using createElementNS for safer rendering
  • Add explicit permissions to GitHub Actions workflows:

    • test.yml: contents: read
    • security.yml: contents: read (workflow-level), issues: write (security-summary job)
    • build.yml: contents: read
    • rsr-compliance.yml: contents: read
    • ci.yml: contents: read
    • docs.yml: contents: write, pages: write, id-token: write (for gh-deploy)

These changes follow the principle of least privilege and address all CodeQL security warnings for Flask debug mode, unsafe HTML construction, and missing workflow permissions.

- Fix Flask debug mode: Use environment variable FLASK_DEBUG instead of
  hardcoded debug=True to prevent running in debug mode in production

- Fix unsafe HTML construction in JavaScript client library:
  - Replace innerHTML with safe DOM API methods (createElement, textContent)
  - Add sanitizeUrl helper to prevent javascript:/data: protocol XSS attacks
  - Build SVG elements using createElementNS for safer rendering

- Add explicit permissions to GitHub Actions workflows:
  - test.yml: contents: read
  - security.yml: contents: read (workflow-level), issues: write (security-summary job)
  - build.yml: contents: read
  - rsr-compliance.yml: contents: read
  - ci.yml: contents: read
  - docs.yml: contents: write, pages: write, id-token: write (for gh-deploy)

These changes follow the principle of least privilege and address all CodeQL
security warnings for Flask debug mode, unsafe HTML construction, and missing
workflow permissions.
@hyperpolymath hyperpolymath merged commit 2667840 into main Dec 7, 2025
0 of 42 checks passed
@hyperpolymath hyperpolymath deleted the claude/fix-codeql-flask-security-018YbVK86qBYP9xXzWDDeLug branch December 7, 2025 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants