Commit Graph
202 Commits
Author SHA1 Message Date
CameronandClaude Sonnet 4.5 2c52cffd65 Implement critical security improvements for authentication
This commit addresses several security vulnerabilities in the authentication
and authorization system:

1. JWT Encoding Panic Fix (Critical)
   - Replace .unwrap() with proper error handling in JWT token generation
   - Prevents server crashes from encoding failures
   - Returns HTTP 500 with error logging instead of panicking

2. Rate Limiting for Login Endpoint (Critical)
   - Add actix-governor dependency (v0.5)
   - Configure rate limiter: 2 requests/sec with burst of 5
   - Protects against brute-force authentication attacks

3. Strengthen Password Requirements
   - Minimum length increased from 6 to 12 characters
   - Require uppercase, lowercase, numeric, and special characters
   - Add comprehensive validation with clear error messages

4. Fix Token Parsing Vulnerability
   - Replace unsafe split().last().unwrap_or() pattern
   - Use strip_prefix() for proper Bearer token validation
   - Return InvalidToken error for malformed Authorization headers

5. Improve Authentication Logging
   - Sanitize error messages to avoid leaking user existence
   - Change from "User not found or incorrect password" to "Failed login attempt"

All changes tested and verified with existing test suite (65/65 tests passing).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-26 23:53:54 -05:00
Cameron c0021734b6 Try fixing Otel span propogation 2025-12-24 10:17:14 -05:00
Cameron c035678162 Add tracing to EXIF DAO methods 2025-12-23 22:57:24 -05:00
Cameron 636701a69e Refactor file type checking for better consistency
Fix tests
2025-12-23 22:30:53 -05:00
Cameron 6dbac6f22f Run cargo fmt/fix 2025-12-23 22:07:50 -05:00
Cameron 47d3ad7222 Add polling-based file watching
Remove notify and update otel creates
2025-12-22 22:54:19 -05:00
Cameron eb8e08b9ff Add EXIF search infrastructure (Phase 1 & 2)
Implements foundation for EXIF-based photo search capabilities:

- Add geo.rs module with GPS distance calculations (Haversine + bounding box)
- Extend FilesRequest with EXIF search parameters (camera, GPS, date, media type)
- Add MediaType enum and DateTakenAsc/DateTakenDesc sort options
- Create date_taken index migration for efficient date queries
- Implement ExifDao methods: get_exif_batch, query_by_exif, get_camera_makes
- Add FileWithMetadata struct for date-aware sorting
- Implement date sorting with filename extraction fallback
- Make extract_date_from_filename public for reuse

