Skip to content

fix(chat): alter encryption logic for ai service#9562

Merged
Gnanasundari24 merged 2 commits intomainfrom
fix-encyption-logic-for-ai-service-list
Oct 1, 2025
Merged

fix(chat): alter encryption logic for ai service#9562
Gnanasundari24 merged 2 commits intomainfrom
fix-encyption-logic-for-ai-service-list

Conversation

@apoorvdixit88
Copy link
Contributor

@apoorvdixit88 apoorvdixit88 commented Sep 25, 2025

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR addresses an issue where chat conversation history could not be decrypted in the chat/ai/list endpoint. The root cause was an inconsistency between the encryption method used when storing chat interactions (chat/ai/data) and the decryption method used when retrieving them (chat/ai/list).

This change standardizes the encryption process to use the direct GcmAes256 utility, ensuring compatibility between encryption and decryption, and resolving the data retrieval failures.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Closes #9561

How did you test it?

The list endpoint is working fine with new encryption logic:

curl --location 'http://localhost:8080/chat/ai/list?merchant_id=merchant_1758788495' \
--header 'Authorization: Bearer JWT' \

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@apoorvdixit88 apoorvdixit88 self-assigned this Sep 25, 2025
@apoorvdixit88 apoorvdixit88 requested a review from a team as a code owner September 25, 2025 08:36
@apoorvdixit88 apoorvdixit88 added the C-bug Category: Bug label Sep 25, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented Sep 25, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/utils/chat.rs  33% smaller

ThisIsMani
ThisIsMani previously approved these changes Sep 25, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Oct 1, 2025
Merged via the queue into main with commit 382fae1 Oct 1, 2025
21 of 25 checks passed
@Gnanasundari24 Gnanasundari24 deleted the fix-encyption-logic-for-ai-service-list branch October 1, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bug Category: Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Decryption failure in chat prevents retrieval of conversation history

5 participants