codeql-config.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. name: "Bambuddy CodeQL Configuration"
  2. # Uses the default query suite with accepted-risk exclusions.
  3. # Each exclusion is reviewed and documented below.
  4. query-filters:
  5. # ── Python Accepted Risk ─────────────────────────────────────
  6. # Log injection: All logging uses %s parameterized style.
  7. # Remaining findings are CodeQL taint-tracking printer/device data
  8. # to parameterized log args. Accepted risk for local network tool.
  9. - exclude:
  10. id: py/log-injection
  11. # Cyclic imports: SQLAlchemy ORM pattern — models import
  12. # database base class, database imports models for migrations.
  13. - exclude:
  14. id: py/cyclic-import
  15. - exclude:
  16. id: py/unsafe-cyclic-import
  17. # Unused local variables: Python _ prefix convention for
  18. # intentional discards (tuple unpacking, test fixture side effects).
  19. - exclude:
  20. id: py/unused-local-variable
  21. # Path injection: All paths validated — extension whitelists,
  22. # traversal checks (rejects .. / \), UUID-based naming, or
  23. # constructed from integer IDs in controlled base directories.
  24. - exclude:
  25. id: py/path-injection
  26. # Stack trace exposure: str(e) replaced with generic messages
  27. # in HTTP responses. Remaining findings are CodeQL tracing through
  28. # _update_status dict returns, not actual exposures.
  29. - exclude:
  30. id: py/stack-trace-exposure
  31. # Socket bind to 0.0.0.0: Virtual printer SSDP/discovery
  32. # services must bind all interfaces for LAN discoverability.
  33. - exclude:
  34. id: py/bind-socket-all-network-interfaces
  35. # SSRF: URLs come from admin-configured settings (external
  36. # cameras, Home Assistant, Tasmota). Validation added for scheme,
  37. # hostname, and metadata-service blocking.
  38. - exclude:
  39. id: py/partial-ssrf
  40. - exclude:
  41. id: py/full-ssrf
  42. # Unused global variables: False positives — module-level
  43. # cache variables written via `global` in one function, read in another.
  44. - exclude:
  45. id: py/unused-global-variable
  46. # Clear-text logging sensitive data: False positive —
  47. # `api_key` in firmware_check.py is a printer model identifier
  48. # string ("x1", "p1", "a1-mini"), not a secret.
  49. - exclude:
  50. id: py/clear-text-logging-sensitive-data
  51. # Clear-text storage sensitive data: JWT secret stored in
  52. # file with 0600 permissions. Standard for single-host deployment.
  53. - exclude:
  54. id: py/clear-text-storage-sensitive-data
  55. # Weak hashing on sensitive data: MD5 used with
  56. # usedforsecurity=False for AMS tray fingerprinting, not security.
  57. - exclude:
  58. id: py/weak-sensitive-data-hashing
  59. # Catch base exception: In frontend/node_modules third-party
  60. # code (flatted/python/flatted.py), outside our control.
  61. - exclude:
  62. id: py/catch-base-exception
  63. # LDAP injection: All user input is RFC 4515 escaped via
  64. # _ldap_escape() (ldap_service.py:282) before interpolation
  65. # into search filters. CodeQL does not trace through the
  66. # escape replace-loop and reports false positives on lines
  67. # 131 / 183 / 198 where escaped values are reused.
  68. - exclude:
  69. id: py/ldap-injection
  70. # Incomplete URL substring sanitization: Only triggers in
  71. # test assertions (test_cloud_auth.py) that verify the
  72. # mocked HTTP client saw the right hostname
  73. # (e.g. `"api.bambulab.cn" in captured_url`). URLs come
  74. # from a mock's captured_urls list, not user input.
  75. - exclude:
  76. id: py/incomplete-url-substring-sanitization
  77. # ── JavaScript Accepted Risk ─────────────────────────────────
  78. # XSS through DOM: False positives —
  79. # 1. coverage/sorter.js: generated Istanbul coverage report
  80. # 2. TimelapseEditorModal.tsx: URL.createObjectURL(file) creates
  81. # a safe blob: URL used as <audio src>, not HTML injection.
  82. - exclude:
  83. id: js/xss-through-dom