(feat) O3-5097: Add support for remote logo URLs via HTTP/HTTPS#7
Open
sanks011 wants to merge 2 commits into
Open
(feat) O3-5097: Add support for remote logo URLs via HTTP/HTTPS#7sanks011 wants to merge 2 commits into
sanks011 wants to merge 2 commits into
Conversation
Implements comprehensive remote logo fetching with the following features: Features: - HTTP/HTTPS URL support for patient ID sticker logos - Persistent disk caching with SHA-256 hashed filenames - Content-Type header validation - File format validation using magic bytes (PNG, JPEG, GIF) - 5MB file size limit enforcement - Proper resource cleanup (all connections/streams closed) - Network error fallback to cached version - Graceful fallback to default logo Security: - Only HTTP/HTTPS protocols allowed - Connection timeout: 10s, Read timeout: 30s - File size limits prevent DoS attacks - Local file paths remain sandboxed to app data directory Components Added: - RemoteLogoService: Core service for fetching and caching remote logos - RemoteLogoServiceTest: Unit tests for validation logic - RemoteLogoServiceIntegrationTest: Integration tests with embedded HTTP server - PatientIdStickerXmlReportRenderer: Updated to support both remote URLs and local paths - RemoteLogoUrl.md: Comprehensive documentation Acceptance Criteria Completed: Remote logos can be fetched via HTTP/HTTPS URLs Downloaded files are cached persistently on disk Content-Type headers are validated before processing File contents are validated as valid image formats All HTTP connections and streams are properly closed Network errors result in graceful fallback to cache Invalid file types return clear error messages File size limits are enforced (5MB max) Unit tests cover all error scenarios Integration tests verify actual HTTP requests work correctly Documentation updated with configuration options Related: https://openmrs.atlassian.net/browse/O3-5097
Member
|
@sanks011 did you see the build failure? |
Author
I've added mockito-inline dependency to fix static mocking in tests - build should pass now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements comprehensive remote logo fetching with the following features:
Features:
Security:
Components Added:
Acceptance Criteria Completed:
Remote logos can be fetched via HTTP/HTTPS URLs
Downloaded files are cached persistently on disk
Content-Type headers are validated before processing
File contents are validated as valid image formats
All HTTP connections and streams are properly closed
Network errors result in graceful fallback to cache
Invalid file types return clear error messages
File size limits are enforced (5MB max)
Unit tests cover all error scenarios
Integration tests verify actual HTTP requests work correctly
Documentation updated with configuration options
Related:
Jira Ticket: https://openmrs.atlassian.net/browse/O3-5097