Skip to content

feat: 전화번호 저장 시 암호화하여 저장#226

Open
maark1106 wants to merge 5 commits intodevfrom
feature/phone-number-encryption#220
Open

feat: 전화번호 저장 시 암호화하여 저장#226
maark1106 wants to merge 5 commits intodevfrom
feature/phone-number-encryption#220

Conversation

@maark1106
Copy link
Contributor

📌 관련 이슈

사용자 전화번호 암호화하여 데이터베이스에 저장 [#220]


🛠️ 작업 내용

  • 사용자 전화번호 저장 시 데이터베이스 암호화


🎯 리뷰 포인트



📎 커밋 범위 링크



@maark1106 maark1106 added the ✨ Feature 기능 개발 label Mar 30, 2025
@maark1106 maark1106 added this to the 보안 milestone Mar 30, 2025
@maark1106 maark1106 requested a review from Copilot March 30, 2025 04:17
@maark1106 maark1106 self-assigned this Mar 30, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces phone number encryption when storing user data, ensuring that sensitive data is encrypted before being persisted in the database.

  • Updated the Student entity to use an encrypted converter and increased the column length for the phone number.
  • Added a new endpoint and service method to retrieve the decrypted phone number.
  • Implemented an EncryptionService and associated EncryptedConverter to perform AES encryption and decryption.

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/main/java/com/team/buddyya/student/service/StudentService.java Added a new service method to retrieve the user's phone number.
src/main/java/com/team/buddyya/student/domain/Student.java Updated the phoneNumber field to use encryption with an increased column length.
src/main/java/com/team/buddyya/student/controller/UserController.java Added an endpoint for fetching the phone number.
src/main/java/com/team/buddyya/common/service/EncryptionService.java Introduced AES encryption and decryption functionality.
src/main/java/com/team/buddyya/common/service/EncryptedConverter.java Created an AttributeConverter to integrate encryption with JPA.
src/main/java/com/team/buddyya/common/exception/CommonExceptionType.java Added a specific exception type for encryption errors.
src/main/java/com/team/buddyya/common/config/ConverterConfig.java Configured the EncryptedConverter with the EncryptionService dependency.
Files not reviewed (1)
  • src/main/resources/db/migration/V11__increase_phone_number_length.sql: Language not supported
Comments suppressed due to low confidence (3)

src/main/java/com/team/buddyya/student/service/StudentService.java:177

  • [nitpick] The name 'findStudentService' may imply a service layer role, which could be confusing if this field is responsible for repository operations. Consider renaming it to more clearly reflect its purpose.
Student student = findStudentService.findByStudentId(studentInfo.id());

src/main/java/com/team/buddyya/common/service/EncryptionService.java:23

  • Consider explicitly specifying the encryption mode and padding (for example, 'AES/ECB/PKCS5Padding') rather than relying on defaults, to ensure consistent and secure encryption behavior.
Cipher cipher = Cipher.getInstance(ALGORITHM);

src/main/java/com/team/buddyya/student/domain/Student.java:34

  • With the phone number field now storing an encrypted value and the column length increased to 128, please verify that any phone number validations and constraints elsewhere in the application have been updated accordingly.
@Convert(converter = EncryptedConverter.class)

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

Labels

✨ Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants