Skip to content

PII issues fixes with backward compatibility [MOSIP-44379] - #1030

Merged
mayuradesh merged 122 commits into
mosip:developfrom
GOKULRAJ136:MOSIP-PII-new
Aug 3, 2026
Merged

mayuradesh merged 122 commits into
mosip:developfrom
GOKULRAJ136:MOSIP-PII-new

Conversation

@GOKULRAJ136

@GOKULRAJ136 GOKULRAJ136 commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced user identity management with improved identifier handling and resolution capabilities
    • Added privacy-preserving identifier masking throughout system logs to protect user information
    • Introduced backward-compatibility mode for legacy user data handling
  • Chores

    • Updated MOSIP kernel dependencies to version 1.3.0

@coderabbitai

coderabbitai Bot commented Mar 3, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This pull request introduces a canonical user identity system for pre-registration that normalizes user identifiers to UUIDs, replacing plaintext identifiers in audit fields. It adds a new user_details database table, a UserDetailsService for UUID resolution and caching, an ApplicationIdentityMigrationService for data migration, and updates repositories and services to use batch lookups and masked logging. It includes backward-compatibility support via a configuration flag.

Changes

Cohort / File(s) Summary
Database Schema & Core Entities
db_scripts/mosip_prereg/ddl/user_details.sql, db_scripts/mosip_prereg/ddl.sql, pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/entity/UserDetails.java, pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/repository/UserDetailsRepository.java
Creates prereg.user_details table with UUID primary key, hash-based lookups, and encrypted identifiers; adds DDL include; defines JPA entity and repository for canonical user identity persistence.
User Identity Service
pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/service/UserDetailsService.java, pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java
Core service providing UUID resolution, identifier hashing, encryption, caching, PII masking, and user matching with optional backward-compatibility fallback; includes comprehensive test coverage for resolution, encryption, and compatibility modes.
Entity Effective Accessors
pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/entity/ApplicationEntity.java, pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/entity/DemographicEntity.java, pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/entity/DocumentEntity.java, pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/entity/RegistrationBookingEntity.java, pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/entity/AvailibityEntity.java, pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/entity/RegistrationBookingEntityConsumed.java, pre-registration/pre-registration-datasync-service/src/main/java/io/mosip/preregistration/datasync/entity/InterfaceDataSyncEntity.java, pre-registration/pre-registration-datasync-service/src/main/java/io/mosip/preregistration/datasync/entity/ProcessedPreRegEntity.java
Adds getEffective* accessor methods across all audit entity classes to unify access to crBy/updBy/createdBy/updatedBy fields; updates documentation to reflect legacy plaintext or UUID semantics.
Application Identity Migration
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationIdentityMigrationService.java, pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/ApplicationIdentityMigrationServiceTest.java
New transactional service to migrate raw user identifiers to canonical UUIDs across linked Application, Demographic, Document, and Booking entities; resolves effective user IDs with backward-compatibility support.
Repository Batch Query Methods
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/repository/ApplicationRepostiory.java, pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/repository/DemographicRepository.java, pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/repository/RegAppointmentRepository.java
Adds new Spring Data methods for batch user-ID lookups: findByCreatedByIn, findByCreatedByInBookingType, findByCreatedByInAndStatusCode*; creates new repository for RegistrationBookingEntity.
Application Service Refactoring
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java, pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java, pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/DemographicService.java, pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/LoginService.java, pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/DocumentService.java, pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/CommonServiceUtil.java, pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DemographicServiceUtil.java, pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DocumentServiceUtil.java
Integrates canonical user identity via UserDetailsService and ApplicationIdentityMigrationService; replaces raw user comparisons with matchesUser(...); updates user-scoped queries to use batch lookups with getUserLookupIds(...); adds identifier masking in logs; uses getEffective* accessors for audit fields; triggers identity migration after persistence operations.
Login & OTP Logging
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LoginController.java, pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/OTPManager.java
Updates debug logging to mask user identifiers via userDetailsService.maskIdentifier(...); adds service injection and trailing newlines.
Data Sync Service Refactoring
pre-registration/pre-registration-datasync-service/src/main/java/io/mosip/preregistration/datasync/service/DataSyncService.java, pre-registration/pre-registration-datasync-service/src/main/java/io/mosip/preregistration/datasync/service/util/DataSyncServiceUtil.java
Derives audit user ID from Spring Security context instead of hardcoded "user"; integrates UserDetailsService for effective user resolution; adds HTTP error handling for downstream booking calls; masks identifiers in logs.
Batch Job Service
pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/impl/ApplicationConsumedStatusUpdater.java
Adds UserDetailsService integration to resolve canonical user UUIDs for consumed-table writes; resolves creator/updater fields from source entities using getEffective* accessors; supports backward-compatibility flag.
Configuration Properties
pre-registration/pre-registration-application-service/src/main/resources/application.properties, pre-registration/pre-registration-application-service/src/test/resources/application.properties, pre-registration/pre-registration-datasync-service/src/main/resources/application.properties, pre-registration/pre-registration-datasync-service/src/test/resources/application.properties
Introduces new mosip.prereg.pii.backward.compatibility flag (set to false) to control gradual migration to canonical user identities.
Maven Dependencies
pre-registration/pom.xml, pre-registration/pre-registration-application-service/pom.xml, pre-registration/pre-registration-core/pom.xml, pre-registration/pre-registration-datasync-service/pom.xml
Upgrades MOSIP kernel BOM version from 1.2.1-SNAPSHOT to 1.3.0; pins kernel-core and kernel-auth-adapter to 1.3.0.
Application Service Tests
pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/ApplicationServiceTest.java, pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/AppointmentServiceImplTest.java, pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/DemographicServiceTest.java, pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/DocumentServiceTest.java, pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/LoginServiceTest.java, pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/service/AppointmentServiceTest.java, pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/service/util/DemographicServiceUtilTest.java, pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/service/util/DocumentServiceUtilTest.java, pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/controller/LoginControllerTest.java, pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/OTPManagerTest.java
Mocks UserDetailsService and ApplicationIdentityMigrationService in test suites; updates repository mock expectations to use batch query methods; uses canonical UUID values instead of raw identifiers in fixtures; stubs user matching and resolution logic; adds backward-compatibility flag configuration.
Data Sync Tests
pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/config/TestSecurityConfig.java, pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/service/DataSyncServiceTest.java, pre-registration/pre-registration-datasync-service/src/test/java/io/mosip/preregistration/datasync/test/service/util/DataSyncServiceUtilTest.java
Renames test security bean to testUserDetailsService() and marks as @Primary; stubs AuthUserDetails methods; broadens Mockito matcher; updates file formatting.

Sequence Diagram

sequenceDiagram
    participant AuthUser as Auth User Request
    participant AppService as ApplicationService
    participant UDS as UserDetailsService
    participant UDRepo as UserDetailsRepository
    participant AIM as ApplicationIdentityMigrationService
    participant DB as Database
    participant Cache as Cache

    AuthUser->>AppService: addLostOrUpdateApplication(userId)
    AppService->>UDS: getUserLookupIds(userId, piiBackCompat)
    UDS->>UDS: normalizeIdentifier(userId)
    UDS->>UDS: computeIdentifierHash()
    UDS->>Cache: checkCache(hash)
    alt Cache Hit
        Cache-->>UDS: UserDetails UUID
    else Cache Miss
        UDS->>UDRepo: findByIdentifierHash(hash)
        alt Not Found
            UDS->>UDS: encryptIdentifier(userId)
            UDS->>UDRepo: save(new UserDetails)
            UDRepo->>DB: INSERT user_details
            DB-->>UDRepo: Saved with UUID
        else Found
            UDRepo-->>UDS: Existing UserDetails
        end
        UDS->>Cache: cachePut(hash, UserDetails)
    end
    UDS-->>AppService: [canonicalUUID, ...]
    
    AppService->>DB: findByCreatedByIn(lookupIds)
    DB-->>AppService: ApplicationEntities
    
    AppService->>AppService: Match authUser against entities
    AppService->>AIM: migrateRawUserToEffectiveUser(preRegId, effectiveUserId)
    AIM->>DB: findApplication(preRegId)
    AIM->>DB: findDemographic(preRegId)
    AIM->>DB: findDocuments(preRegId)
    AIM->>DB: findBooking(preRegId)
    
    AIM->>AIM: Update crBy, updBy, contactInfo
    AIM->>DB: save(updatedEntities)
    AIM-->>AppService: Migration complete
    
    AppService-->>AuthUser: Success Response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 Whiskers twitch with joy so bright,
UUIDs dance in hashes' light,
User IDs canonicalized with care,
Encryption keeps identities rare,
Backward-compat paths everywhere!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.58% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: introducing PII (Personally Identifiable Information) issue fixes while maintaining backward compatibility, with a reference to the tracking issue.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 16

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java (1)

553-567: ⚠️ Potential issue | 🟡 Minor

Authorization logic could allow unintended access with backward compatibility enabled.

When piiBackwardCompatibility is true and effectiveCrBy matches the raw authUserId, the method returns early (Line 563-564) without validating if the role check was intended. This could allow access if the raw user ID accidentally matches another user's canonical ID.

🛡️ Proposed fix to make the logic explicit
 		if (!effectiveCrBy.equals(canonicalAuthUserId)) {
-			if (piiBackwardCompatibility && authUserId != null && effectiveCrBy.equals(authUserId.trim())) {
-				return;
-			}
+			// Backward compatibility: also accept raw identifier match
+			if (piiBackwardCompatibility && authUserId != null && !authUserId.trim().isEmpty() 
+					&& effectiveCrBy.equals(authUserId.trim())) {
+				log.debug(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID, 
+					"Authorization passed via backward compatibility for application: " + applicationEntity.getApplicationId());
+				return;
+			}
 				throw new PreIdInvalidForUserIdException(ApplicationErrorCodes.PRG_APP_015.getCode(),
 						ApplicationErrorMessages.INVALID_APPLICATION_ID_FOR_USER.getMessage());
 		}
🧹 Nitpick comments (20)
pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/AppointmentServiceImplTest.java (1)

598-606: Limit helper class scope to this test class.

NullAuthority can be declared private static final since it is only test scaffolding used internally.

