codeql-config.yml 4.1 KB

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