Next: Integrate EXIF filtering into list_photos() and enhance get_all_tags()
2025-12-18 09:34:07 -05:00
Cameron 52e1ced2a2 Improved image caching and CORS handling 2025-12-17 22:36:03 -05:00
Cameron c6b1b46629 Fix video part directory traversal 2025-12-17 22:32:46 -05:00
Cameron e4d988a9fd Cargo formatting 2025-12-17 22:10:03 -05:00
Cameron 4082f1fdb8 Add Exif storing and update to Metadata endpoint 2025-12-17 16:55:48 -05:00
Cameron f02a858368 Bump to 0.3.1 and format/clippy 2025-12-01 13:04:55 -05:00
Cameron 273b877e16 Update to Rust 2024 edition
Formatted code.
2025-09-01 13:36:27 -04:00
Cameron caed787c04 Add /memories endpoint 2025-08-09 22:24:48 -04:00
Cameron e5afdd909b Serve video gifs when requested 2025-07-02 15:48:49 -04:00
Cameron 3fbdba2b9c Merge branch 'master' into feature/video-gifs 2025-06-16 21:06:38 -04:00
Cameron 2c553a8016 Additional logging and tracing enhancements 2025-06-04 15:05:23 -04:00
Cameron 785ce157e6 Get Otel span from the request 2025-05-23 18:24:54 -04:00
Cameron d37deb36fe Additional Otel logging and spans 2025-05-23 14:51:54 -04:00
Cameron fe0446a43f Merge branch 'master' into feature/video-gifs
# Conflicts:
#	Cargo.toml
#	src/files.rs
#	src/main.rs
2025-05-17 15:57:01 -04:00
Cameron 484eec8b39 Only use Otel on release builds 2025-05-17 13:41:30 -04:00
Cameron d6451ee782 Add Simple OpenTelemetry setup 2025-05-06 20:15:03 -04:00
Cameron b2a361faba First pass on creating gifs from a video 2024-12-07 21:49:33 -05:00
Cameron 4e4a2240cf Move video.rs into its own module 2024-12-07 21:46:37 -05:00
Cameron 0419aa2323 Scan and generate Video HLS playlists on startup
Refactored and improved video path state. Bumped versions of some dependencies.
2024-12-05 20:19:03 -05:00
Cameron 860e7a97fb Use TagDao for improved filtering 2024-11-24 09:49:03 -05:00
Cameron 287a61ae3f Update dependencies, improve startup logging 2024-11-23 12:14:12 -05:00
Cameron Cordes 9a486b3f66 Use PhotoSize enum in file requests 2024-06-30 17:49:55 -04:00
Cameron Cordes 05a56ba0bd Fix Recursive searching with tags including Any and All filter modes 2024-03-09 13:11:55 -05:00
Cameron Cordes 30dba33e47 Refresh thumbnails after an upload or file move 2024-02-21 17:24:16 -05:00
Cameron Cordes 419dd7e7e5 Add Move File functionality and endpoint 2024-01-21 21:10:13 -05:00
Cameron Cordes 5bbc775d3a Update to Watcher 6
Improve upload performance by relying on the file watcher instead of
synchronously creating thumbnails before responding to the client.
2024-01-17 22:25:18 -05:00
Cameron Cordes 195d522f64 Add file upload log in happy path and update log level for duplicate path 2024-01-17 21:00:15 -05:00
Cameron Cordes bf7fb810de Fix duplicate file naming 2024-01-17 20:45:36 -05:00
Cameron Cordes 9e8f02240f Put timestamp in file name if uploaded file already exists 2023-04-30 11:37:23 -04:00
Cameron Cordes 8bcd837038 Fix file upload
Add a flag for new files so we can skip the exists check when seeing if
the new file is within the base directory.
2023-04-03 08:41:03 -04:00
Cameron Cordes ae2642a544 Fix warnings, and general code cleanup 2023-03-25 20:52:20 -04:00
Cameron Cordes ae8665f632 Fix clippy warnings 2023-03-22 15:17:48 -04:00
Cameron Cordes 4ded708911 Extract FileSystem to a trait for better testability
Added some tests around filtering and searching by Tags. Added the
ability to use an in-memory Sqlite DB for more integration tests.
2023-03-22 15:17:33 -04:00
Cameron Cordes 7d05c9b8bf Add filtering by Tag to /images endpoint 2023-03-20 08:14:12 -04:00
Cameron Cordes de4041bd17 Refactor tags services and added tests
Implemented some functionality which will allow the service
configuration of the app to be split among the features for readability
and testability.
2023-03-19 15:05:20 -04:00
Cameron Cordes 8bcd9440bf Add Endpoint for Batch add/removal of tags on a file 2023-03-19 12:13:04 -04:00
Cameron Cordes f98d3261a7 Fix tags all and tags for photo endpoints 2023-03-18 21:00:26 -04:00
Cameron Cordes 68bfcbf85f Update and Migrate Diesel to 2.0
Almost have tag support working, still figuring out how to get photo
tags.
2023-03-18 14:43:41 -04:00
Cameron Cordes 40c79d13db Move tags to their own module
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2022-03-17 22:07:33 -04:00
Cameron Cordes c8cae28c9f Merge branch 'master' into feature/tagging 2022-03-17 21:53:17 -04:00
Cameron Cordes 528db5da3a Move app state to its own module
Core Repos/ImageApi/pipeline/pr-master This commit looks good
2022-03-17 19:40:07 -04:00
Cameron Cordes 4d9b7c91a1 Improve testability and remove boxing
Core Repos/ImageApi/pipeline/pr-master There was a failure building this commit
Leverage generics to remove the extra heap allocation for the response
handlers using Dao's. Also moved some of the environment variables to
app state to allow for easier testing.
2022-03-16 20:51:37 -04:00
Cameron Cordes 69fe307516 Update to Actix 4
Core Repos/ImageApi/pipeline/pr-master There was a failure building this commit
2022-03-01 20:38:41 -05:00
Cameron Cordes 9cd19d03eb Create Delete Tag endpoint
Core Repos/ImageApi/pipeline/pr-master There was a failure building this commit
2021-11-30 20:07:00 -05:00