🔧 Suggested tweak
-static class NullAuthority implements GrantedAuthority {
+private static final class NullAuthority implements GrantedAuthority {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/AppointmentServiceImplTest.java`
around lines 598 - 606, The NullAuthority helper class should be made private
static final to limit its scope to this test class; locate the static inner
class named NullAuthority (implements GrantedAuthority) and change its
declaration from package-private static to private static final so it remains
test-scoped and immutable.
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LoginController.java (2)

269-297: Consider extracting to a shared utility class.

The AI summary indicates similar masking utilities exist in LoginService, AppointmentServiceImpl, DemographicService, and other classes. Centralizing this logic into a common utility would reduce duplication and ensure consistent masking behavior across the codebase.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LoginController.java`
around lines 269 - 297, Extract the masking logic from
LoginController.maskIdentifier into a shared utility (e.g.,
IdentifierMaskUtils.maskIdentifier) and replace duplicated implementations in
LoginService, AppointmentServiceImpl, DemographicService, and other classes to
call this single static utility method; ensure the utility preserves current
behavior for emails, phone numbers (with optional '+'), UUIDs and fallback
masking, keep null/blank handling, add unit tests for the utility, and update
imports/usages across callers so all components use
IdentifierMaskUtils.maskIdentifier.

290-294: Catch IllegalArgumentException instead of Exception.

UUID.fromString() throws IllegalArgumentException for invalid UUIDs. Catching the broad Exception type could mask unexpected errors.

Suggested fix
 		try {
 			UUID.fromString(trimmed);
 			return "***" + trimmed.substring(trimmed.length() - 6);
-		} catch (Exception ignored) {
+		} catch (IllegalArgumentException ignored) {
 		}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LoginController.java`
around lines 290 - 294, Replace the broad catch in LoginController's UUID
masking logic with a catch for IllegalArgumentException only: when calling
UUID.fromString(trimmed) inside the method that returns masked UUID (the block
returning "***" + trimmed.substring(...)), change the catch(Exception ignored)
to catch(IllegalArgumentException ignored) so only invalid-UUID errors are
handled and other exceptions aren't accidentally suppressed; keep the existing
handling (silently ignore or log) consistent with current behavior.
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/LoginService.java (1)

478-483: Remove unreachable small-length phone branch.

Line 481-483 is unreachable because line 478 already constrains digits to 10..12. Removing it will simplify the method.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/LoginService.java`
around lines 478 - 483, In the LoginService class, remove the unreachable
small-length phone branch inside the trimmed.matches("\\+?\\d{10,12}") block:
delete the inner if (digits.length() <= 4) { return (hasPlus ? "+" : "") +
"****"; } since digits is already constrained to 10..12 by the regex; leave the
remaining masking logic in this block intact so the method compiles and behavior
is unchanged for valid 10–12 digit inputs.
db_scripts/mosip_prereg/ddl/user_details.sql (2)

16-16: Remove duplicate index on identifier_hash.

Line 16 (UNIQUE) already creates an index. idx_prereg_user_details_hash duplicates it and adds unnecessary write overhead.

Proposed DDL cleanup
-CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_prereg_user_details_hash
-ON prereg.user_details(identifier_hash);

Also applies to: 25-27

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@db_scripts/mosip_prereg/ddl/user_details.sql` at line 16, The schema defines
identifier_hash VARCHAR(128) NOT NULL UNIQUE which already creates a unique
index, so remove the redundant index creation for idx_prereg_user_details_hash
(and any duplicate index statements at lines corresponding to the other
occurrences mentioned) to avoid double indexing; update the DDL to drop or omit
the CREATE INDEX/ADD INDEX statements that reference
idx_prereg_user_details_hash while keeping the UNIQUE constraint on
identifier_hash in the user_details table definition.

28-29: Reconsider idx_prereg_user_details_active key choice.

This partial index keys on user_id, but user_id is already primary-key indexed. Unless you have a proven query pattern that benefits from this exact predicate+key, this is likely redundant.

Proposed DDL cleanup
-CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_prereg_user_details_active
-ON prereg.user_details(user_id) WHERE identifier_encrypted IS NOT NULL;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@db_scripts/mosip_prereg/ddl/user_details.sql` around lines 28 - 29, The
partial index idx_prereg_user_details_active on table user_details uses user_id
as its key while filtering on identifier_encrypted IS NOT NULL, which is
redundant because user_id is already primary-key indexed; either drop this index
or change it to index the column(s) actually used by queries that include the
predicate (for example index identifier_encrypted or the combination of
identifier_encrypted plus any frequently queried columns), and update DDL to
remove or replace CREATE INDEX CONCURRENTLY IF NOT EXISTS
idx_prereg_user_details_active with the appropriate index definition that
matches real query patterns.
pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/entity/AvailibityEntity.java (1)

90-96: Naming inconsistency across entities.

This entity uses getEffectiveCrBy() / getEffectiveUpdBy(), while InterfaceDataSyncEntity uses getEffectiveCreatedBy() / getEffectiveUpdatedBy(). Consider standardizing the naming convention across all entities for consistency and easier maintenance.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/entity/AvailibityEntity.java`
around lines 90 - 96, The AvailibityEntity exposes getEffectiveCrBy() and
getEffectiveUpdBy() which are inconsistent with InterfaceDataSyncEntity's
getEffectiveCreatedBy() and getEffectiveUpdatedBy(); rename AvailibityEntity's
methods to getEffectiveCreatedBy() and getEffectiveUpdatedBy(), update any
internal field mappings (crBy -> createdBy/upBy -> updatedBy or keep fields but
ensure getters map correctly), and search/replace all usages of
getEffectiveCrBy() and getEffectiveUpdBy() to the new method names to maintain
API consistency across entities.
pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/DocumentServiceTest.java (1)

161-177: Consider extracting this setup block into a test helper.

This setter chain is correct, but moving it into a small fixture/builder helper would reduce setup noise and future drift in this test class.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/DocumentServiceTest.java`
around lines 161 - 177, Extract the repeated DocumentEntity setup in
DocumentServiceTest into a test helper/builder to reduce noise: create a factory
method (e.g., buildTestDocumentEntity or DocumentEntityBuilder) that
encapsulates constructing DocumentEntity and setting fields used here
(demographicEntity, documentId, docName, docCatCode, docTypeCode, docFileFormat,
statusCode, langCode, crBy, crDtime, updBy, updDtime using
DateUtils.parseDateToLocalDateTime(new Date()), encryptedDateTime, docId,
docHash using HashUtill.hashUtill(cephBytes), refNumber) and replace the inline
block in tests with a call to that helper; keep the helper in test sources so
other tests can reuse it and update instantiations in DocumentServiceTest to use
the new builder API.
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/OTPManager.java (1)

144-155: Deduplicate canonical user resolution logic.

The create/update branches repeat the same mapping/fallback block. Extracting a helper will keep behavior consistent and reduce maintenance risk.

Refactor sketch
+	private String resolveActorIdWithFallback() {
+		String fallback = environment.getProperty(PreRegLoginConstant.MOSIP_PRE_REG_CLIENTID);
+		try {
+			UserDetails mappedUser = userDetailsService.findOrCreateByIdentifier(fallback);
+			if (mappedUser != null && mappedUser.getUserId() != null) {
+				return mappedUser.getUserId().toString();
+			}
+		} catch (Exception e) {
+			logger.warn(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID, "UserDetails mapping failed", e);
+		}
+		return fallback;
+	}
@@
-			try {
-				UserDetails mappedUser = userDetailsService.findOrCreateByIdentifier(environment.getProperty(PreRegLoginConstant.MOSIP_PRE_REG_CLIENTID));
-				if (mappedUser != null && mappedUser.getUserId() != null) {
-					otpTxn.setUpdBy(mappedUser.getUserId().toString());
-				} else {
-					otpTxn.setUpdBy(environment.getProperty(PreRegLoginConstant.MOSIP_PRE_REG_CLIENTID));
-				}
-			} catch (Exception e) {
-				logger.warn(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID, "UserDetails mapping failed for otp update", e);
-				otpTxn.setUpdBy(environment.getProperty(PreRegLoginConstant.MOSIP_PRE_REG_CLIENTID));
-			}
+			otpTxn.setUpdBy(resolveActorIdWithFallback());
@@
-			try {
-				UserDetails mappedUser = userDetailsService.findOrCreateByIdentifier(environment.getProperty(PreRegLoginConstant.MOSIP_PRE_REG_CLIENTID));
-				if (mappedUser != null && mappedUser.getUserId() != null) {
-					txn.setCrBy(mappedUser.getUserId().toString());
-				} else {
-					txn.setCrBy(environment.getProperty(PreRegLoginConstant.MOSIP_PRE_REG_CLIENTID));
-				}
-			} catch (Exception e) {
-				logger.warn(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID, "UserDetails mapping failed for otp create", e);
-				txn.setCrBy(environment.getProperty(PreRegLoginConstant.MOSIP_PRE_REG_CLIENTID));
-			}
+			txn.setCrBy(resolveActorIdWithFallback());

Also applies to: 166-177

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/OTPManager.java`
around lines 144 - 155, The create/update branches in OTPManager duplicate the
canonical user resolution logic: extract a private helper method (e.g.,
resolveCanonicalUpdater) that calls
userDetailsService.findOrCreateByIdentifier(environment.getProperty(PreRegLoginConstant.MOSIP_PRE_REG_CLIENTID)),
sets the updater value using otpTxn.setUpdBy(...) with the
mappedUser.getUserId().toString() fallback to the raw property, and logs
failures via logger.warn(...) with the exception; replace the duplicated blocks
in both create and update paths with a call to this helper to keep behavior
consistent and reduce maintenance.
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java (1)

493-521: Consider centralizing maskIdentifier in a shared utility.

The masking logic is repeated in multiple services; consolidating it reduces drift and keeps masking policy consistent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java`
around lines 493 - 521, The maskIdentifier implementation in
AppointmentServiceImpl is duplicated across services; extract this logic into a
single shared utility (e.g., IdentifierMasker.maskIdentifier or
MaskUtils.maskIdentifier) in a common/shared module, make the method public
static, move the exact logic from AppointmentServiceImpl.maskIdentifier into
that utility, update AppointmentServiceImpl and other services to call the new
utility method instead of their local copies, and update/merge unit tests to
reference the centralized method and remove duplicated implementations to keep
masking policy consistent.
pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java (1)

39-84: Add edge-case tests for ciphertext encoding and blank identifiers.

Current tests use text-like encrypted bytes only and don’t cover whitespace identifier rejection. Adding both cases will protect the critical paths introduced in this PR.

🧪 Suggested test additions
+    `@Test`
+    public void testFindOrCreateRejectsBlankIdentifier() {
+        org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class,
+                () -> userDetailsService.findOrCreateByIdentifier("   "));
+    }
+
+    `@Test`
+    public void testEncryptDecryptWithBinaryCiphertextRoundTrip() {
+        when(userDetailsRepository.findByIdentifierHash(any())).thenReturn(Optional.empty());
+        byte[] binaryCipher = new byte[] {(byte)0xFF, (byte)0x00, (byte)0xA5, (byte)0x7F};
+        when(cryptoUtil.encrypt(any(), any())).thenReturn(binaryCipher);
+        when(cryptoUtil.decrypt(any(), any())).thenReturn("plain".getBytes(StandardCharsets.UTF_8));
+        when(userDetailsRepository.save(any())).thenAnswer(i -> i.getArgument(0));
+
+        UserDetails saved = userDetailsService.findOrCreateByIdentifier("user1");
+        when(userDetailsRepository.findById(saved.getUserId())).thenReturn(Optional.of(saved));
+        Optional<String> decrypted = userDetailsService.getDecryptedIdentifier(saved.getUserId());
+
+        assertTrue(decrypted.isPresent());
+        assertEquals("plain", decrypted.get());
+    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java`
around lines 39 - 84, Add two edge-case unit tests in UserDetailsServiceTest:
one that verifies findOrCreateByIdentifier and getDecryptedIdentifier handle
non-text/binary ciphertext bytes by mocking cryptoUtil.encrypt to return
non-UTF8 bytes (e.g., arbitrary byte array) and asserting decryption and
save/lookup still behave correctly; and another that verifies
findOrCreateByIdentifier rejects blank/whitespace identifiers by calling
userDetailsService.findOrCreateByIdentifier with blank inputs and asserting no
save on userDetailsRepository and that an appropriate empty/exceptional result
is returned. Use existing mocks (userDetailsRepository, cryptoUtil) and methods
(findOrCreateByIdentifier, getDecryptedIdentifier, findById) to set up
repository returns and verify interactions.
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DocumentServiceUtil.java (1)

292-297: Remove redundant crBy/updBy assignments in documentEntitySetter.

Line 292-293 are immediately overwritten by Line 295-296, which adds noise without effect.

♻️ Proposed cleanup
-		copyDocumentEntity.setCrBy(sourceEntity.getCrBy());
-		copyDocumentEntity.setUpdBy(sourceEntity.getUpdBy());
 		// copy canonical user references if present
 		copyDocumentEntity.setCrBy(sourceEntity.getEffectiveCrBy());
 		copyDocumentEntity.setUpdBy(sourceEntity.getEffectiveUpdBy());
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DocumentServiceUtil.java`
around lines 292 - 297, The documentEntitySetter contains redundant assignments:
remove the initial copyDocumentEntity.setCrBy(sourceEntity.getCrBy()) and
copyDocumentEntity.setUpdBy(sourceEntity.getUpdBy()) since they are immediately
overwritten by copyDocumentEntity.setCrBy(sourceEntity.getEffectiveCrBy()) and
copyDocumentEntity.setUpdBy(sourceEntity.getEffectiveUpdBy()); keep only the
effective-crBy/updBy assignments (and the existing setLangCode) so the method
uses sourceEntity.getEffectiveCrBy()/getEffectiveUpdBy() and avoid the duplicate
setCrBy/setUpdBy calls.
pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/service/util/DocumentServiceUtilTest.java (1)

88-90: Please add explicit tests for canonical mapping behavior.

Line 88 adds UserDetailsService mocking, but the suite still doesn’t assert the new canonical crBy/updBy path (success and mapping-failure fallback cases) in dtoToEntity.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/service/util/DocumentServiceUtilTest.java`
around lines 88 - 90, The test suite needs explicit unit tests verifying the new
canonical mapping path in dtoToEntity: add two tests in DocumentServiceUtilTest
that exercise dtoToEntity using the mocked UserDetailsService—(1) a success case
where UserDetailsService returns a UserDetails with the canonical identifier and
assert the resulting entity fields crBy and updBy are set to that canonical
value, and (2) a failure/fallback case where UserDetailsService returns null or
throws and assert dtoToEntity falls back to the previous behavior (e.g., uses
the original dto values or a default) for crBy/updBy; locate the call to
dtoToEntity and the UserDetailsService mock in the test class and update
assertions accordingly to validate both canonical mapping and fallback.
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/DemographicService.java (3)

978-988: getUserLookupIds is duplicated from ApplicationService.

This method is identical to the one in ApplicationService. All three helper methods should be centralized.

Would you like me to generate a utility class that consolidates these three duplicated methods (resolveCanonicalUserId, maskIdentifier, getUserLookupIds)? This would improve maintainability and ensure consistent behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/DemographicService.java`
around lines 978 - 988, The getUserLookupIds method is duplicated from
ApplicationService along with resolveCanonicalUserId and maskIdentifier;
consolidate these three helpers into a single utility class (e.g., UserIdUtils)
containing resolveCanonicalUserId, maskIdentifier, and getUserLookupIds as
static methods, move the shared logic there, update DemographicService and
ApplicationService to call UserIdUtils.resolveCanonicalUserId,
UserIdUtils.maskIdentifier, and UserIdUtils.getUserLookupIds (removing the local
copies), and ensure visibility, null-handling and piiBackwardCompatibility
behavior are preserved and covered by existing tests or add small unit tests for
the new utility methods.

948-976: maskIdentifier is duplicated from ApplicationService.

This method is identical to the one in ApplicationService. Extract to a shared utility such as UserDetailsService or a new PiiMaskingUtil class.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/DemographicService.java`
around lines 948 - 976, The maskIdentifier method in DemographicService is a
duplicate of the one in ApplicationService; extract the logic into a shared
utility class (e.g., PiiMaskingUtil) or an existing shared service (e.g.,
UserDetailsService) and replace the local method with a call to that utility.
Create a public static maskIdentifier(String) in PiiMaskingUtil (or a public
method on UserDetailsService), move the masking logic there, update
DemographicService to call PiiMaskingUtil.maskIdentifier(value) (or
userDetailsService.maskIdentifier(value)), and remove the duplicate private
maskIdentifier from DemographicService; ensure imports and any tests/refactors
reference the single shared implementation.

932-946: resolveCanonicalUserId is duplicated from ApplicationService.

This method is identical to the one in ApplicationService. Extract to a shared utility.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/DemographicService.java`
around lines 932 - 946, The resolveCanonicalUserId method is duplicated in
DemographicService and ApplicationService; extract it into a shared utility
(e.g., a new CanonicalUserUtil or UserIdMapper) and have both classes call that
utility. Move the logic that uses
userDetailsService.findOrCreateByIdentifier(...) and maskIdentifier(...) into
the utility, or alternatively keep the dependency on userDetailsService in the
callers and expose a utility method like
mapToCanonicalUserId(UserDetailsService, String) that performs the try/catch and
logging; update DemographicService.resolveCanonicalUserId and the one in
ApplicationService to delegate to the new utility, adjust imports, ensure the
logger and maskIdentifier are accessible (or pass a masking function/logger into
the utility), and run tests to verify no behavioral changes.
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java (4)

669-679: getUserLookupIds method duplicated across services.

The getUserLookupIds method is duplicated. Consider moving all three helper methods (resolveCanonicalUserId, maskIdentifier, getUserLookupIds) to a shared utility class like UserDetailsService or a new UserIdUtils class.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java`
around lines 669 - 679, The getUserLookupIds duplication should be removed from
ApplicationService and the three helper methods (resolveCanonicalUserId,
maskIdentifier, getUserLookupIds) should be extracted into a shared utility
class (e.g., UserIdUtils or add to existing UserDetailsService); create the new
class with those methods as public static (or instance) helpers, update
ApplicationService to call UserIdUtils.resolveCanonicalUserId(...) and
UserIdUtils.getUserLookupIds(...) (or inject UserDetailsService and call the
moved methods), and remove the duplicate implementations from other services so
all callers reference the single shared implementation.

436-444: Indentation is inconsistent and logic is hard to follow.

The authorization check block has inconsistent indentation making the logic flow difficult to understand. The nested conditionals with negation patterns could lead to maintenance issues.

♻️ Suggested refactor for clarity
-			String authUserId = authUserDetails().getUserId();
-			String canonicalAuthUserId = resolveCanonicalUserId(authUserId);
-			String effectiveCrBy = applicationEntity.getEffectiveCrBy() == null ? "" : applicationEntity.getEffectiveCrBy().trim();
-			if (!effectiveCrBy.equals(canonicalAuthUserId)) {
-				if (!(piiBackwardCompatibility && effectiveCrBy.equals(authUserId == null ? "" : authUserId.trim()))) {
-				throw new PreIdInvalidForUserIdException(ApplicationErrorCodes.PRG_APP_015.getCode(),
-						ApplicationErrorMessages.INVALID_APPLICATION_ID_FOR_USER.getMessage());
-				}
-			}	
+					String authUserId = authUserDetails().getUserId();
+					String canonicalAuthUserId = resolveCanonicalUserId(authUserId);
+					String effectiveCrBy = applicationEntity.getEffectiveCrBy() == null ? "" : applicationEntity.getEffectiveCrBy().trim();
+					boolean matchesCanonical = effectiveCrBy.equals(canonicalAuthUserId);
+					boolean matchesRaw = piiBackwardCompatibility && 
+						effectiveCrBy.equals(authUserId == null ? "" : authUserId.trim());
+					if (!matchesCanonical && !matchesRaw) {
+						throw new PreIdInvalidForUserIdException(ApplicationErrorCodes.PRG_APP_015.getCode(),
+								ApplicationErrorMessages.INVALID_APPLICATION_ID_FOR_USER.getMessage());
+					}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java`
around lines 436 - 444, Refactor the authorization check in ApplicationService
by normalizing values first (call authUserDetails().getUserId(),
resolveCanonicalUserId(authUserId), and trim
applicationEntity.getEffectiveCrBy() into a local effectiveCrBy variable) and
then replace the nested negated condition with a clear sequence: if
effectiveCrBy equals canonicalAuthUserId -> allow; else if
piiBackwardCompatibility && effectiveCrBy equals trimmed authUserId -> allow;
else throw PreIdInvalidForUserIdException using
ApplicationErrorCodes.PRG_APP_015 and
ApplicationErrorMessages.INVALID_APPLICATION_ID_FOR_USER. Ensure consistent
indentation and remove double-negation to improve readability around
authUserDetails(), resolveCanonicalUserId(), effectiveCrBy,
piiBackwardCompatibility, and the exception throw.

622-637: Extract resolveCanonicalUserId to a shared utility class.

This method is duplicated identically in both ApplicationService and DemographicService. Extract it to a shared utility class to avoid duplication and ensure consistent behavior across both services.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java`
around lines 622 - 637, The resolveCanonicalUserId method is duplicated in
ApplicationService and DemographicService; extract it into a shared utility
(e.g., IdentityUtils or UserIdResolver) and replace both copies with calls to
that utility. Move the logic that checks null/empty, calls
userDetailsService.findOrCreateByIdentifier(userId), trims
mappedUser.getUserId(), and returns "" on failure into a single static or
instance method (e.g., IdentityUtils.resolveCanonicalUserId(userId,
userDetailsService, logger)), preserve the existing logging call (include
maskIdentifier) by either accepting a Logger and maskIdentifier helper or
keeping maskIdentifier as a shared utility, and update ApplicationService and
DemographicService to delegate to the new utility (inject userDetailsService or
pass it as an argument) so behavior and logging remain identical.

639-667: Extensive duplication of maskIdentifier method across 7 files.

The identical maskIdentifier implementation is duplicated across ApplicationService, DemographicService, LoginService, AppointmentServiceImpl, CommonServiceUtil, DataSyncServiceUtil, and LoginController. This utility method should be centralized in a shared location (e.g., as a public static method in CommonServiceUtil) to eliminate code duplication across services and modules.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java`
around lines 639 - 667, The maskIdentifier method is duplicated across multiple
classes; extract it to a single shared utility and replace duplicates with calls
to that utility. Create a public static String maskIdentifier(String) in
CommonServiceUtil with the exact logic currently in
ApplicationService.maskIdentifier, then remove the duplicate private methods
from ApplicationService, DemographicService, LoginService,
AppointmentServiceImpl, DataSyncServiceUtil, and LoginController and update
those classes to call CommonServiceUtil.maskIdentifier(value) (adding imports as
needed); run compilation/tests to ensure signatures and visibility match and
behavior remains identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@db_scripts/mosip_prereg/ddl/user_details.sql`:
- Around line 17-20: The column pair identifier_encrypted and encrypted_dtimes
in the user_details DDL are currently inconsistent (identifier_encrypted
nullable but encrypted_dtimes NOT NULL); add a constraint so their presence is
paired: either make both nullable or add a CHECK constraint on the table (e.g.,
CHECK ((identifier_encrypted IS NULL AND encrypted_dtimes IS NULL) OR
(identifier_encrypted IS NOT NULL AND encrypted_dtimes IS NOT NULL))) to enforce
that identifier_encrypted and encrypted_dtimes are NULL or NOT NULL together,
referencing the identifier_encrypted and encrypted_dtimes columns in the
user_details table definition.
- Around line 25-29: Add db_scripts/mosip_prereg/ddl/user_details.sql to the
migration orchestration by adding an include/import entry for that file in
db_scripts/mosip_prereg/ddl.sql so the file is deployed, and edit
user_details.sql to remove the CONCURRENTLY keyword from the index statements:
replace the two "CREATE INDEX CONCURRENTLY IF NOT EXISTS
idx_prereg_user_details_hash" and "CREATE INDEX CONCURRENTLY IF NOT EXISTS
idx_prereg_user_details_active" statements with "CREATE INDEX IF NOT EXISTS"
versions (keeping the same index names idx_prereg_user_details_hash and
idx_prereg_user_details_active and their ON clauses) so the DDL runs
transactionally under the orchestration.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/repository/ApplicationRepostiory.java`:
- Around line 41-45: Guard against null or empty userIds before invoking the
repository methods in the service/caller that use
ApplicationRepostiory.findByCreatedByIn(...) and
ApplicationRepostiory.findByCreatedByInBookingType(...): if userIds == null ||
userIds.isEmpty() return Collections.emptyList() (or an equivalent empty result)
instead of calling the repository, so you never bind an empty collection to the
JPQL IN parameter; apply the same check before both findByCreatedByIn and
findByCreatedByInBookingType calls.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java`:
- Around line 473-483: The code currently sets
applicationEntity.setUpdBy(authUserDetails().getUserId()) before attempting
canonicalization, so if userDetailsService.findOrCreateByIdentifier(...) fails
the raw auth ID is persisted; change the flow to not set updBy from
authUserDetails() up-front: remove that initial setUpdBy call and only call
applicationEntity.setUpdBy(mappedUser.getUserId().toString()) after a successful
mapping (i.e., when mappedUser != null && mappedUser.getUserId() != null); in
the catch block do not revert to or persist the raw auth ID (leave updBy null or
unchanged) and keep the existing warn log in userDetails mapping failure
handling.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/DemographicService.java`:
- Around line 880-930: The userValidation method's flow misuses
userDetailsService.findOrCreateByIdentifier (in the mappedPreregUser lookup)
which may create unintended user entries and the fallback raw ID check runs even
when the canonical lookup succeeded but didn't match; change the prereg lookup
to a read-only lookup (e.g., use or add a findByIdentifier/read-only method
instead of findOrCreateByIdentifier for mappedPreregUser), restructure logic in
userValidation to: resolve canonicalAuthUserId once (mappedUser), attempt a
non-creating lookup for prereg (mappedPreregUser) and only if that lookup
throws/fails or returns null fall back to raw ID comparison (trimmedAuthUserId
vs trimmedPreregUserId), and simplify control flow to avoid nested try/catch and
ambiguous return paths while keeping the same exception
(PreIdInvalidForUserIdException) when final checks fail.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/LoginService.java`:
- Around line 492-493: The current masking in LoginService (the branch computing
visible = Math.min(4, trimmed.length()) and returning "***" +
trimmed.substring(...)) leaks short identifiers; change the logic so that if
trimmed.length() <= 4 you return a fully masked value (a string of '*' repeated
trimmed.length()), otherwise compute visible = 4 and return a mask of '*'
repeated (trimmed.length() - visible) concatenated with
trimmed.substring(trimmed.length() - visible); update the code around the
visible calculation and return to use length-based star repetition instead of
the fixed "***" prefix.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/CommonServiceUtil.java`:
- Around line 200-205: The current strict-mode check in CommonServiceUtil allows
empty canonical/prereg IDs to be treated as a match; update the logic in the
block that uses trimmedCanonicalAuthUserId and trimmedPreregUserId (when
piiBackwardCompatibility is false) to fail-closed: if either
trimmedCanonicalAuthUserId or trimmedPreregUserId is null/empty/blank, throw
PreIdInvalidForUserIdException (using DemographicErrorCodes.PRG_PAM_APP_017 and
DemographicErrorMessages.INVALID_PREID_FOR_USER) instead of allowing the
comparison to proceed, and apply the same emptiness check and exception behavior
to the similar comparison block later (the other 210-216 block) to ensure
missing canonical IDs are treated as invalid ownership.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DemographicServiceUtil.java`:
- Around line 321-333: The current write path in DemographicServiceUtil catches
exceptions from userDetailsService.findOrCreateByIdentifier and unconditionally
falls back to legacy/raw identifiers (setting demographicEntity.setCrAppuserId,
setCreatedBy, setUpdatedBy), which violates strict-mode; change the catch and
corresponding flows (also at the other spots flagged) to honor the
piiBackwardCompatibility policy by invoking the existing helper that resolves
the appropriate identifier under strict vs backward-compat modes and only
persisting legacy identifiers when piiBackwardCompatibility allows it;
specifically, in the try/catch around
userDetailsService.findOrCreateByIdentifier and in the other create/save/update
blocks replace the unconditional fallback with a call to the helper (use the
helper method already used elsewhere) to compute the id and then
setCrAppuserId/setCreatedBy/setUpdatedBy accordingly so strict deployments never
persist raw identifiers on mapping failure.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DocumentServiceUtil.java`:
- Around line 182-191: The current try/catch in DocumentServiceUtil around
userDetailsService.findOrCreateByIdentifier may set crBy/updBy to the raw userId
on mapping failure; change the logic so that if an exception occurs or
mappedUser is null/has null userId you do NOT fall back to the raw userId—leave
documentEntity.crBy and updBy unset (or null) and only set them when
mappedUser.getUserId() is present; keep the catch to log the failure via
log.warn (including the exception) but remove any fallback assignment to userId
to avoid persisting raw identifiers.

In
`@pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/DemographicServiceTest.java`:
- Around line 1256-1258: The test helper getCanonicalUserIdString currently
creates a deterministic UUID via UUID.nameUUIDFromBytes(identifier.getBytes()),
but production UserDetailsService.findOrCreateByIdentifier uses
UUID.randomUUID(), causing a mismatch; update the test to mirror production by
generating random UUIDs (use UUID.randomUUID().toString() in the helper) or
change the mock setup in the test to not rely on a specific UUID (e.g., accept
any UUID or capture the generated UUID) so the test behavior matches
UserDetailsService.findOrCreateByIdentifier.

In
`@pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/service/AppointmentServiceTest.java`:
- Around line 53-56: The static System.setProperty in AppointmentServiceTest
mutates JVM-global state; remove that static block and set the property within
the test context instead (e.g., use JUnit 5 `@DynamicPropertySource` to register
"mosip.prereg.pii.backward.compatibility=false" for the Spring context, or
annotate AppointmentServiceTest with `@TestPropertySource`(properties =
"mosip.prereg.pii.backward.compatibility=false") / use Spring's
TestPropertyValues) so the property is scoped to this test only and does not
affect other tests or JVM-global state; update the AppointmentServiceTest setup
accordingly.

In
`@pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/service/UserDetailsService.java`:
- Around line 111-114: The code currently only checks for null from
normalize(identifier) but accepts whitespace-only inputs that normalize to empty
string; update the validation in UserDetailsService (the block using
normalize(identifier) and variable norm) to treat empty strings as invalid as
well—i.e., after calling normalize(identifier) throw the same
IllegalArgumentException when norm is null or norm.isEmpty() (or otherwise
blank) so whitespace-only identifiers are rejected before hashing/creation.
- Around line 60-86: Both encryptIdentifierIfConfigured and
decryptIdentifierIfConfigured are incorrectly converting raw ciphertext/bytes
to/from UTF-8 Strings which can corrupt binary data; change them to encode
encrypted byte[] to a safe textual form (e.g., Base64) when returning/storing
and decode from Base64 back to byte[] before passing to cryptoUtil.decrypt,
ensuring you use the same encoding in both methods and preserve existing
null/empty handling and LocalDateTime usage in the cryptoUtil calls.
- Around line 116-147: The find-or-create flow in findOrCreate can race: two
threads that both miss userDetailsRepository.findByIdentifierHash(hash) may each
insert and cause a unique-key violation; change the "create" branch to attempt
insert but catch the DB unique constraint exception (e.g.,
DataIntegrityViolationException or the underlying ConstraintViolationException),
then re-query userDetailsRepository.findByIdentifierHash(hash) and return the
found row instead of failing; ensure this handling surrounds the
userDetailsRepository.save(existing or u) calls and keep using
encryptIdentifierIfConfigured(identifier) and UserDetails fields as before so
the method becomes idempotent under concurrency.

In
`@pre-registration/pre-registration-datasync-service/src/main/java/io/mosip/preregistration/datasync/service/DataSyncService.java`:
- Around line 438-439: The call to authUserDetails().getUserId() used when
invoking serviceUtil.reverseDateSyncSave can NPE when the security principal is
absent; modify the invocation in DataSyncService so you compute a safe userId
first (call authUserDetails(), check for null and check getUserId() for
null/empty) and pass a fallback constant (the prior system user id used for
pre-registration) when auth info is missing before calling reverseDateSyncSave;
update the local variable reverseDatasyncReponse assignment to use that safe
userId.

In
`@pre-registration/pre-registration-datasync-service/src/main/java/io/mosip/preregistration/datasync/service/util/DataSyncServiceUtil.java`:
- Around line 892-906: getCanonicalUserId currently returns the raw userId on
mapping failure, which can reintroduce plaintext PII; change the fallback to a
non-PII value (e.g., return maskIdentifier(userId) or a configured pseudonymous
constant like ANONYMOUS_USER_ID) instead of the original userId, preserving the
existing log call; update the same fallback behavior in the other similar
method(s) that use userDetailsService.findOrCreateByIdentifier (the block around
the reverseDateSyncSave logic) so neither createdBy/crBy nor any persistence
uses the original plaintext identifier.

---

Nitpick comments:
In `@db_scripts/mosip_prereg/ddl/user_details.sql`:
- Line 16: The schema defines identifier_hash VARCHAR(128) NOT NULL UNIQUE which
already creates a unique index, so remove the redundant index creation for
idx_prereg_user_details_hash (and any duplicate index statements at lines
corresponding to the other occurrences mentioned) to avoid double indexing;
update the DDL to drop or omit the CREATE INDEX/ADD INDEX statements that
reference idx_prereg_user_details_hash while keeping the UNIQUE constraint on
identifier_hash in the user_details table definition.
- Around line 28-29: The partial index idx_prereg_user_details_active on table
user_details uses user_id as its key while filtering on identifier_encrypted IS
NOT NULL, which is redundant because user_id is already primary-key indexed;
either drop this index or change it to index the column(s) actually used by
queries that include the predicate (for example index identifier_encrypted or
the combination of identifier_encrypted plus any frequently queried columns),
and update DDL to remove or replace CREATE INDEX CONCURRENTLY IF NOT EXISTS
idx_prereg_user_details_active with the appropriate index definition that
matches real query patterns.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LoginController.java`:
- Around line 269-297: Extract the masking logic from
LoginController.maskIdentifier into a shared utility (e.g.,
IdentifierMaskUtils.maskIdentifier) and replace duplicated implementations in
LoginService, AppointmentServiceImpl, DemographicService, and other classes to
call this single static utility method; ensure the utility preserves current
behavior for emails, phone numbers (with optional '+'), UUIDs and fallback
masking, keep null/blank handling, add unit tests for the utility, and update
imports/usages across callers so all components use
IdentifierMaskUtils.maskIdentifier.
- Around line 290-294: Replace the broad catch in LoginController's UUID masking
logic with a catch for IllegalArgumentException only: when calling
UUID.fromString(trimmed) inside the method that returns masked UUID (the block
returning "***" + trimmed.substring(...)), change the catch(Exception ignored)
to catch(IllegalArgumentException ignored) so only invalid-UUID errors are
handled and other exceptions aren't accidentally suppressed; keep the existing
handling (silently ignore or log) consistent with current behavior.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java`:
- Around line 669-679: The getUserLookupIds duplication should be removed from
ApplicationService and the three helper methods (resolveCanonicalUserId,
maskIdentifier, getUserLookupIds) should be extracted into a shared utility
class (e.g., UserIdUtils or add to existing UserDetailsService); create the new
class with those methods as public static (or instance) helpers, update
ApplicationService to call UserIdUtils.resolveCanonicalUserId(...) and
UserIdUtils.getUserLookupIds(...) (or inject UserDetailsService and call the
moved methods), and remove the duplicate implementations from other services so
all callers reference the single shared implementation.
- Around line 436-444: Refactor the authorization check in ApplicationService by
normalizing values first (call authUserDetails().getUserId(),
resolveCanonicalUserId(authUserId), and trim
applicationEntity.getEffectiveCrBy() into a local effectiveCrBy variable) and
then replace the nested negated condition with a clear sequence: if
effectiveCrBy equals canonicalAuthUserId -> allow; else if
piiBackwardCompatibility && effectiveCrBy equals trimmed authUserId -> allow;
else throw PreIdInvalidForUserIdException using
ApplicationErrorCodes.PRG_APP_015 and
ApplicationErrorMessages.INVALID_APPLICATION_ID_FOR_USER. Ensure consistent
indentation and remove double-negation to improve readability around
authUserDetails(), resolveCanonicalUserId(), effectiveCrBy,
piiBackwardCompatibility, and the exception throw.
- Around line 622-637: The resolveCanonicalUserId method is duplicated in
ApplicationService and DemographicService; extract it into a shared utility
(e.g., IdentityUtils or UserIdResolver) and replace both copies with calls to
that utility. Move the logic that checks null/empty, calls
userDetailsService.findOrCreateByIdentifier(userId), trims
mappedUser.getUserId(), and returns "" on failure into a single static or
instance method (e.g., IdentityUtils.resolveCanonicalUserId(userId,
userDetailsService, logger)), preserve the existing logging call (include
maskIdentifier) by either accepting a Logger and maskIdentifier helper or
keeping maskIdentifier as a shared utility, and update ApplicationService and
DemographicService to delegate to the new utility (inject userDetailsService or
pass it as an argument) so behavior and logging remain identical.
- Around line 639-667: The maskIdentifier method is duplicated across multiple
classes; extract it to a single shared utility and replace duplicates with calls
to that utility. Create a public static String maskIdentifier(String) in
CommonServiceUtil with the exact logic currently in
ApplicationService.maskIdentifier, then remove the duplicate private methods
from ApplicationService, DemographicService, LoginService,
AppointmentServiceImpl, DataSyncServiceUtil, and LoginController and update
those classes to call CommonServiceUtil.maskIdentifier(value) (adding imports as
needed); run compilation/tests to ensure signatures and visibility match and
behavior remains identical.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java`:
- Around line 493-521: The maskIdentifier implementation in
AppointmentServiceImpl is duplicated across services; extract this logic into a
single shared utility (e.g., IdentifierMasker.maskIdentifier or
MaskUtils.maskIdentifier) in a common/shared module, make the method public
static, move the exact logic from AppointmentServiceImpl.maskIdentifier into
that utility, update AppointmentServiceImpl and other services to call the new
utility method instead of their local copies, and update/merge unit tests to
reference the centralized method and remove duplicated implementations to keep
masking policy consistent.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/DemographicService.java`:
- Around line 978-988: The getUserLookupIds method is duplicated from
ApplicationService along with resolveCanonicalUserId and maskIdentifier;
consolidate these three helpers into a single utility class (e.g., UserIdUtils)
containing resolveCanonicalUserId, maskIdentifier, and getUserLookupIds as
static methods, move the shared logic there, update DemographicService and
ApplicationService to call UserIdUtils.resolveCanonicalUserId,
UserIdUtils.maskIdentifier, and UserIdUtils.getUserLookupIds (removing the local
copies), and ensure visibility, null-handling and piiBackwardCompatibility
behavior are preserved and covered by existing tests or add small unit tests for
the new utility methods.
- Around line 948-976: The maskIdentifier method in DemographicService is a
duplicate of the one in ApplicationService; extract the logic into a shared
utility class (e.g., PiiMaskingUtil) or an existing shared service (e.g.,
UserDetailsService) and replace the local method with a call to that utility.
Create a public static maskIdentifier(String) in PiiMaskingUtil (or a public
method on UserDetailsService), move the masking logic there, update
DemographicService to call PiiMaskingUtil.maskIdentifier(value) (or
userDetailsService.maskIdentifier(value)), and remove the duplicate private
maskIdentifier from DemographicService; ensure imports and any tests/refactors
reference the single shared implementation.
- Around line 932-946: The resolveCanonicalUserId method is duplicated in
DemographicService and ApplicationService; extract it into a shared utility
(e.g., a new CanonicalUserUtil or UserIdMapper) and have both classes call that
utility. Move the logic that uses
userDetailsService.findOrCreateByIdentifier(...) and maskIdentifier(...) into
the utility, or alternatively keep the dependency on userDetailsService in the
callers and expose a utility method like
mapToCanonicalUserId(UserDetailsService, String) that performs the try/catch and
logging; update DemographicService.resolveCanonicalUserId and the one in
ApplicationService to delegate to the new utility, adjust imports, ensure the
logger and maskIdentifier are accessible (or pass a masking function/logger into
the utility), and run tests to verify no behavioral changes.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/LoginService.java`:
- Around line 478-483: In the LoginService class, remove the unreachable
small-length phone branch inside the trimmed.matches("\\+?\\d{10,12}") block:
delete the inner if (digits.length() <= 4) { return (hasPlus ? "+" : "") +
"****"; } since digits is already constrained to 10..12 by the regex; leave the
remaining masking logic in this block intact so the method compiles and behavior
is unchanged for valid 10–12 digit inputs.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/OTPManager.java`:
- Around line 144-155: The create/update branches in OTPManager duplicate the
canonical user resolution logic: extract a private helper method (e.g.,
resolveCanonicalUpdater) that calls
userDetailsService.findOrCreateByIdentifier(environment.getProperty(PreRegLoginConstant.MOSIP_PRE_REG_CLIENTID)),
sets the updater value using otpTxn.setUpdBy(...) with the
mappedUser.getUserId().toString() fallback to the raw property, and logs
failures via logger.warn(...) with the exception; replace the duplicated blocks
in both create and update paths with a call to this helper to keep behavior
consistent and reduce maintenance.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DocumentServiceUtil.java`:
- Around line 292-297: The documentEntitySetter contains redundant assignments:
remove the initial copyDocumentEntity.setCrBy(sourceEntity.getCrBy()) and
copyDocumentEntity.setUpdBy(sourceEntity.getUpdBy()) since they are immediately
overwritten by copyDocumentEntity.setCrBy(sourceEntity.getEffectiveCrBy()) and
copyDocumentEntity.setUpdBy(sourceEntity.getEffectiveUpdBy()); keep only the
effective-crBy/updBy assignments (and the existing setLangCode) so the method
uses sourceEntity.getEffectiveCrBy()/getEffectiveUpdBy() and avoid the duplicate
setCrBy/setUpdBy calls.

In
`@pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/AppointmentServiceImplTest.java`:
- Around line 598-606: The NullAuthority helper class should be made private
static final to limit its scope to this test class; locate the static inner
class named NullAuthority (implements GrantedAuthority) and change its
declaration from package-private static to private static final so it remains
test-scoped and immutable.

In
`@pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/DocumentServiceTest.java`:
- Around line 161-177: Extract the repeated DocumentEntity setup in
DocumentServiceTest into a test helper/builder to reduce noise: create a factory
method (e.g., buildTestDocumentEntity or DocumentEntityBuilder) that
encapsulates constructing DocumentEntity and setting fields used here
(demographicEntity, documentId, docName, docCatCode, docTypeCode, docFileFormat,
statusCode, langCode, crBy, crDtime, updBy, updDtime using
DateUtils.parseDateToLocalDateTime(new Date()), encryptedDateTime, docId,
docHash using HashUtill.hashUtill(cephBytes), refNumber) and replace the inline
block in tests with a call to that helper; keep the helper in test sources so
other tests can reuse it and update instantiations in DocumentServiceTest to use
the new builder API.

In
`@pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/service/util/DocumentServiceUtilTest.java`:
- Around line 88-90: The test suite needs explicit unit tests verifying the new
canonical mapping path in dtoToEntity: add two tests in DocumentServiceUtilTest
that exercise dtoToEntity using the mocked UserDetailsService—(1) a success case
where UserDetailsService returns a UserDetails with the canonical identifier and
assert the resulting entity fields crBy and updBy are set to that canonical
value, and (2) a failure/fallback case where UserDetailsService returns null or
throws and assert dtoToEntity falls back to the previous behavior (e.g., uses
the original dto values or a default) for crBy/updBy; locate the call to
dtoToEntity and the UserDetailsService mock in the test class and update
assertions accordingly to validate both canonical mapping and fallback.

In
`@pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/entity/AvailibityEntity.java`:
- Around line 90-96: The AvailibityEntity exposes getEffectiveCrBy() and
getEffectiveUpdBy() which are inconsistent with InterfaceDataSyncEntity's
getEffectiveCreatedBy() and getEffectiveUpdatedBy(); rename AvailibityEntity's
methods to getEffectiveCreatedBy() and getEffectiveUpdatedBy(), update any
internal field mappings (crBy -> createdBy/upBy -> updatedBy or keep fields but
ensure getters map correctly), and search/replace all usages of
getEffectiveCrBy() and getEffectiveUpdBy() to the new method names to maintain
API consistency across entities.

In
`@pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java`:
- Around line 39-84: Add two edge-case unit tests in UserDetailsServiceTest: one
that verifies findOrCreateByIdentifier and getDecryptedIdentifier handle
non-text/binary ciphertext bytes by mocking cryptoUtil.encrypt to return
non-UTF8 bytes (e.g., arbitrary byte array) and asserting decryption and
save/lookup still behave correctly; and another that verifies
findOrCreateByIdentifier rejects blank/whitespace identifiers by calling
userDetailsService.findOrCreateByIdentifier with blank inputs and asserting no
save on userDetailsRepository and that an appropriate empty/exceptional result
is returned. Use existing mocks (userDetailsRepository, cryptoUtil) and methods
(findOrCreateByIdentifier, getDecryptedIdentifier, findById) to set up
repository returns and verify interactions.

Comment thread db_scripts/mosip_prereg/ddl/user_details.sql Outdated
Comment thread db_scripts/mosip_prereg/ddl/user_details.sql Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
db_scripts/mosip_prereg/ddl/user_details.sql (1)

17-19: ⚠️ Potential issue | 🔴 Critical

NOT NULL constraints conflict with current save-path behavior.

Lines 17 and 19 require encrypted fields always present, but UserDetailsService can persist identifier_encrypted = null (see pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/service/UserDetailsService.java, snippets around Lines 60-74 and 137-147). This will cause insert failures in fallback/encryption-failure paths.

💡 Suggested DDL fix
 CREATE TABLE IF NOT EXISTS prereg.user_details (
     user_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
     identifier_hash VARCHAR(128) NOT NULL UNIQUE,
-    identifier_encrypted TEXT NOT NULL,
+    identifier_encrypted TEXT,
     cr_dtimes TIMESTAMP NOT NULL,
-    encrypted_dtimes TIMESTAMP NOT NULL
+    encrypted_dtimes TIMESTAMP,
+    CONSTRAINT chk_user_details_encryption_pair CHECK (
+      (identifier_encrypted IS NULL AND encrypted_dtimes IS NULL) OR
+      (identifier_encrypted IS NOT NULL AND encrypted_dtimes IS NOT NULL)
+    )
 );
#!/bin/bash
set -euo pipefail

echo "== DDL nullability =="
rg -n "identifier_encrypted|encrypted_dtimes" db_scripts/mosip_prereg/ddl/user_details.sql

echo ""
echo "== Service behavior allowing null encrypted value =="
rg -n "encryptIdentifierIfConfigured|setIdentifierEncrypted|setEncryptedDtimes|return null" \
  pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/service/UserDetailsService.java
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@db_scripts/mosip_prereg/ddl/user_details.sql` around lines 17 - 19, The DDL
currently enforces NOT NULL on identifier_encrypted and encrypted_dtimes which
conflicts with UserDetailsService behavior that can persist null encrypted
values (see methods encryptIdentifierIfConfigured, setIdentifierEncrypted,
setEncryptedDtimes); update the user_details.sql column definitions for
identifier_encrypted and encrypted_dtimes to allow NULL (remove the NOT NULL
constraint) so inserts succeed in fallback/encryption-failure paths and preserve
existing application behavior.
🧹 Nitpick comments (3)
pre-registration/pre-registration-application-service/pom.xml (2)

98-98: Use ${kernel.core.version} property instead of hardcoded version.

The parent POM defines kernel.core.version=1.3.0. Using the property reference ensures version consistency and simplifies future upgrades.

♻️ Suggested refactor
 		<dependency>
 			<groupId>io.mosip.kernel</groupId>
 			<artifactId>kernel-core</artifactId>
-			<version>1.3.0</version>
+			<version>${kernel.core.version}</version>
 		</dependency>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pre-registration/pre-registration-application-service/pom.xml` at line 98,
Replace the hardcoded version element in the pre-registration module POM by
referencing the parent property: update the <version> element currently set to
"1.3.0" to use the property ${kernel.core.version} so the module uses the
kernel.core.version defined in the parent POM; locate the <version> tag in
pre-registration-application-service/pom.xml and change its value to the
property reference to maintain consistency with the parent.

248-248: Consider using a property instead of hardcoded version.

Similar to the kernel-core dependency, the kernel-auth-adapter version is hardcoded. For consistency with the rest of the project's version management approach, consider using ${kernel.bom.version} or defining a dedicated property.

♻️ Suggested refactor
 				<dependency>
 					<groupId>io.mosip.kernel</groupId>
 					<artifactId>kernel-auth-adapter</artifactId>
-					<version>1.3.0</version>
+					<version>${kernel.bom.version}</version>
 				</dependency>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pre-registration/pre-registration-application-service/pom.xml` at line 248,
The dependency declaration for kernel-auth-adapter currently hardcodes
<version>1.3.0</version>; change it to use the existing BOM/property strategy by
replacing the literal with the project property (e.g., ${kernel.bom.version} or
a new property like ${kernel.auth.adapter.version}) so it matches how
kernel-core is versioned; update the pom's dependency element that references
kernel-auth-adapter to reference the chosen property and, if you introduce a new
property, add it to the <properties> block (symbol references: the
kernel-auth-adapter dependency and the <version> element).
pre-registration/pre-registration-datasync-service/pom.xml (1)

169-169: Consider using a property instead of hardcoded version.

The kernel-auth-adapter version is hardcoded as 1.3.0 while other dependencies in this file use property references. For easier maintenance during future upgrades, consider using ${kernel.bom.version} or defining a dedicated property.

♻️ Suggested refactor
 				<dependency>
 					<groupId>io.mosip.kernel</groupId>
 					<artifactId>kernel-auth-adapter</artifactId>
-					<version>1.3.0</version>
+					<version>${kernel.bom.version}</version>
 				</dependency>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pre-registration/pre-registration-datasync-service/pom.xml` at line 169,
Replace the hardcoded <version>1.3.0</version> for the kernel-auth-adapter
dependency with a Maven property reference to centralize version management
(e.g., use ${kernel.bom.version} or a new <kernel.auth.version> property);
update the dependency entry that references kernel-auth-adapter and add or reuse
the property in the <properties> section so future upgrades can be done by
changing the single property value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@db_scripts/mosip_prereg/ddl/user_details.sql`:
- Around line 25-29: Remove the redundant full index creation for
idx_prereg_user_details_hash on prereg.user_details because
UNIQUE(identifier_hash) already creates the same index; delete the CREATE INDEX
IF NOT EXISTS idx_prereg_user_details_hash ... ON
prereg.user_details(identifier_hash) statement, but keep the partial index
statement CREATE INDEX IF NOT EXISTS idx_prereg_user_details_active ... ON
prereg.user_details(user_id) WHERE identifier_encrypted IS NOT NULL as-is.

---

Duplicate comments:
In `@db_scripts/mosip_prereg/ddl/user_details.sql`:
- Around line 17-19: The DDL currently enforces NOT NULL on identifier_encrypted
and encrypted_dtimes which conflicts with UserDetailsService behavior that can
persist null encrypted values (see methods encryptIdentifierIfConfigured,
setIdentifierEncrypted, setEncryptedDtimes); update the user_details.sql column
definitions for identifier_encrypted and encrypted_dtimes to allow NULL (remove
the NOT NULL constraint) so inserts succeed in fallback/encryption-failure paths
and preserve existing application behavior.

---

Nitpick comments:
In `@pre-registration/pre-registration-application-service/pom.xml`:
- Line 98: Replace the hardcoded version element in the pre-registration module
POM by referencing the parent property: update the <version> element currently
set to "1.3.0" to use the property ${kernel.core.version} so the module uses the
kernel.core.version defined in the parent POM; locate the <version> tag in
pre-registration-application-service/pom.xml and change its value to the
property reference to maintain consistency with the parent.
- Line 248: The dependency declaration for kernel-auth-adapter currently
hardcodes <version>1.3.0</version>; change it to use the existing BOM/property
strategy by replacing the literal with the project property (e.g.,
${kernel.bom.version} or a new property like ${kernel.auth.adapter.version}) so
it matches how kernel-core is versioned; update the pom's dependency element
that references kernel-auth-adapter to reference the chosen property and, if you
introduce a new property, add it to the <properties> block (symbol references:
the kernel-auth-adapter dependency and the <version> element).

In `@pre-registration/pre-registration-datasync-service/pom.xml`:
- Line 169: Replace the hardcoded <version>1.3.0</version> for the
kernel-auth-adapter dependency with a Maven property reference to centralize
version management (e.g., use ${kernel.bom.version} or a new
<kernel.auth.version> property); update the dependency entry that references
kernel-auth-adapter and add or reuse the property in the <properties> section so
future upgrades can be done by changing the single property value.

ℹ️ Review info
Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 03b0fad5-b433-4b84-ad60-9ce4a5f18d8b

📥 Commits

Reviewing files that changed from the base of the PR and between bdc2d9c and 9997b77.

📒 Files selected for processing (6)
  • db_scripts/mosip_prereg/ddl.sql
  • db_scripts/mosip_prereg/ddl/user_details.sql
  • pre-registration/pom.xml
  • pre-registration/pre-registration-application-service/pom.xml
  • pre-registration/pre-registration-core/pom.xml
  • pre-registration/pre-registration-datasync-service/pom.xml

Comment thread db_scripts/mosip_prereg/ddl/user_details.sql Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/impl/ApplicationConsumedStatusUpdater.java`:
- Line 151: In ApplicationConsumedStatusUpdater, avoid calling
resolveCanonicalUserId(auditUserId) for each row/document; resolve the canonical
user ID once at the start of the batch execution and reuse it when setting
updatedBy (e.g., replace repeated calls in places where
demographicEntityConsumed.setUpdatedBy(resolveCanonicalUserId(auditUserId)) and
similar lines are used); compute a local final variable like resolvedAuditUser =
resolveCanonicalUserId(auditUserId) in the batch-level method that drives the
per-record updates and use resolvedAuditUser for updatedBy assignments to
eliminate redundant work.
- Around line 226-239: The resolveCanonicalUserId method currently throws
IllegalStateException when userDetails mapping fails; change it to perform a
backward-compatible fallback like CommonServiceUtil: call
userDetailsService.findOrCreateByIdentifier(trimmedUserId), and if the returned
UserDetails or userId is null, log a warning/INFO and return the original
trimmedUserId instead of throwing; keep the UUID-short-circuit (isUuid) and
ensure you reference resolveCanonicalUserId,
userDetailsService.findOrCreateByIdentifier, and UserDetails.getUserId() while
implementing the fallback.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 66860152-5e43-488f-a5b9-d6ec8c471799

📥 Commits

Reviewing files that changed from the base of the PR and between 9997b77 and 9bc82f5.

📒 Files selected for processing (1)
  • pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/impl/ApplicationConsumedStatusUpdater.java

@mayuradesh mayuradesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. Move common code like adding record to UserDetails table, creating a list of userIds based on compatibility mode etc to common Utils.
  2. From all places use this common code.
  3. There are too many needless IF conditions which can cause silent failures in code, review all and include only MUST conditions.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (8)
pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/service/UserDetailsService.java (1)

76-90: Encryption/decryption round-trip appears correct but relies on CryptoUtil implementation details.

Based on the CryptoUtil context snippets, the encrypt() method returns bytes of a Base64-encoded string (from body.getResponse().getData().getBytes()), and decrypt() expects UTF-8 string bytes that it converts back to a String for the DTO. The current implementation should work correctly for this specific CryptoUtil behavior.

The past review comment about UTF-8 corruption assumed raw binary ciphertext, but the crypto service returns Base64-encoded responses. However, this coupling is implicit and could break if CryptoUtil's response format changes.

Consider adding a comment documenting this dependency:

// Note: CryptoUtil returns Base64-encoded strings from the crypto service,
// so UTF-8 round-trip is safe here. If CryptoUtil changes to return raw
// binary, this must be updated to use explicit Base64 encoding.

Also applies to: 100-114

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/service/UserDetailsService.java`
around lines 76 - 90, The encryptIdentifierIfConfigured method relies on
CryptoUtil.encrypt returning a Base64-encoded string as UTF-8 bytes, which makes
the current new String(byte[], UTF_8) safe but fragile; update the method
(encryptIdentifierIfConfigured) to add a clear inline comment above the
try-block documenting this dependency: note that CryptoUtil returns
Base64-encoded strings (UTF-8 bytes) and that if CryptoUtil changes to return
raw binary ciphertext this code must switch to explicit Base64
encoding/decoding, and apply the same comment to the corresponding
decrypt/round-trip code paths referenced in this class.
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java (1)

432-437: Duplicated validation logic; consider reusing userValidation method.

Lines 432-437 implement ownership validation inline, duplicating logic from the userValidation method at lines 547-559. Consider extracting a common helper or invoking the existing method to reduce duplication.

♻️ Consider extracting shared validation

The inline validation:

String authUserId = authUserDetails().getUserId();
String effectiveCrBy = applicationEntity.getEffectiveCrBy() == null ? "" : applicationEntity.getEffectiveCrBy().trim();
if (!userDetailsService.matchesUser(authUserId, effectiveCrBy, piiBackwardCompatibility)) {
    throw new PreIdInvalidForUserIdException(...);
}

Could potentially be consolidated with the userValidation method to avoid code duplication. Currently there's a commented-out //userValidation(applicationEntity); at line 431 suggesting this was considered.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java`
around lines 432 - 437, Replace the duplicated inline ownership check with a
single reusable validation call: remove the authUserId/effectiveCrBy/matchesUser
block and invoke the existing userValidation(applicationEntity) helper (or
extract a new private helper that calls userDetailsService.matchesUser and
throws PreIdInvalidForUserIdException) so the ownership check is centralized;
ensure the helper uses authUserDetails().getUserId(),
applicationEntity.getEffectiveCrBy() with the same trim/null handling, and the
same piiBackwardCompatibility flag to preserve behavior.
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java (1)

477-488: Redundant updBy assignment at line 477.

Line 477 sets applicationEntity.setUpdBy(authUserDetails().getUserId()) with the raw user ID, then lines 480-481 immediately overwrite it with the canonical user ID. The initial assignment is unnecessary.

♻️ Remove redundant assignment
-    applicationEntity.setUpdBy(authUserDetails().getUserId());
     applicationEntity.setCrDtime(LocalDateTime.now(ZoneId.of("UTC")));
     try {
         applicationEntity.setUpdBy(
             userDetailsService.resolveCanonicalUserIdOrIdentifier(authUserDetails().getUserId()));
         return applicationRepostiory.save(applicationEntity);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java`
around lines 477 - 488, Remove the redundant pre-overwrite of updBy: in
AppointmentServiceImpl remove the initial call
applicationEntity.setUpdBy(authUserDetails().getUserId()) and keep only the
canonical assignment using
userDetailsService.resolveCanonicalUserIdOrIdentifier(authUserDetails().getUserId())
before saving via applicationRepostiory.save; ensure no other logic depends on
the raw userId being set earlier and that exception handling around
applicationRepostiory.save remains unchanged.
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/CommonServiceUtil.java (1)

408-415: Side-effect mutation of input list in compareUploadedDocListAndValidMandatoryDocList.

The forEach with remove mutates the validMandatoryDocForApplicant list passed as a parameter. While functionally correct, this side effect can be surprising to callers and may cause issues if the caller expects the list to remain unchanged.

♻️ Consider using a non-mutating approach
 private boolean compareUploadedDocListAndValidMandatoryDocList(List<String> uploadedDocs,
     List<String> validMandatoryDocForApplicant) {
   if (validMandatoryDocForApplicant.isEmpty()) {
     return true;
   }
-  uploadedDocs.forEach(validMandatoryDocForApplicant::remove);
-  return validMandatoryDocForApplicant.isEmpty();
+  return uploadedDocs.containsAll(validMandatoryDocForApplicant);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/CommonServiceUtil.java`
around lines 408 - 415, The method
compareUploadedDocListAndValidMandatoryDocList mutates the input
validMandatoryDocForApplicant by calling remove in uploadedDocs.forEach;
instead, avoid side-effects by performing the check on a copy or using a
non-mutating containment check (e.g., create a new List/Set from
validMandatoryDocForApplicant or convert uploadedDocs to a Set and call
containsAll) so the original validMandatoryDocForApplicant is not modified;
update the implementation in compareUploadedDocListAndValidMandatoryDocList to
operate on that copy/Set and return the emptiness/containment result.
pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java (1)

94-96: Prefer assertEquals over assertTrue for clearer failure messages.

Using assertEquals provides a more descriptive failure message showing expected vs actual values.

♻️ Use assertEquals for clearer assertion
     Optional<String> decrypted = userDetailsService.getDecryptedIdentifier(userId);
     assertTrue(decrypted.isPresent());
-    assertTrue("TestUser123".equals(decrypted.get()));
+    assertEquals("TestUser123", decrypted.get());
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java`
around lines 94 - 96, Replace the boolean equality check that uses
assertTrue("TestUser123".equals(decrypted.get())) with an assertEquals call so
failures show expected vs actual; keep the presence check
assertTrue(decrypted.isPresent()) and change the comparison to
assertEquals("TestUser123", decrypted.get()) in UserDetailsServiceTest
(reference: variable decrypted).
pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DemographicServiceUtil.java (2)

304-323: Redundant initial assignments before canonical resolution.

Lines 304-305 and 313 set crAppuserId, createdBy, and updatedBy to userId, which are then immediately overwritten at lines 321-323 with the effective (canonical) user ID. Consider removing the initial assignments or consolidating the logic.

♻️ Remove redundant assignments
-    demographicEntity.setCrAppuserId(userId);
-    demographicEntity.setCreatedBy(userId);
     demographicEntity.setCreateDateTime(LocalDateTime.now(ZoneId.of("UTC")));
     demographicEntity.setStatusCode(statuscode);
     log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
             "Hashing start time : " + DateUtils.getUTCCurrentDateTimeString());
     demographicEntity.setDemogDetailHash(HashUtill.hashUtill(demographicEntity.getApplicantDetailJson()));
     log.info(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID,
             "Hashing end time : " + DateUtils.getUTCCurrentDateTimeString());
-    demographicEntity.setUpdatedBy(userId);
     demographicEntity.setUpdateDateTime(LocalDateTime.now(ZoneId.of("UTC")));
     demographicEntity.setEncryptedDateTime(encryptionDateTime);
     
     String effectiveUserId = userDetailsService.resolveCanonicalUserIdOrIdentifier(userId);
     // ... logging ...
     demographicEntity.setCrAppuserId(effectiveUserId);
     demographicEntity.setCreatedBy(effectiveUserId);
     demographicEntity.setUpdatedBy(effectiveUserId);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DemographicServiceUtil.java`
around lines 304 - 323, In DemographicServiceUtil, remove the redundant early
assignments of crAppuserId/createdBy/updatedBy to userId (the calls
demographicEntity.setCrAppuserId(userId);
demographicEntity.setCreatedBy(userId); demographicEntity.setUpdatedBy(userId))
since they are overwritten after resolving the canonical user via
userDetailsService.resolveCanonicalUserIdOrIdentifier; keep the other
initialization (timestamps, status, hashing) as-is and ensure that only the
resolved effectiveUserId is used in
demographicEntity.setCrAppuserId(effectiveUserId),
setCreatedBy(effectiveUserId), and setUpdatedBy(effectiveUserId) to avoid
unnecessary temporary values.

712-722: Redundant initial assignments in saveAndUpdateApplicationEntity.

Similar to prepareDemographicEntityForCreate, lines 712-715 set crBy, updBy to userId, then lines 720-722 overwrite with the effective user ID.

♻️ Consolidate user ID assignments
     applicationEntity.setApplicationStatusCode(applicationStatusCode);
     applicationEntity.setBookingType(bookingTypeCode);
     applicationEntity.setBookingStatusCode(bookingStatusCode);
-    applicationEntity.setCrBy(userId);
     applicationEntity.setCrDtime(LocalDateTime.now(ZoneId.of("UTC")));
-    applicationEntity.setUpdBy(userId);
     applicationEntity.setUpdDtime(LocalDateTime.now(ZoneId.of("UTC")));
     String effectiveUserId = userDetailsService.resolveCanonicalUserIdOrIdentifier(userId);
     log.info(...);
     applicationEntity.setCrBy(effectiveUserId);
     applicationEntity.setUpdBy(effectiveUserId);
     applicationEntity.setContactInfo(effectiveUserId);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DemographicServiceUtil.java`
around lines 712 - 722, In saveAndUpdateApplicationEntity remove the redundant
initial assignments of applicationEntity.setCrBy(userId) and
applicationEntity.setUpdBy(userId) so you only set the timestamps
(applicationEntity.setCrDtime / setUpdDtime) before resolving the canonical
user; then call userDetailsService.resolveCanonicalUserIdOrIdentifier(userId)
and assign the resulting effectiveUserId once to applicationEntity.setCrBy,
applicationEntity.setUpdBy and applicationEntity.setContactInfo, keeping the
existing log that uses maskIdentifier and isCanonicalApplied; this mirrors the
consolidated pattern used in prepareDemographicEntityForCreate and avoids
overwriting values.
pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/ApplicationServiceTest.java (1)

105-134: Unit test mocks both findOrCreateByIdentifier and matchesUser, missing validation of actual production behavior.

The test helper getCanonicalUserIdString uses UUID.nameUUIDFromBytes (deterministic), while production UserDetailsService.findOrCreateByIdentifier creates new users with UUID.randomUUID(). Both methods are mocked in this test, so the internally consistent mocking validates the contract between methods but not the actual implementation. Although production behavior is deterministic for the same identifier (due to hash-based lookup), adding an integration test would validate the real UUID generation and matching flow.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/ApplicationServiceTest.java`
around lines 105 - 134, The test currently stubs both
userDetailsService.findOrCreateByIdentifier and userDetailsService.matchesUser
with a deterministic UUID (getCanonicalUserIdString), which hides real
production behavior; update the setup so findOrCreateByIdentifier returns a
UserDetails whose userId is generated with UUID.randomUUID() (to mirror
production) and stop stubbing matchesUser (or replace the stub by using a spy on
UserDetailsService) so the real matchesUser logic is exercised; adjust
ApplicationServiceTest.setUp() to reflect these changes (modify the
Mockito.when(...) for findOrCreateByIdentifier and remove or convert the
Mockito.when(...) for matchesUser), or alternatively add an integration test
that does not mock UserDetailsService to validate the end-to-end UUID generation
and matching flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/OTPManager.java`:
- Around line 140-145: The code incorrectly canonicalizes a system client ID:
replace the call that obtains and canonicalizes the system property
(environment.getProperty(PreRegLoginConstant.MOSIP_PRE_REG_CLIENTID) +
userDetailsService.resolveCanonicalUserIdOrIdentifier(...)) and stop using the
resolved canonical value for audit fields like otpTxn.setUpdBy; instead set
otpTxn.setUpdBy to the original client id (the raw
environment.getProperty(PreRegLoginConstant.MOSIP_PRE_REG_CLIENTID)) or, if the
intent was to audit the actual end user, use requestDTO.getRequest().getUserId()
and canonicalize that via
userDetailsService.resolveCanonicalUserIdOrIdentifier(...) before
assigning—apply the same change for the similar block around lines 156-161.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DemographicServiceUtil.java`:
- Around line 31-33: Remove the duplicate import of
org.springframework.beans.factory.annotation.Value in the DemographicServiceUtil
class: keep a single import for Value alongside the existing imports (e.g.,
org.springframework.beans.factory.annotation.Qualifier) and delete the redundant
line to avoid duplicate imports.

---

Nitpick comments:
In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java`:
- Around line 432-437: Replace the duplicated inline ownership check with a
single reusable validation call: remove the authUserId/effectiveCrBy/matchesUser
block and invoke the existing userValidation(applicationEntity) helper (or
extract a new private helper that calls userDetailsService.matchesUser and
throws PreIdInvalidForUserIdException) so the ownership check is centralized;
ensure the helper uses authUserDetails().getUserId(),
applicationEntity.getEffectiveCrBy() with the same trim/null handling, and the
same piiBackwardCompatibility flag to preserve behavior.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java`:
- Around line 477-488: Remove the redundant pre-overwrite of updBy: in
AppointmentServiceImpl remove the initial call
applicationEntity.setUpdBy(authUserDetails().getUserId()) and keep only the
canonical assignment using
userDetailsService.resolveCanonicalUserIdOrIdentifier(authUserDetails().getUserId())
before saving via applicationRepostiory.save; ensure no other logic depends on
the raw userId being set earlier and that exception handling around
applicationRepostiory.save remains unchanged.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/CommonServiceUtil.java`:
- Around line 408-415: The method compareUploadedDocListAndValidMandatoryDocList
mutates the input validMandatoryDocForApplicant by calling remove in
uploadedDocs.forEach; instead, avoid side-effects by performing the check on a
copy or using a non-mutating containment check (e.g., create a new List/Set from
validMandatoryDocForApplicant or convert uploadedDocs to a Set and call
containsAll) so the original validMandatoryDocForApplicant is not modified;
update the implementation in compareUploadedDocListAndValidMandatoryDocList to
operate on that copy/Set and return the emptiness/containment result.

In
`@pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DemographicServiceUtil.java`:
- Around line 304-323: In DemographicServiceUtil, remove the redundant early
assignments of crAppuserId/createdBy/updatedBy to userId (the calls
demographicEntity.setCrAppuserId(userId);
demographicEntity.setCreatedBy(userId); demographicEntity.setUpdatedBy(userId))
since they are overwritten after resolving the canonical user via
userDetailsService.resolveCanonicalUserIdOrIdentifier; keep the other
initialization (timestamps, status, hashing) as-is and ensure that only the
resolved effectiveUserId is used in
demographicEntity.setCrAppuserId(effectiveUserId),
setCreatedBy(effectiveUserId), and setUpdatedBy(effectiveUserId) to avoid
unnecessary temporary values.
- Around line 712-722: In saveAndUpdateApplicationEntity remove the redundant
initial assignments of applicationEntity.setCrBy(userId) and
applicationEntity.setUpdBy(userId) so you only set the timestamps
(applicationEntity.setCrDtime / setUpdDtime) before resolving the canonical
user; then call userDetailsService.resolveCanonicalUserIdOrIdentifier(userId)
and assign the resulting effectiveUserId once to applicationEntity.setCrBy,
applicationEntity.setUpdBy and applicationEntity.setContactInfo, keeping the
existing log that uses maskIdentifier and isCanonicalApplied; this mirrors the
consolidated pattern used in prepareDemographicEntityForCreate and avoids
overwriting values.

In
`@pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/ApplicationServiceTest.java`:
- Around line 105-134: The test currently stubs both
userDetailsService.findOrCreateByIdentifier and userDetailsService.matchesUser
with a deterministic UUID (getCanonicalUserIdString), which hides real
production behavior; update the setup so findOrCreateByIdentifier returns a
UserDetails whose userId is generated with UUID.randomUUID() (to mirror
production) and stop stubbing matchesUser (or replace the stub by using a spy on
UserDetailsService) so the real matchesUser logic is exercised; adjust
ApplicationServiceTest.setUp() to reflect these changes (modify the
Mockito.when(...) for findOrCreateByIdentifier and remove or convert the
Mockito.when(...) for matchesUser), or alternatively add an integration test
that does not mock UserDetailsService to validate the end-to-end UUID generation
and matching flow.

In
`@pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/service/UserDetailsService.java`:
- Around line 76-90: The encryptIdentifierIfConfigured method relies on
CryptoUtil.encrypt returning a Base64-encoded string as UTF-8 bytes, which makes
the current new String(byte[], UTF_8) safe but fragile; update the method
(encryptIdentifierIfConfigured) to add a clear inline comment above the
try-block documenting this dependency: note that CryptoUtil returns
Base64-encoded strings (UTF-8 bytes) and that if CryptoUtil changes to return
raw binary ciphertext this code must switch to explicit Base64
encoding/decoding, and apply the same comment to the corresponding
decrypt/round-trip code paths referenced in this class.

In
`@pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java`:
- Around line 94-96: Replace the boolean equality check that uses
assertTrue("TestUser123".equals(decrypted.get())) with an assertEquals call so
failures show expected vs actual; keep the presence check
assertTrue(decrypted.isPresent()) and change the comparison to
assertEquals("TestUser123", decrypted.get()) in UserDetailsServiceTest
(reference: variable decrypted).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b9a8e103-a77f-42c8-adb8-1353609083df

📥 Commits

Reviewing files that changed from the base of the PR and between 9bc82f5 and b336166.

📒 Files selected for processing (20)
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LoginController.java
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/ApplicationService.java
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/DemographicService.java
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/LoginService.java
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/OTPManager.java
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/CommonServiceUtil.java
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DemographicServiceUtil.java
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DocumentServiceUtil.java
  • pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/ApplicationServiceTest.java
  • pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/AppointmentServiceImplTest.java
  • pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/DemographicServiceTest.java
  • pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/LoginServiceTest.java
  • pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/OTPManagerTest.java
  • pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/controller/LoginControllerTest.java
  • pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/test/service/util/DocumentServiceUtilTest.java
  • pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/impl/ApplicationConsumedStatusUpdater.java
  • pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/service/UserDetailsService.java
  • pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java
  • pre-registration/pre-registration-datasync-service/src/main/java/io/mosip/preregistration/datasync/service/util/DataSyncServiceUtil.java
🚧 Files skipped from review as they are similar to previous changes (5)
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/controller/LoginController.java
  • pre-registration/pre-registration-batchjob/src/main/java/io/mosip/preregistration/batchjob/impl/ApplicationConsumedStatusUpdater.java
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/util/DocumentServiceUtil.java
  • pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/DemographicService.java
  • pre-registration/pre-registration-application-service/src/test/java/io/mosip/preregistration/application/service/DemographicServiceTest.java

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java (3)

124-136: Add verification that save() is not called to match test intent.

The test name indicates it should verify no repair occurs, but there's no assertion confirming that save() is never invoked on the repository.

♻️ Suggested improvement
+import static org.mockito.Mockito.never;

     `@Test`
     public void testResolveCanonicalUserIdReturnsExistingUuidWithoutRepairingRecord() {
         UserDetails mapped = new UserDetails();
         mapped.setUserId(UUID.randomUUID());
         mapped.setCrDtimes(LocalDateTime.now());
         mapped.setIdentifierEncrypted("");
         when(userDetailsRepository.findByIdentifierHash(any())).thenReturn(Optional.of(mapped));

         Optional<String> resolved = userDetailsService.resolveCanonicalUserId("TestUser");

         assertTrue(resolved.isPresent());
         assertEquals(mapped.getUserId().toString(), resolved.get());
+        verify(userDetailsRepository, never()).save(any());
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java`
around lines 124 - 136, The test
testResolveCanonicalUserIdReturnsExistingUuidWithoutRepairingRecord should
verify that no repair/save occurs: after stubbing
userDetailsRepository.findByIdentifierHash(...) to return the mapped UserDetails
and calling userDetailsService.resolveCanonicalUserId("TestUser"), add a Mockito
verification that userDetailsRepository.save(...) is never called
(verify(userDetailsRepository, never()).save(any())). Reference the test method
testResolveCanonicalUserIdReturnsExistingUuidWithoutRepairingRecord, the
userDetailsRepository.save method, and resolveCanonicalUserId to locate where to
insert the verification.

27-40: Consider using @ExtendWith(MockitoExtension.class) for proper resource management.

MockitoAnnotations.openMocks(this) returns an AutoCloseable that should be closed to avoid resource leaks. The JUnit 5 idiomatic approach is to use the Mockito extension instead.

♻️ Suggested refactor
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;

+@ExtendWith(MockitoExtension.class)
 public class UserDetailsServiceTest {

     `@Mock`
     private UserDetailsRepository userDetailsRepository;

     `@Mock`
     private CryptoUtil cryptoUtil;

     `@InjectMocks`
     private UserDetailsService userDetailsService;

-    public UserDetailsServiceTest() {
-        MockitoAnnotations.openMocks(this);
-    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java`
around lines 27 - 40, The test class UserDetailsServiceTest currently calls
MockitoAnnotations.openMocks(this) in its constructor which returns an
AutoCloseable that must be closed; replace this manual lifecycle management by
annotating the test class with `@ExtendWith`(MockitoExtension.class) and remove
the constructor/openMocks call so Mockito manages mocks automatically for fields
userDetailsRepository, cryptoUtil and the `@InjectMocks` userDetailsService.

95-95: Prefer assertEquals for better failure messages.

Using assertTrue(expected.equals(actual)) provides unhelpful failure messages. assertEquals shows both expected and actual values.

♻️ Suggested fix
-        assertTrue("TestUser123".equals(decrypted.get()));
+        assertEquals("TestUser123", decrypted.get());
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java`
at line 95, Replace the brittle assertion in UserDetailsServiceTest that uses
assertTrue("TestUser123".equals(decrypted.get())) with an assertEquals call to
provide clearer failure messages; locate the assertion referencing the decrypted
variable in the test method and change it to assertEquals with "TestUser123" as
the expected value and decrypted.get() as the actual value (using the same test
class/method and import style already used in the file).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java`:
- Around line 54-60: The test testFindByIdentifierDelegatesToRepo currently
ignores the returned Optional res; update it to assert that res.isPresent() is
true and that res.get() equals the mocked UserDetails instance you set up.
Locate the test method testFindByIdentifierDelegatesToRepo and add assertions
after calling userDetailsService.findByIdentifier("TestUser") to check
Optional<UserDetails> res is present and that the contained object equals the
mock (the same instance created as UserDetails mock and returned by
userDetailsRepository.findByIdentifierHash(any())); keep the existing
verify(userDetailsRepository).findByIdentifierHash(any()) assertion.

---

Nitpick comments:
In
`@pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java`:
- Around line 124-136: The test
testResolveCanonicalUserIdReturnsExistingUuidWithoutRepairingRecord should
verify that no repair/save occurs: after stubbing
userDetailsRepository.findByIdentifierHash(...) to return the mapped UserDetails
and calling userDetailsService.resolveCanonicalUserId("TestUser"), add a Mockito
verification that userDetailsRepository.save(...) is never called
(verify(userDetailsRepository, never()).save(any())). Reference the test method
testResolveCanonicalUserIdReturnsExistingUuidWithoutRepairingRecord, the
userDetailsRepository.save method, and resolveCanonicalUserId to locate where to
insert the verification.
- Around line 27-40: The test class UserDetailsServiceTest currently calls
MockitoAnnotations.openMocks(this) in its constructor which returns an
AutoCloseable that must be closed; replace this manual lifecycle management by
annotating the test class with `@ExtendWith`(MockitoExtension.class) and remove
the constructor/openMocks call so Mockito manages mocks automatically for fields
userDetailsRepository, cryptoUtil and the `@InjectMocks` userDetailsService.
- Line 95: Replace the brittle assertion in UserDetailsServiceTest that uses
assertTrue("TestUser123".equals(decrypted.get())) with an assertEquals call to
provide clearer failure messages; locate the assertion referencing the decrypted
variable in the test method and change it to assertEquals with "TestUser123" as
the expected value and decrypted.get() as the actual value (using the same test
class/method and import style already used in the file).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 06ba67bf-6a07-4ee8-b9e7-628730030712

📥 Commits

Reviewing files that changed from the base of the PR and between b336166 and 8f82a29.

📒 Files selected for processing (2)
  • pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/service/UserDetailsService.java
  • pre-registration/pre-registration-core/src/test/java/io/mosip/preregistration/core/common/service/UserDetailsServiceTest.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • pre-registration/pre-registration-core/src/main/java/io/mosip/preregistration/core/common/service/UserDetailsService.java

@GOKULRAJ136

Copy link
Copy Markdown
Contributor Author
  1. Move common code like adding record to UserDetails table, creating a list of userIds based on compatibility mode etc to common Utils.
  2. From all places use this common code.
  3. There are too many needless IF conditions which can cause silent failures in code, review all and include only MUST conditions.
  • Resolved by centralizing the user handling logic into a common core utility/service, including user creation and compatibility-based userId resolution.

  • All relevant pre-registration and booking flows have been updated to reuse this shared implementation.

  • Additionally, redundant and unnecessary conditional checks have been removed, retaining only essential guard conditions with proper failure handling.

mohanachandran-s and others added 21 commits April 16, 2026 16:20
Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Sohan Kumar Dey <72375959+Sohandey@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Sohan Kumar Dey <72375959+Sohandey@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Sohan Kumar Dey <72375959+Sohandey@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Sohan Kumar Dey <72375959+Sohandey@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: VSIVAKALYAN <103260988+VSIVAKALYAN@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: VSIVAKALYAN <103260988+VSIVAKALYAN@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
* MOSIP-39585 - Updated the apitest commons version

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

* Update push-trigger.yml

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

---------

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: dhanendra06 <dhanendra.tech@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: kameshsr <kameshsr1338@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Rakshith B <79500257+Rakshithb1@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
* MOSIP-36404 - Added admin role to GetPRIDByDate api

Signed-off-by: Mohanachandran S <mohanachandran.s@technoforte.co.in>

* MOSIP-39993 - Added the value mapping property file

Signed-off-by: Mohanachandran S <mohanachandran.s@technoforte.co.in>

---------

Signed-off-by: Mohanachandran S <mohanachandran.s@technoforte.co.in>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
* MOSIP-39719

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

---------

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
…harden UserLookupException handling across services

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
@GOKULRAJ136
GOKULRAJ136 marked this pull request as ready for review June 1, 2026 08:01
@GOKULRAJ136
GOKULRAJ136 marked this pull request as draft June 5, 2026 05:44
Signed-off-by: Gokulraj C <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: Gokulraj C <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
…sing"

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
@GOKULRAJ136
GOKULRAJ136 marked this pull request as ready for review July 8, 2026 11:10
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
@GOKULRAJ136 GOKULRAJ136 closed this Jul 9, 2026
@GOKULRAJ136 GOKULRAJ136 reopened this Jul 9, 2026
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
…rt migration

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
…y, masking, fail-closed datasync

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
…, batch actor resolution

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
…rom API responses

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
@mayuradesh
mayuradesh merged commit 45b8f6f into mosip:develop Aug 3, 2026
20 checks passed
GOKULRAJ136 added a commit to GOKULRAJ136/pre-registration that referenced this pull request Aug 10, 2026
* MOSIP-34532 - Updated the ReadMe file (mosip#762)

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Create codeql_custom.yml (mosip#775)

Signed-off-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Update codeql_custom.yml (mosip#779)

Signed-off-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-37793 - Updated the Readme file

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* testing 130 release

Signed-off-by: Sohan Kumar Dey <72375959+Sohandey@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-36011

Signed-off-by: Sohan Kumar Dey <72375959+Sohandey@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-36011

Signed-off-by: Sohan Kumar Dey <72375959+Sohandey@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-36011

Signed-off-by: Sohan Kumar Dey <72375959+Sohandey@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* [MOSIP-38555] Removing apitestrig from Sonar analysis

Signed-off-by: VSIVAKALYAN <103260988+VSIVAKALYAN@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Update push-trigger.yml

Signed-off-by: VSIVAKALYAN <103260988+VSIVAKALYAN@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-35404

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-35404

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-35404

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-38489 - Generated single report with 2 sections

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-39585 - Updated the apitest commons version (mosip#803)

* MOSIP-39585 - Updated the apitest commons version

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

* Update push-trigger.yml

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

---------

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Added ZGC (mosip#805)

Signed-off-by: dhanendra06 <dhanendra.tech@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-39769 removed -Xms1g -Xmx2g from docker file (mosip#807)

Signed-off-by: kameshsr <kameshsr1338@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* [MOSIP-35637] added sqaush layers

Signed-off-by: Rakshith B <79500257+Rakshithb1@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-39719 (mosip#808)

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-39993 - Added the value mapping property file (mosip#809)

* MOSIP-36404 - Added admin role to GetPRIDByDate api

Signed-off-by: Mohanachandran S <mohanachandran.s@technoforte.co.in>

* MOSIP-39993 - Added the value mapping property file

Signed-off-by: Mohanachandran S <mohanachandran.s@technoforte.co.in>

---------

Signed-off-by: Mohanachandran S <mohanachandran.s@technoforte.co.in>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Mosip 39047 - Commons cleanup (mosip#813)

* MOSIP-39719

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

---------

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-39047 - Commons cleanup (mosip#814)

* MOSIP-39719

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

---------

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-40274 Automated Pending test cases (mosip#815)

* MOSIP-40274 Automated Pending test cases

Signed-off-by: NitinHegde <nitin.k@cyberpwn.com>

* MOSIP-40274 Automated Pending test cases

Signed-off-by: NitinHegde <nitin.k@cyberpwn.com>

* MOSIP-40274 Automated Pending test cases

Signed-off-by: NitinHegde <nitin.k@cyberpwn.com>

* MOSIP-40274 automate pre-reg testcases part-2

Signed-off-by: NitinHegde <nitin.k@cyberpwn.com>

---------

Signed-off-by: NitinHegde <nitin.k@cyberpwn.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-40277 smoke failures fix for pre-reg (mosip#817)

Signed-off-by: NitinHegde <nitin.k@cyberpwn.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-40887 - Remove keycloak user post execution (mosip#820)

* MOSIP-39719

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-39047

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

* MOSIP-40887

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>

---------

Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Create dependabot.yml (mosip#822)

Signed-off-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Update push-trigger.yml (mosip#823)

Signed-off-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Increase coverage for pre-reg services (mosip#843)

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-40258: Standardized XSS Exception Handling in apitest-prereg Module (mosip#848)

* MOSIP-40258

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-40258

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

---------

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-28246: Removed unused variables from apitest-prereg module (mosip#853)

* MOSIP-40258

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-40258

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-28246 Removed unused variables from apitest-prereg module

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

---------

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-37971: API is giving wrong error code in the response (mosip#854)

* MOSIP-40258

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-40258

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-28246 Removed unused variables from apitest-prereg module

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-37971 API is giving wrong error code in the response

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-37971 Added checkStatusCodeOnlyInResponse for blank PRID cases

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-37971 Removed tab

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

---------

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-28246: Removed commented unused variables from pre-registration module. (mosip#857)

* MOSIP-40258

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-40258

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-28246 Removed unused variables from apitest-prereg module

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-37971 API is giving wrong error code in the response

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-37971 Added checkStatusCodeOnlyInResponse for blank PRID cases

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-37971 Removed tab

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-28246 Removed commented unused variables

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

---------

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-38413 - fix Prereg_GetBookingsForRegCenter_with_InValid_regcenter (mosip#861)

Signed-off-by: Youssef MAHTAT <youssef.mahtat.as.developer@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* [MOSIP-41674] central sonatype migration changes (mosip#869)

* [MOSIP-41674] central sonatype migration changes

Signed-off-by: techno-467 <prafulrakhade02@gmail.com>

* [MOSIP-41674] central sonatype migration changes

Signed-off-by: techno-467 <prafulrakhade02@gmail.com>

* [MOSIP-41674] central sonatype migration changes

Signed-off-by: techno-467 <prafulrakhade02@gmail.com>

---------

Signed-off-by: techno-467 <prafulrakhade02@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-40379 removed ignore line from PreReg API test rigs (mosip#859)

* MOSIP-40379 removed ignore from prereg

Signed-off-by: Prathmesh Jadhav <prathmesh.j@cyberpwn.com>

* MOSIP-40379 removed ignore line from PreReg module

Signed-off-by: Prathmesh Jadhav <prathmesh.j@cyberpwn.com>

* MOSIP-40379 removed ignore line from PreReg module

Signed-off-by: Prathmesh Jadhav <prathmesh.j@cyberpwn.com>

* MOSIP-40379 removed ignore line from PreReg API test rigs

Signed-off-by: Prathmesh Jadhav <prathmesh.j@cyberpwn.com>

---------

Signed-off-by: Prathmesh Jadhav <prathmesh.j@cyberpwn.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-42078 - Reverse merge of release branch to develop branch (mosip#890)

Signed-off-by: Mohanachandran S <mohanachandran.s@technoforte.co.in>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-42160 updated xml with valid order for getPRIDByDateRange (mosip#900)

Signed-off-by: Nitin Hegde <nitin.k@cyberpwn.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-42259: Enable execution of a single test or task with all its required dependencies for PREREG. (mosip#903)

* MOSIP-40258

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-40258

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-28246 Removed unused variables from apitest-prereg module

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-37971 API is giving wrong error code in the response

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-37971 Added checkStatusCodeOnlyInResponse for blank PRID cases

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-37971 Removed tab

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-28246 Removed commented unused variables

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-42259 Enable execution of a single test or task with all its required dependencies clearly mapped and managed externally.

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOdified prereg properties file

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-42259 Changed the POM version

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

* MOSIP-42259

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>

---------

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* pdfgenerator changes (mosip#898)

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* [MOSIP-43137] Updated the installation script moved helm and removed from pre-registration repository.

Signed-off-by: Prafulrakhade <prafulrakhade02@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-43301 - Added the prefix context to run in multiple instances at same time (mosip#957)

* MOSIP-43301 - Added the prefix context to run in multiple instances at same time

Signed-off-by: Mohanachandran S <mohanachandran.s@technoforte.co.in>

* Update Spring Boot Maven plugin version to 3.2.3

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

* Add Spring Boot Maven plugin version 3.2.3

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

* Update spring-boot-maven-plugin version to 3.2.3

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

* Update Spring Boot Maven plugin version to 3.2.3

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

* Remove spring.boot.maven.plugin.version from pom.xml

Removed spring.boot.maven.plugin.version property.

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

* Use variable for spring-boot-maven-plugin version

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

* Remove spring.boot.maven.plugin.version property

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

* Remove spring.boot.maven.plugin.version from pom.xml

Removed spring.boot.maven.plugin.version property.

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

---------

Signed-off-by: Mohanachandran S <mohanachandran.s@technoforte.co.in>
Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* [MOSIP-43312] Added the additionalDependencies for prereg (mosip#952)

* MOSIP-43312: Added the additionalDependencies for prereg

Signed-off-by: Anuranjan14 <anuranjan.kumar@technoforte.co.in>

* MOSIP-43312:Added code in pre-reg util to handle workflow dependencies

Signed-off-by: Anuranjan14 <anuranjan.kumar@technoforte.co.in>

* MOSIP-43312: resolved the review comments

Signed-off-by: Anuranjan14 <anuranjan.kumar@technoforte.co.in>

* MOSIP-43312: Updated the pom version

Signed-off-by: Anuranjan14 <anuranjan.kumar@technoforte.co.in>

---------

Signed-off-by: Anuranjan14 <anuranjan.kumar@technoforte.co.in>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* [MOSIP-43615] [MOSIP-43648] [MOSIP-43434] added lifecycle, graceperiod and updated bitnami depricated image, resources, probes and .gitignore

Signed-off-by: Chandra Keshav Mishra <chandrakeshavmishra@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* [MOSIP-43615] corrected typo

Signed-off-by: Chandra Keshav Mishra <chandrakeshavmishra@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Update apitest-commons version to 1.4.0-SNAPSHOT (mosip#1017)

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Create NOTICE

Signed-off-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Add files via upload

Signed-off-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-44419 (mosip#1023)

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-33663 (mosip#1021)

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* PII Issue Fixes (mosip#1024)

* PII Issue Fixes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fix toString issues

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Added UserValidation to applicant service

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* UUID Changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Cache changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed appointment booking validation error

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed UUID Issues

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed demographic retrieve details issue

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed get all applications API

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed processed_prereg_list table cr_by data issue

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixes nexus build issue

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fix captcha service nexus build

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixes nexus build for batchjob service

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* "Fixes nexus build issue for all pom's"

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Parent pom fixes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert Pom changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert pom changes for nexus build

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert parent pom changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

---------

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed User Encryption PII

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Updated user validation paths

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Updated User Validations

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert "Updated user validation paths" (mosip#1027)

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Added user_details table (mosip#1028)

* Revert "Updated user validation paths"

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Added user_details.sql

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

---------

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Backward Compatibility Changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Backward Compatibility Changes for OTPManager

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fix v1/sync issue

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* DataSyncServiceUtil changes regardigng the sync

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert DataSync Changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Dual backward compatibility fixes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* ApplicationConsumedStatusUpdater for document and appointment

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Added "cr_dtimes" and "encrypted_dtimes" columns for user_details table

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Logger value masking

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Logger value masking for userID

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Logger value masking for preregUserId

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* MOSIP-44331 : Updated descriptions (mosip#1022)

* MOSIP-44331 : Updated description

Signed-off-by: Rachana S P <rachana.p@cyberpwn.com>

* MOSIP-44331 : Pre-reg description updated

Signed-off-by: Rachana S P <rachana.p@cyberpwn.com>

---------

Signed-off-by: Rachana S P <rachana.p@cyberpwn.com>
Co-authored-by: Rachana S P <rachana.p@cyberpwn.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Updated DB Scripts to resolve review comments

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* kernel pom version changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed Consumed tables PII issues

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Core Changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Update apitest-commons version to 1.4.0-SNAPSHOT (mosip#1017)

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>

* MOSIP-44419 (mosip#1023)

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* PII Issue Fixes (mosip#1024)

* PII Issue Fixes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fix toString issues

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Added UserValidation to applicant service

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* UUID Changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Cache changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed appointment booking validation error

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed UUID Issues

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed demographic retrieve details issue

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed get all applications API

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed processed_prereg_list table cr_by data issue

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixes nexus build issue

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fix captcha service nexus build

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixes nexus build for batchjob service

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* "Fixes nexus build issue for all pom's"

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Parent pom fixes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert Pom changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert pom changes for nexus build

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert parent pom changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

---------

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Updated user validation paths

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Updated User Validations

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert "Updated user validation paths" (mosip#1027)

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Added user_details table (mosip#1028)

* Revert "Updated user validation paths"

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Added user_details.sql

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

---------

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Backward Compatibility Changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fix v1/sync issue

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert DataSync Changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Dual backward compatibility fixes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Added "cr_dtimes" and "encrypted_dtimes" columns for user_details table

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Logger value masking

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Updated DB Scripts to resolve review comments

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Core Changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed UUID mapping issue in backward compatibility false mode

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fixed Update Paths for backward compatibility

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Code Cleanup

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Consolidate encryption helpers in UserDetailsService

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Resolved review comments and method name changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Resolve coderabbit review comments

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* cleanup

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* cleanup

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* cleanup

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert OTPManager UUID changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* One-touch migration changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* resolved review comments

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* added proper error code

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Removed unwanted isUUID check

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Review changes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Removed resolveUserUuidOrIdentifier method

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Prevent null UUID from being cached on transient encryption failure

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* fix: replace raw PII audit writes with canonical UUID resolution and harden UserLookupException handling across services

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* fix dead null-checks after UserLookupException, add missing test cases

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* masked PII in login audit writes

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* masked PII in notification log

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Replace hardcoded kernel-core version with variable

Signed-off-by: Gokulraj C <110164849+GOKULRAJ136@users.noreply.github.com>

* Added upgrade and rollback scripts

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fix duplicate user_details rows from inconsistent hash hex casing

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Revert "Fix duplicate user_details rows from inconsistent hash hex casing"

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Updated mosip.prereg.pii.backward.compatibility to true

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* datasync prop correction mosip.prereg.pii.backward.compatibility to true

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Fix re-resolution of canonical UUIDs, drop unused PII flag in batchjob

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Resolve review comments with identity migration + reconciliation job

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Resolve review comments-I: role gate, reconciliation scope, best-effort migration

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Resolve review comments-II: per-column ownership, identity tx boundary, masking, fail-closed datasync

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Resolve review comments-III: contact_info recovery, response-safe ids, batch actor resolution

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

* Covered contact_info recovery & Hide duplicate effective* accessors from API responses

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>

---------

Signed-off-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
Signed-off-by: Sohan Kumar Dey <72375959+Sohandey@users.noreply.github.com>
Signed-off-by: VSIVAKALYAN <103260988+VSIVAKALYAN@users.noreply.github.com>
Signed-off-by: Nandhukumar <nandhukumare@gmail.com>
Signed-off-by: dhanendra06 <dhanendra.tech@gmail.com>
Signed-off-by: kameshsr <kameshsr1338@gmail.com>
Signed-off-by: Rakshith B <79500257+Rakshithb1@users.noreply.github.com>
Signed-off-by: Mohanachandran S <mohanachandran.s@technoforte.co.in>
Signed-off-by: NitinHegde <nitin.k@cyberpwn.com>
Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
Signed-off-by: Youssef MAHTAT <youssef.mahtat.as.developer@gmail.com>
Signed-off-by: techno-467 <prafulrakhade02@gmail.com>
Signed-off-by: Prathmesh Jadhav <prathmesh.j@cyberpwn.com>
Signed-off-by: Nitin Hegde <nitin.k@cyberpwn.com>
Signed-off-by: Prafulrakhade <prafulrakhade02@gmail.com>
Signed-off-by: Anuranjan14 <anuranjan.kumar@technoforte.co.in>
Signed-off-by: Chandra Keshav Mishra <chandrakeshavmishra@gmail.com>
Signed-off-by: Rachana S P <rachana.p@cyberpwn.com>
Signed-off-by: Gokulraj C <110164849+GOKULRAJ136@users.noreply.github.com>
Co-authored-by: Mohanachandran S <165888272+mohanachandran-s@users.noreply.github.com>
Co-authored-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
Co-authored-by: Sohan Kumar Dey <72375959+Sohandey@users.noreply.github.com>
Co-authored-by: VSIVAKALYAN <103260988+VSIVAKALYAN@users.noreply.github.com>
Co-authored-by: Nandhukumar <nandhukumare@gmail.com>
Co-authored-by: dhanendra06 <60607841+dhanendra06@users.noreply.github.com>
Co-authored-by: kameshsr <47484458+kameshsr@users.noreply.github.com>
Co-authored-by: Rakshith B <79500257+Rakshithb1@users.noreply.github.com>
Co-authored-by: Nitin Hegde <165893206+hegdenitin@users.noreply.github.com>
Co-authored-by: Sradha Mohanty <134414554+SradhaMohanty5899@users.noreply.github.com>
Co-authored-by: ymahtat-dev <71645850+ymahtat-dev@users.noreply.github.com>
Co-authored-by: Praful Rakhade <prafulrakhade02@gmail.com>
Co-authored-by: prathmeshj12 <166711249+prathmeshj12@users.noreply.github.com>
Co-authored-by: Sradha Mohanty <mohantysradha10@gmail.com>
Co-authored-by: Anuranjan14 <120705365+Anuranjan14@users.noreply.github.com>
Co-authored-by: Chandra Keshav Mishra <chandrakeshavmishra@gmail.com>
Co-authored-by: Rachana S P <153977086+rachanaspsoratur@users.noreply.github.com>
Co-authored-by: Rachana S P <rachana.p@cyberpwn.com>
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.