Skip to content

Conversation

@siujamo
Copy link
Contributor

@siujamo siujamo commented Jun 4, 2025

Whats new

  • Generates UUIDv7
  • Bug fixes

@siujamo siujamo requested a review from Copilot June 4, 2025 03:18
@siujamo siujamo self-assigned this Jun 4, 2025
@siujamo siujamo added bug Something isn't working or works not as expected documentation Improvements or additions to documentation enhancement New feature or request labels Jun 4, 2025
@siujamo siujamo requested a review from zihluwang June 4, 2025 03:18
@siujamo siujamo merged commit 6c8ed1c into main Jun 4, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This release upgrades the GUID and utility modules by adding UUIDv7 support and cleaning up utility behaviors and tests.

  • Introduces SequentialUuidCreator for UUID version 7 generation.
  • Removes unused SLF4J loggers and tightens exception handling in utility classes (RangeUtil, CollectionUtil, AesUtil, etc.).
  • Adds comprehensive JUnit tests for core utilities and updates method contracts (throws, messages).

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
guid/src/main/java/com/onixbyte/guid/impl/SnowflakeGuidCreator.java Removed unused SLF4J logger
guid/src/main/java/com/onixbyte/guid/impl/SequentialUuidCreator.java New class implementing UUIDv7 spec
devkit-utils/src/main/java/com/onixbyte/devkit/utils/RangeUtil.java Fixed range logic, updated exception messages and Javadoc
devkit-utils/src/main/java/com/onixbyte/devkit/utils/CollectionUtil.java Tightened maxSize check, removed logger
devkit-utils/src/main/java/com/onixbyte/devkit/utils/AesUtil.java Swallowed errors → throws GeneralSecurityException, improved API
devkit-utils/src/main/java/com/onixbyte/devkit/utils/MapUtil.java Removed unused SLF4J logger
devkit-utils/src/main/java/com/onixbyte/devkit/utils/HashUtil.java Removed unused SLF4J logger
devkit-utils/src/main/java/com/onixbyte/devkit/utils/Base64Util.java Removed unused SLF4J logger
devkit-utils/src/main/java/com/onixbyte/devkit/utils/BoolUtil.java Removed unused SLF4J logger
devkit-utils/src/main/java/com/onixbyte/devkit/utils/BranchUtil.java Removed deprecated method and logger
devkit-utils/src/test/java/com/onixbyte/devkit/utils/* Removed outdated tests, added new coverage for all utility methods
Comments suppressed due to low confidence (2)

guid/src/main/java/com/onixbyte/guid/impl/SequentialUuidCreator.java:39

  • The new SequentialUuidCreator lacks unit tests; consider adding tests to verify UUIDv7 timestamp encoding, version bits, and variant bits compliance.
public class SequentialUuidCreator implements GuidCreator<UUID> {

guid/src/main/java/com/onixbyte/guid/impl/SequentialUuidCreator.java:57

  • [nitpick] Variable 'value' is ambiguous—rename to 'bytes' or 'uuidBytes' for better clarity.
var value = randomBytes();

Comment on lines +74 to +75
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, new IvParameterSpec(secret));
return cipher.doFinal(data);
Copy link

Copilot AI Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the static secret key as IV can lead to IV reuse vulnerabilities in CBC mode; consider generating a random IV per encryption and prefixing it to the ciphertext.

Suggested change
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, new IvParameterSpec(secret));
return cipher.doFinal(data);
var iv = new byte[16]; // AES block size is 16 bytes
var secureRandom = new java.security.SecureRandom();
secureRandom.nextBytes(iv);
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, new IvParameterSpec(iv));
var encryptedData = cipher.doFinal(data);
var result = new byte[iv.length + encryptedData.length];
System.arraycopy(iv, 0, result, 0, iv.length);
System.arraycopy(encryptedData, 0, result, iv.length, encryptedData.length);
return result;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working or works not as expected documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants