Private tool made to automate staff clocks around work.
  • Python 97.8%
  • Shell 1.2%
  • Dockerfile 1%
Find a file
andrei-iacobb bcee93d418 Refactor architecture and fix security vulnerabilities from audit
Major refactor from monolithic main.py to clean MVC architecture with
proper separation of concerns (core/, models/, controllers/, services/,
views/). Fixes all critical and high-severity issues from security audit:

- Fix backup data corruption (wrong dict key extraction)
- Hash PINs with SHA-256, force first-run setup, mask input fields
- Add rate limiting (5 attempts → 30s lockout) for admin access
- Atomic settings writes via tempfile + os.replace
- Add settings schema validation and JSON type checking
- Fix all resource leaks (SQLite connections use try/finally)
- Add thread lock on shared break state in ClockController
- Use socket context manager in printer connection test
- Add PRAGMA table name whitelist to prevent SQL injection
- Replace bare except clauses with specific exception types
- Add path traversal protection for archive deletion
- Remove sensitive files from git tracking (db, logs, settings)
- Add .dockerignore, .env.example for Docker secrets
- Upgrade Docker to Python 3.13, remove passwordless sudo
- Add resource limits and localhost-only ports in docker-compose
- Pin dependency versions, remove unused packages
- Remove duplicate timesheetDailyCheck.py
- Clean emoji characters from log messages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:15:53 +00:00
staffclock Refactor architecture and fix security vulnerabilities from audit 2026-03-13 20:15:53 +00:00
.dockerignore Refactor architecture and fix security vulnerabilities from audit 2026-03-13 20:15:53 +00:00
.DS_Store windows p123456789 2025-06-24 15:57:10 +01:00
.env.example Refactor architecture and fix security vulnerabilities from audit 2026-03-13 20:15:53 +00:00
.gitignore Add .gitignore and remove Python cache files 2025-11-19 16:50:28 +00:00
docker-compose.yml Refactor architecture and fix security vulnerabilities from audit 2026-03-13 20:15:53 +00:00
docker-entrypoint.sh better logging and better error handling and whatever 2025-06-30 15:54:40 +01:00
Dockerfile Refactor architecture and fix security vulnerabilities from audit 2026-03-13 20:15:53 +00:00
README.md windows p25 2025-06-21 14:44:07 +01:00
requirements.txt Refactor architecture and fix security vulnerabilities from audit 2026-03-13 20:15:53 +00:00
test_fixes.py Fix critical stability and payroll issues in StaffClock 2025-11-19 16:48:40 +00:00

Staff Digital Timesheet System

A comprehensive staff clock-in/clock-out system with fingerprint authentication, timesheet management, and visitor tracking.

Features

  • Digital Clock In/Out: Staff can clock in and out using staff codes or fingerprints (continuous scanning)
  • Fingerprint Authentication: DigitalPersona U.are.U 4500 integration with user-friendly enrollment
  • Admin Panel: Complete staff management, record editing, and system administration
  • Timesheet Generation: Automated PDF timesheet generation with customizable scheduling
  • Visitor Management: Track and manage visitor entries and exits
  • Archive System: Database archiving and backup functionality
  • Real-time Backup: Continuous data protection with automatic backups

Quick Start

  1. Install Dependencies:

    pip install -r requirements.txt
    
  2. Run the Application:

    python main.py
    
  3. Initial Setup:

    • Connect DigitalPersona fingerprint scanner (optional)
    • Access Admin Panel (default PIN: 1234)
    • Add staff members
    • Enroll fingerprints for enhanced security

System Requirements

  • Windows 10/11
  • Python 3.13+
  • DigitalPersona U.are.U 4500 fingerprint scanner (optional)
  • PyQt6

Key Components

  • main.py - Main application with integrated enrollment UI
  • fingerprint_manager.py - Fingerprint device management
  • digitalpersona_sdk_simple.py - DigitalPersona SDK interface
  • biometric_enrollment.py - Biometric profile management

Database

The system uses SQLite databases:

  • staff_timesheet.db - Main operational database
  • biometric_profiles.db - Fingerprint templates and profiles
  • Archive databases in Archive_Databases/ folder

License

Proprietary software for internal use.

Running the Application

For Windows:

Double-click on run_staffclock.bat.

For macOS/Linux:

  1. Open a terminal.
  2. Make the script executable: chmod +x run_staffclock.sh
  3. Run the script: ./run_staffclock.sh

Background Timesheet Monitoring