Skip to content

Conversation

@prakash100198
Copy link
Contributor

@prakash100198 prakash100198 commented Jan 7, 2026

…behavior

Description

Fixes https://github.com/devtron-labs/sprint-tasks/issues/2765

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit/api test cases.

Does this PR introduce a user-facing change?


Summary by Bito

  • This pull request addresses a bug in the user audit handling by replacing the 'Update' method with 'Save', ensuring that duplicate entries are not created in the user_audit table, which improves data integrity.
  • The modification is focused on the UserService implementation, specifically in the handling of user audit records.
  • Overall summary: addresses user audit handling, improves data integrity.

vikramdevtron
vikramdevtron previously approved these changes Jan 7, 2026

func LogRequest(auditLogDto *AuditLoggerDTO) {
log.Printf("AUDIT_LOG: requestMethod: %s, urlPath: %s, queryParams: %s, updatedBy: %s, updatedOn: %s, apiResponseCode: %d, responseTime: %s, requestPayload: %s", auditLogDto.RequestMethod, auditLogDto.UrlPath, auditLogDto.QueryParams, auditLogDto.UserEmail, auditLogDto.UpdatedOn, auditLogDto.ApiResponseCode, auditLogDto.ResponseTime, auditLogDto.RequestPayload)
log.Printf("AUDIT_LOG: clientIp: %s, requestMethod: %s, urlPath: %s, queryParams: %s, updatedBy: %s, updatedOn: %s, apiResponseCode: %d, responseTime: %s, requestPayload: %s", auditLogDto.ClientIp, auditLogDto.RequestMethod, auditLogDto.UrlPath, auditLogDto.QueryParams, auditLogDto.UserEmail, auditLogDto.UpdatedOn, auditLogDto.ApiResponseCode, auditLogDto.ResponseTime, auditLogDto.RequestPayload)

Check notice

Code scanning / SonarCloud

Logging should not be vulnerable to injection attacks Low

Change this code to not log user-controlled data. See more on SonarQube Cloud
…erAudit` to log `ClientIP` and update audit records
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 7, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
B Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@prakash100198 prakash100198 changed the title misc: Replace Update with Save in userAudit handling to avoid upsert … misc: add clientIP in audit log Jan 7, 2026
@prakash100198 prakash100198 merged commit 588ea30 into main Jan 7, 2026
13 of 14 checks passed
@prakash100198 prakash100198 deleted the revert-update-api-token branch January 7, 2026 07:28
@bito-code-review
Copy link

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants