-
Notifications
You must be signed in to change notification settings - Fork 48
Improve User Authentication to Prevent Enumeration #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b17be34
ac2cdda
c1021ea
3b8f46f
fd8084b
dfe0272
46d61c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -296,7 +296,7 @@ public List<GrievanceWorklistDTO> getFormattedGrievanceData(String request) thro | |||||||||
|
|
||||||||||
| // Loop through the worklist data and format the response | ||||||||||
| for (Object[] row : worklistData) { | ||||||||||
| if (row == null || row.length < 22) | ||||||||||
| if (row == null || row.length < 24) | ||||||||||
| { | ||||||||||
| logger.warn("invalid row data received"); | ||||||||||
| continue; | ||||||||||
|
|
@@ -334,7 +334,8 @@ public List<GrievanceWorklistDTO> getFormattedGrievanceData(String request) thro | |||||||||
| ageFormatted, | ||||||||||
| (Boolean) row[21], // retryNeeded | ||||||||||
| (Integer) row[22], // callCounter | ||||||||||
| (Timestamp) row[13] //lastCall | ||||||||||
| (Timestamp) row[13], // lastCall | ||||||||||
| (Boolean) row[23] //beneficiaryConsent | ||||||||||
|
Comment on lines
+337
to
+338
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Verification agent π§© Analysis chainVerify lastCall field assignment. The π Script executed: #!/bin/bash
# Description: Check the database query or stored procedure that populates the worklistData to understand the correct field mapping
# Expected: Find the query definition to verify what row[13] actually represents and if there's a separate lastCall field
# Search for the stored procedure or query definition that provides worklistData
rg -A 10 -B 5 "getGrievanceWorklistData|grievance.*worklist.*data" --type java
# Look for any SQL queries or native queries that might show the field order
ast-grep --pattern 'nativeQuery = $_'Length of output: 3892 To verify the field ordering, letβs pull in the full mapping block around those π Script executed: #!/bin/bash
# Extract the array-to-DTO mapping in GrievanceHandlingServiceImpl
sed -n '300,380p' src/main/java/com/iemr/common/service/grievance/GrievanceHandlingServiceImpl.javaLength of output: 4023 Fix incorrect The β’ File: Suggested diff (adjust indices to match your procedureβs column order): - (Timestamp) row[13], // lastCall
- (Boolean) row[23] // beneficiaryConsent
+ (Timestamp) row[23], // lastCall
+ (Boolean) row[24] // beneficiaryConsentPlease verify the actual column positions in π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||
|
|
||||||||||
| ); | ||||||||||
|
|
||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -125,6 +125,7 @@ public String addKMFile(String request) throws IOException, NoSuchAlgorithmExcep | |||
| return kmFileManagers.toString(); | ||||
| } | ||||
|
|
||||
|
|
||||
| private ArrayList<KMFileManager> addKMFile(Iterable<KMFileManager> kmFileManagers) | ||||
| throws IOException, NoSuchAlgorithmException { | ||||
| ArrayList<KMFileManager> savedFileManagers = new ArrayList<KMFileManager>(); | ||||
|
|
@@ -175,6 +176,9 @@ private ArrayList<KMFileManager> addKMFile(Iterable<KMFileManager> kmFileManager | |||
| if (uuid != null) { | ||||
| kmFileManager.setKmUploadStatus(KM_UPLOADSTATUS_COMPLETED); | ||||
| kmFileManager.setFileUID(uuid); | ||||
|
|
||||
| kmFileManager.setSubCategoryID(kmFileManager.getSubCategoryID()); | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Remove redundant assignment. The line - kmFileManager.setSubCategoryID(kmFileManager.getSubCategoryID());π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||
|
|
||||
| savedFileManagers.add(kmFileManagerRepository.save(kmFileManager)); | ||||
| if (kmFileManager.getSubCategoryID() != null) { | ||||
| updateSubcategoryFilePath(kmFileManager); | ||||
|
|
@@ -197,6 +201,7 @@ private ArrayList<KMFileManager> addKMFile(Iterable<KMFileManager> kmFileManager | |||
| return savedFileManagers; | ||||
| } | ||||
|
|
||||
|
|
||||
| private void updateSubcategoryFilePath(KMFileManager kmFileManager) { | ||||
| subCategoryRepository.updateFilePath(kmFileManager.getSubCategoryID(), kmFileManager.getFileUID()); | ||||
| } | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security concern: Direct exception propagation may leak sensitive information.
Propagating raw exceptions directly to the response could expose internal system details, stack traces, or database information that attackers could exploit. This contradicts the PR's objective of preventing information leakage.
Consider maintaining generic error messages for client responses while logging detailed exceptions server-side:
} catch (Exception e) { logger.error("userAuthenticate failed with error " + e.getMessage(), e); - response.setError(e); + response.setError(5000, "Authentication failed. Please try again."); }Also applies to: 648-648, 737-737, 755-755, 1061-1061, 1079-1079, 1163-1163
π€ Prompt for AI Agents