Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
104547d
Reverted Changes
ravishanigarapu Dec 24, 2024
85ca627
removed Unused imports
ravishanigarapu Dec 24, 2024
efe5412
Merge branch 'PSMRI:develop' into develop
ravishanigarapu Jan 9, 2025
f30feda
Merge branch 'PSMRI:develop' into develop
ravishanigarapu Feb 24, 2025
25d6cbe
Merge branch 'PSMRI:develop' into develop
ravishanigarapu Feb 28, 2025
1e675d9
Merge branch 'PSMRI:develop' into develop
ravishanigarapu Apr 7, 2025
6f93e13
Update application.properties
ravishanigarapu Apr 7, 2025
9ea499d
Merge branch 'PSMRI:develop' into develop
ravishanigarapu Apr 17, 2025
fe1908c
Swagger changes
ravishanigarapu Apr 17, 2025
3602722
Merge branch 'PSMRI:develop' into develop
ravishanigarapu May 14, 2025
e37d6ba
Null Condition Added
ravishanigarapu May 14, 2025
2e2d733
Merge branch 'PSMRI:develop' into develop
ravishanigarapu May 20, 2025
35237c1
AMM-1456
ravishanigarapu May 20, 2025
36dbe68
Indent format
ravishanigarapu May 20, 2025
3498d85
User-Agent validation
ravishanigarapu May 22, 2025
681977d
wrapper class added
ravishanigarapu May 22, 2025
f29182e
RestTemplateUtil class created for Headers
ravishanigarapu May 22, 2025
44a9c0e
code rabbit issues fixed
ravishanigarapu May 22, 2025
4d24d28
if condition added
ravishanigarapu May 22, 2025
97659e7
null check
ravishanigarapu May 22, 2025
0987627
Merge branch 'develop' into develop
ravishanigarapu May 22, 2025
72e5839
loggers Added
ravishanigarapu May 23, 2025
b6c2e1d
Merge branch 'PSMRI:develop' into develop
ravishanigarapu May 23, 2025
3375310
Merge branch 'develop' of https://github.com/ravishanigarapu/TM-API i…
ravishanigarapu May 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ public String registerBeneficiary(String comingRequest, String Authorization) th

RestTemplate restTemplate = new RestTemplate();
HttpEntity<Object> request = RestTemplateUtil.createRequestEntity(comingRequest, Authorization);
logger.info("Before Calling Common-API registration : "+request.getHeaders());
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ› οΈ Refactor suggestion

⚠️ Potential issue

Avoid logging sensitive headers and use parameterized logging
Concatenating and logging request.getHeaders() at INFO can expose credentials (e.g., Authorization or cookie tokens) and incurs unnecessary string‐building overhead. Use SLF4J parameterized logs and filter or mask sensitive entries. For example:

-  logger.info("Before Calling Common-API registration : "+request.getHeaders());
+  HttpHeaders safeHeaders = filterSensitiveHeaders(request.getHeaders(), List.of(HttpHeaders.AUTHORIZATION, HttpHeaders.COOKIE));
+  logger.debug("Before calling Common-API registration, headers: {}", safeHeaders);

Implement filterSensitiveHeaders(...) to redact or remove sensitive keys.

Committable suggestion skipped: line range outside the PR's diff.

πŸ€– Prompt for AI Agents
In src/main/java/com/iemr/tm/service/registrar/RegistrarServiceImpl.java at line
663, avoid concatenating and logging request headers directly as it may expose
sensitive information and cause unnecessary string building. Instead, implement
a method like filterSensitiveHeaders(...) to redact or remove sensitive headers,
then log the filtered headers using SLF4J parameterized logging syntax to
prevent string concatenation overhead and protect sensitive data.

ResponseEntity<String> response = restTemplate.exchange(registrationUrl, HttpMethod.POST, request,
String.class);
if (response.getStatusCodeValue() == 200 & response.hasBody()) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/iemr/tm/utils/RestTemplateUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static HttpEntity<Object> createRequestEntity(Object body, String authori

ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
if (servletRequestAttributes == null) {
logger.info("Null servletRequestAttributes");
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE + ";charset=utf-8");
headers.add(HttpHeaders.AUTHORIZATION, authorization);
Expand Down
Loading