Skip to content

Feature/enhancements#23

Open
G30RG3-GJ wants to merge 17 commits intoafsalashyana:masterfrom
G30RG3-GJ:feature/enhancements
Open

Feature/enhancements#23
G30RG3-GJ wants to merge 17 commits intoafsalashyana:masterfrom
G30RG3-GJ:feature/enhancements

Conversation

@G30RG3-GJ
Copy link

No description provided.

google-labs-jules bot and others added 17 commits February 11, 2026 22:30
The previous implementation of `prepareIV` used `java.util.Random` seeded with `System.currentTimeMillis()`, which is predictable and insecure for cryptographic operations. This change replaces it with `java.security.SecureRandom` to generate a cryptographically strong random IV.

This fixes a security vulnerability where the IV could be predicted, potentially compromising the encryption.

Also removed unused imports:
- `java.nio.charset.StandardCharsets`
- `java.security.MessageDigest`
- `java.util.Arrays`
- `java.util.Random`

Co-authored-by: G30RG3-GJ <203693057+G30RG3-GJ@users.noreply.github.com>
- Modified `showErrorMessage(Exception ex, String title, String content)` to include `styleAlert(alert)`. This ensures consistent styling for this overload and fixes a missing style application.
- Modified `showErrorMessage(Exception ex)` to delegate to `showErrorMessage(Exception ex, String title, String content)`, eliminating duplicated logic for alert creation and configuration.
- Preserved existing behavior for title and header text ("Error occured" / "Error Occured").

Co-authored-by: G30RG3-GJ <203693057+G30RG3-GJ@users.noreply.github.com>
…3569

🔒 Fix predictable IV generation in EncryptionUtil
…tion-14676278107199138789

Refactor AlertMaker to reduce code duplication
Co-authored-by: G30RG3-GJ <203693057+G30RG3-GJ@users.noreply.github.com>
- Refactored `DataHelper.insertNewBook` to accept `java.sql.Connection` for better testability.
- Added `DataHelperTest` using JUnit 4 and Mockito to verify SQL execution.
- Added test dependencies in `libs/test/`.
- Included stubs for `DatabaseHandler` and `MemberListController` in `test/stubs/` to enable compilation in non-JavaFX environments.
- Added `run_tests.sh` script to facilitate test execution.

Co-authored-by: G30RG3-GJ <203693057+G30RG3-GJ@users.noreply.github.com>
- Added JUnit 4.13.2, Hamcrest Core 1.3, and GreenMail 1.6.15 to libs/test/
- Updated nbproject/project.properties to include new test libs in classpath
- Created test/library/assistant/email/EmailUtilTest.java with integration test logic
- Verified test passes with mocked SMTP server

Co-authored-by: G30RG3-GJ <203693057+G30RG3-GJ@users.noreply.github.com>
…10603895794473152871

🧹 Remove unused main methods from Loader classes
…65157879989

Add integration test for EmailUtil
…16503906619777

Add test for DataHelper.insertNewBook
Moved the email validation Pattern to a static final constant in LibraryAssistantUtil.java to avoid recompiling the regex pattern every time validateEmailAddress is called.
Benchmark showed ~5x performance improvement.

Co-authored-by: G30RG3-GJ <203693057+G30RG3-GJ@users.noreply.github.com>
…10615770482714053210

⚡ Optimize email validation regex compilation
- Replaced broad `catch (Exception)` with specific `catch (SQLException)` in `DatabaseExporter.call()`.
- Updated `createBackup()` signature to throw `SQLException`.
- Wrapped `AlertMaker.showErrorMessage(exp)` in `Platform.runLater()` to ensure UI interaction occurs on the JavaFX Application Thread.
- Cleaned up unused imports.

This change improves maintainability by not masking RuntimeExceptions and fixes a potential threading issue when reporting errors from a background Task.

Co-authored-by: G30RG3-GJ <203693057+G30RG3-GJ@users.noreply.github.com>
…atabaseexporter-13287825710667073782

🧹 [code health] Narrow exception catching in DatabaseExporter and fix threading issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants