python-bambuddy.qls 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # Bambuddy Python Security & Quality Suite
  2. #
  3. # Extends the standard python-security-and-quality suite, excluding
  4. # accepted-risk findings documented below.
  5. #
  6. # All excluded findings have been reviewed and either:
  7. # - Fixed in code (validation added) but CodeQL still traces taint
  8. # - Confirmed false positive after code inspection
  9. # - Accepted risk for a local-network admin tool
  10. - description: "Bambuddy Python security and quality"
  11. - import: codeql-suites/python-security-and-quality.qls
  12. from: codeql/python-queries
  13. # ── Accepted Risk ─────────────────────────────────────────────
  14. # Log injection (131): All logging uses %s parameterized style.
  15. # Remaining findings are CodeQL taint-tracking printer/device data
  16. # to parameterized log args. Accepted risk for local network tool.
  17. - exclude:
  18. id: py/log-injection
  19. # Cyclic imports (70+2): SQLAlchemy ORM pattern — models import
  20. # database base class, database imports models for migrations.
  21. - exclude:
  22. id: py/cyclic-import
  23. - exclude:
  24. id: py/unsafe-cyclic-import
  25. # Unused local variables (11): Python _ prefix convention for
  26. # intentional discards (tuple unpacking, test fixture side effects).
  27. - exclude:
  28. id: py/unused-local-variable
  29. # Path injection (11): All paths validated — extension whitelists,
  30. # traversal checks (rejects .. / \), UUID-based naming, or
  31. # constructed from integer IDs in controlled base directories.
  32. - exclude:
  33. id: py/path-injection
  34. # Stack trace exposure (5): str(e) replaced with generic messages
  35. # in HTTP responses. Remaining findings are CodeQL tracing through
  36. # _update_status dict returns, not actual new exposures.
  37. - exclude:
  38. id: py/stack-trace-exposure
  39. # Socket bind to 0.0.0.0 (4): Virtual printer SSDP/discovery
  40. # services must bind all interfaces for LAN discoverability.
  41. - exclude:
  42. id: py/bind-socket-all-network-interfaces
  43. # SSRF (3+1): URLs come from admin-configured settings (external
  44. # cameras, Home Assistant, Tasmota). Validation added for scheme,
  45. # hostname, and metadata-service blocking. CodeQL still traces
  46. # taint through the validated URLs.
  47. - exclude:
  48. id: py/partial-ssrf
  49. - exclude:
  50. id: py/full-ssrf
  51. # Unused global variables (2): False positives — module-level
  52. # cache variables written via `global` in one function, read in
  53. # another. CodeQL doesn't track cross-function global reads.
  54. - exclude:
  55. id: py/unused-global-variable
  56. # Clear-text logging sensitive data (2): False positive —
  57. # `api_key` in firmware_check.py is a printer model identifier
  58. # string ("x1", "p1", "a1-mini"), not a secret.
  59. - exclude:
  60. id: py/clear-text-logging-sensitive-data
  61. # Clear-text storage sensitive data (1): JWT secret stored in
  62. # SQLite config with 0600 file permissions. Standard approach
  63. # for single-host deployment.
  64. - exclude:
  65. id: py/clear-text-storage-sensitive-data
  66. # Weak hashing on sensitive data (1): MD5 in bambu_mqtt.py used
  67. # with usedforsecurity=False for AMS tray fingerprinting, not
  68. # for security purposes.
  69. - exclude:
  70. id: py/weak-sensitive-data-hashing
  71. # Catch base exception (1): In frontend/node_modules third-party
  72. # code (flatted/python/flatted.py), outside our control.
  73. - exclude:
  74. id: py/catch-base-exception