mirror of
https://github.com/Donkie/Spoolman.git
synced 2026-10-22 01:52:17 -05:00
b4d7955eaac8a14a20e79b5b785fbbf7aeb4f520
Phase 1 created auth_audit_log and deliberately left spoolman/auth/audit.py unwritten, because an empty stub fails the docstring lint. This writes it. What is recorded is every sign-in attempt plus anything that alters permissions. Ordinary data changes are deliberately excluded: creating a spool is already visible in the spool, and mixing those in would bury the handful of security-relevant events under thousands of routine ones, which is how audit logs stop being read. Three properties are load-bearing: Writing never breaks the operation it describes. record() swallows and logs its own failures, and uses its own database session rather than the caller's. Login attempts have already committed by the time they are audited, several call sites hold no session at all, and sharing one would let an audit write roll back the thing it was recording. The response and the log disagree on purpose. A failed sign-in tells the caller only "incorrect username or password" -- distinguishing the cases would let anyone enumerate accounts -- while the audit entry records which case it was. Its readers are administrators who already know which accounts exist, and "somebody is trying to sign in to the account you disabled" is exactly what a log is for. Entries outlive their subjects. Deleting a user detaches their entries rather than cascading, since a log that erases what an account did the moment the account is removed is not evidence of anything. The username survives in the target column, so the trail stays readable. Retention is a database setting rather than an environment variable: it is a policy an administrator revises, not a deployment parameter, and changing it should not need a restart. The nightly sweep is only scheduled when auth is enabled, so existing instances do not grow a job that can never do anything. It runs half an hour after the backup so the two do not contend for SQLite's single write lock. Reading the log needs admin. It holds addresses, user agents and the list of accounts, so serving it at 'read' would hand an anonymous browser a map of the instance's users. Claude-Session: https://claude.ai/code/session_01J3YgMAnSapoXqS9iU8Xnmk
Keep track of your inventory of 3D-printer filament spools.
Spoolman is a self-hosted web service designed to help you efficiently manage your 3D printer filament spools and monitor their usage. It acts as a centralized database that seamlessly integrates with popular 3D printing software like OctoPrint and Klipper/Moonraker. When connected, it automatically updates spool weights as printing progresses, giving you real-time insights into filament usage.
Features
- Filament Management: Keep comprehensive records of filament types, manufacturers, and individual spools.
- API Integration: The REST API allows easy integration with other software, facilitating automated workflows and data exchange.
- Real-Time Updates: Stay informed with live spool updates through Websockets, providing immediate feedback during printing operations.
- Central Filament Database: A community-supported database of manufacturers and filaments simplify adding new spools to your inventory. Contribute by heading to SpoolmanDB.
- Web-Based Client: Spoolman includes a built-in web client that lets you manage data effortlessly:
- View, create, edit, and delete filament data.
- Add custom fields to tailor information to your specific needs.
- Print labels with QR codes for easy spool identification and tracking.
- Contribute to its translation into 18 languages via Weblate.
- Database Support: SQLite, PostgreSQL, MySQL, and CockroachDB.
- Multi-Printer Management: Handles spool updates from several printers simultaneously.
- Advanced Monitoring: Integrate with Prometheus for detailed historical analysis of filament usage, helping you track and optimize your printing processes. See the Wiki for instructions on how to set it up.
Spoolman integrates with:
- Moonraker and most front-ends (Fluidd, KlipperScreen, Mainsail, ...)
- OctoPrint
- OctoEverywhere
- Home Assistant
- MCP Server - Manage your filament inventory through AI assistants like Claude using the Model Context Protocol
Installation
Please see the Installation page on the Wiki for details how to install Spoolman.
Description
Keep track of your inventory of 3D-printer filament spools.
Readme
MIT
15 MiB
0 Stars
1 Watchers
0 Forks