Skip to content
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

๐Ÿ”— :: (#444) ํšŒ์›๊ฐ€์ž… ๋น„๋ฐ€๋ฒˆํ˜ธ ๋””์ฝ”๋”ฉ #445

Conversation

parkuiery
Copy link
Member

@parkuiery parkuiery commented Nov 21, 2024

๊ฐœ์š”

ํšŒ์›๊ฐ€์ž… ๋น„๋ฐ€๋ฒˆํ˜ธ ์ž…๋ ฅ์—์„œ #(ํŠน์ˆ˜๋ฌธ์ž)์ด ์ž…๋ ฅ๋˜๋ฉด JsonDecode์—์„œ ์˜ค๋ฅ˜ ๋ฐœ์ƒํ•จ
์›์ธ: navigation์„ ํ†ตํ•ด ๋ฐ์ดํ„ฐ๋ฅผ ์ „๋‹ฌํ•  ๋•Œ URL ๋””์ฝ”๋”ฉ์ด ์ž๋™์œผ๋กœ ๋ฐœ์ƒํ•จ
ํ•ด๊ฒฐ: URL๋””์ฝ”๋”ฉ์„ ๋ฐฉ์‹์„ Base64 ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝํ•จ

์ž‘์—… ๋‚ด์šฉ

  • ๋””์ฝ”๋”ฉ ๋ฐฉ์‹ ๋ณ€๊ฒฝ

ํ•  ๋ง

์—†์Œ

Summary by CodeRabbit

  • ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ
    • ๋น„๋ฐ€๋ฒˆํ˜ธ ์ธ์ฝ”๋”ฉ ๋ฐฉ์‹์„ URL ์ธ์ฝ”๋”ฉ์—์„œ Base64 ์ธ์ฝ”๋”ฉ์œผ๋กœ ๋ณ€๊ฒฝํ•˜์—ฌ ๋ณด์•ˆ์„ฑ์„ ํ–ฅ์ƒ์‹œ์ผฐ์Šต๋‹ˆ๋‹ค.
  • ๋ฒ„๊ทธ ์ˆ˜์ •
    • ๋น„๋ฐ€๋ฒˆํ˜ธ ๋””์ฝ”๋”ฉ ๋ฐฉ์‹์„ URL ๋””์ฝ”๋”ฉ์—์„œ Base64 ๋””์ฝ”๋”ฉ์œผ๋กœ ๋ณ€๊ฒฝํ•˜์—ฌ ์ผ๊ด€์„ฑ์„ ๊ฐœ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.

@parkuiery parkuiery added the ๋ฒ„๊ทธ ๋ฒ„๊ทธ๋ฅผ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค. label Nov 21, 2024
@parkuiery parkuiery self-assigned this Nov 21, 2024
@parkuiery parkuiery requested a review from a team as a code owner November 21, 2024 06:23
Copy link
Contributor

coderabbitai bot commented Nov 21, 2024

Walkthrough

SetPasswordViewModel.kt์™€ TermsViewModel.kt ํŒŒ์ผ์—์„œ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ฒ˜๋ฆฌ ๋ฐฉ์‹์ด ๋ณ€๊ฒฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. SetPasswordViewModel์—์„œ๋Š” ๋น„๋ฐ€๋ฒˆํ˜ธ ์ธ์ฝ”๋”ฉ์ด URL ์ธ์ฝ”๋”ฉ์—์„œ Base64 ์ธ์ฝ”๋”ฉ์œผ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ๊ณ , TermsViewModel์—์„œ๋Š” ๋น„๋ฐ€๋ฒˆํ˜ธ ๋””์ฝ”๋”ฉ ๋ฐฉ์‹์ด URL ๋””์ฝ”๋”ฉ์—์„œ Base64 ๋””์ฝ”๋”ฉ์œผ๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋‘ ํŒŒ์ผ ๋ชจ๋‘ Base64 ๊ด€๋ จ import ๋ฌธ์ด ์ถ”๊ฐ€๋˜์—ˆ์œผ๋ฉฐ, ์ „์ฒด์ ์ธ ์ œ์–ด ํ๋ฆ„์ด๋‚˜ ์ƒํƒœ ๊ด€๋ฆฌ ๋กœ์ง์€ ๋ณ€๊ฒฝ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

Changes

ํŒŒ์ผ ๊ฒฝ๋กœ ๋ณ€๊ฒฝ ์š”์•ฝ
feature/signup/src/main/java/team/retum/signup/viewmodel/SetPasswordViewModel.kt - URLEncoder import ๋ฌธ ์ œ๊ฑฐ
- ๋น„๋ฐ€๋ฒˆํ˜ธ ์ธ์ฝ”๋”ฉ์„ URL ์ธ์ฝ”๋”ฉ์—์„œ Base64 ์ธ์ฝ”๋”ฉ์œผ๋กœ ๋ณ€๊ฒฝ
- postSideEffect ๋ฉ”์„œ๋“œ์— Base64 ์ธ์ฝ”๋”ฉ๋œ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ง์ ‘ ์ „๋‹ฌ
feature/signup/src/main/java/team/retum/signup/viewmodel/TermsViewModel.kt - URLDecoder ์‚ฌ์šฉ์—์„œ Base64 ๋””์ฝ”๋”ฉ์œผ๋กœ ๋ณ€๊ฒฝ
- Base64 import ๋ฌธ ์ถ”๊ฐ€

Possibly related PRs

Suggested labels

๋ฆฌํŒฉํ† ๋ง

Suggested reviewers

  • Tmdhoon2

๐Ÿ‡ ๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ๋ฐ”๋€Œ์—ˆ์–ด์š”,
URL์—์„œ Base64๋กœ,
์ด์ œ๋Š” ๋” ์•ˆ์ „ํ•˜๊ฒŒ,
๋ฐ์ดํ„ฐ๊ฐ€ ์ˆจ๊ฒจ์ ธ์š”!
๋ณ€ํ™”๋ฅผ ์ถ•ํ•˜ํ•ด์š”,
๋ชจ๋‘ ํ•จ๊ป˜ ๊ธฐ๋ปํ•ด์š”!
๐Ÿฅณ


๐Ÿ“œ Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between c3c336f and 515a429.

๐Ÿ“’ Files selected for processing (1)
  • feature/signup/src/main/java/team/retum/signup/viewmodel/SetPasswordViewModel.kt (2 hunks)
๐Ÿšง Files skipped from review as they are similar to previous changes (1)
  • feature/signup/src/main/java/team/retum/signup/viewmodel/SetPasswordViewModel.kt

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

โค๏ธ Share
๐Ÿชง Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 391f7af and e735fcc.

๐Ÿ“’ Files selected for processing (2)
  • feature/signup/src/main/java/team/retum/signup/viewmodel/SetPasswordViewModel.kt (2 hunks)
  • feature/signup/src/main/java/team/retum/signup/viewmodel/TermsViewModel.kt (2 hunks)
๐Ÿ”‡ Additional comments (3)
feature/signup/src/main/java/team/retum/signup/viewmodel/SetPasswordViewModel.kt (1)

7-7: Base64 ์ธ์ฝ”๋”ฉ ๊ด€๋ จ import ์ถ”๊ฐ€ ํ™•์ธ

์ ์ ˆํ•œ import ๋ฌธ์ด ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

feature/signup/src/main/java/team/retum/signup/viewmodel/TermsViewModel.kt (2)

14-14: Base64 ๋””์ฝ”๋”ฉ์„ ์œ„ํ•œ import ์ถ”๊ฐ€๊ฐ€ ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

Base64 ๋””์ฝ”๋”ฉ ๊ตฌํ˜„์„ ์œ„ํ•ด ํ•„์š”ํ•œ import๋ฌธ์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.


43-43: ๋น„๋ฐ€๋ฒˆํ˜ธ ๋””์ฝ”๋”ฉ ๋ฐฉ์‹ ๋ณ€๊ฒฝ์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

ํŠน์ˆ˜๋ฌธ์ž ์ฒ˜๋ฆฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด URL ๋””์ฝ”๋”ฉ์—์„œ Base64 ๋””์ฝ”๋”ฉ์œผ๋กœ ๋ณ€๊ฒฝํ•œ ๊ฒƒ์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค. ๋‹ค๋งŒ ๋‹ค์Œ ์‚ฌํ•ญ๋“ค์„ ๊ณ ๋ คํ•ด์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค:

  1. ์ด ๋ณ€๊ฒฝ์‚ฌํ•ญ์— ๋Œ€ํ•œ ์ฃผ์„ ์ถ”๊ฐ€๋ฅผ ๊ถŒ์žฅ๋“œ๋ฆฝ๋‹ˆ๋‹ค.
  2. ํด๋ผ์ด์–ธํŠธ ์ธก์˜ ์ธ์ฝ”๋”ฉ๋„ Base64๋กœ ์ผ๊ด€๋˜๊ฒŒ ๋ณ€๊ฒฝ๋˜์—ˆ๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ฃผ์„์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

+ // ํŠน์ˆ˜๋ฌธ์ž ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•ด URL ๋””์ฝ”๋”ฉ ๋Œ€์‹  Base64 ๋””์ฝ”๋”ฉ ์‚ฌ์šฉ
val decodedPassword = String(Base64.getDecoder().decode(password))

ํด๋ผ์ด์–ธํŠธ ์ธก ์ธ์ฝ”๋”ฉ ๋ฐฉ์‹ ํ™•์ธ์„ ์œ„ํ•ด ๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:

โœ… Verification successful

Let me check the encoding implementation in SetPasswordViewModel.kt to verify the consistency.


๋น„๋ฐ€๋ฒˆํ˜ธ ์ธ์ฝ”๋”ฉ/๋””์ฝ”๋”ฉ ๊ตฌํ˜„์ด ์ผ๊ด€๋˜๊ฒŒ ์ ์šฉ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

ํด๋ผ์ด์–ธํŠธ์™€ ์„œ๋ฒ„ ๊ฐ„์˜ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ฒ˜๋ฆฌ๊ฐ€ Base64๋กœ ์ •ํ™•ํ•˜๊ฒŒ ์ผ์น˜ํ•ฉ๋‹ˆ๋‹ค:

  • SetPasswordViewModel์—์„œ Base64.getEncoder()๋กœ ์ธ์ฝ”๋”ฉ
  • TermsViewModel์—์„œ Base64.getDecoder()๋กœ ๋””์ฝ”๋”ฉ
๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: ๋น„๋ฐ€๋ฒˆํ˜ธ ์ธ์ฝ”๋”ฉ ๊ด€๋ จ ์ฝ”๋“œ ํ™•์ธ

# ๋น„๋ฐ€๋ฒˆํ˜ธ ์ธ์ฝ”๋”ฉ ๊ด€๋ จ ์ฝ”๋“œ ๊ฒ€์ƒ‰
rg -t kotlin "password.*encode" 

Length of output: 210


Script:

#!/bin/bash
# Check the implementation of password encoding in SetPasswordViewModel
rg -A 5 -B 5 "encodedPassword" feature/signup/src/main/java/team/retum/signup/viewmodel/SetPasswordViewModel.kt

Length of output: 492

Comment on lines 58 to 59
val encodedPassword = Base64.getEncoder().encodeToString(state.value.password.toByteArray())
postSideEffect(SetPasswordSideEffect.MoveToNext(password = encodedPassword.toString()))
Copy link
Contributor

Choose a reason for hiding this comment

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

๐Ÿ’ก Codebase verification

โš ๏ธ Potential issue

Base64 ์ธ์ฝ”๋”ฉ/๋””์ฝ”๋”ฉ ๊ตฌํ˜„์˜ ๋ณด์•ˆ ๋ฐ ์•ˆ์ •์„ฑ ๊ฐœ์„  ํ•„์š”

Base64 ์ธ์ฝ”๋”ฉ/๋””์ฝ”๋”ฉ ๊ตฌํ˜„์„ ๊ฒ€ํ† ํ•œ ๊ฒฐ๊ณผ, ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค:

  • SetPasswordViewModel.kt์—์„œ:
    • ๋ฌธ์ž ์ธ์ฝ”๋”ฉ(UTF-8) ๋ช…์‹œ ํ•„์š”
    • ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๋กœ์ง ์ถ”๊ฐ€ ํ•„์š”
  • TermsViewModel.kt์—์„œ:
    • Base64 ๋””์ฝ”๋”ฉ ์‹œ ์˜ˆ์™ธ ์ฒ˜๋ฆฌ ๋ˆ„๋ฝ
    • ๋ฌธ์ž ์ธ์ฝ”๋”ฉ ๋ช…์‹œ ํ•„์š”

์ œ์•ˆํ•˜๋Š” ๊ฐœ์„ ์‚ฌํ•ญ:

// SetPasswordViewModel.kt
try {
    val encodedPassword = Base64.getEncoder().encodeToString(
        state.value.password.toByteArray(Charsets.UTF_8)
    )
    postSideEffect(SetPasswordSideEffect.MoveToNext(password = encodedPassword))
} catch (e: Exception) {
    setState { state.value.copy(buttonEnabled = true) }
    // ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋กœ์ง ์ถ”๊ฐ€
}

// TermsViewModel.kt
try {
    val decodedPassword = String(
        Base64.getDecoder().decode(password),
        Charsets.UTF_8
    )
    // ํ›„์† ์ฒ˜๋ฆฌ
} catch (e: IllegalArgumentException) {
    // ๋””์ฝ”๋”ฉ ์‹คํŒจ ์ฒ˜๋ฆฌ
}
๐Ÿ”— Analysis chain

Base64 ์ธ์ฝ”๋”ฉ ๊ตฌํ˜„ ๊ด€๋ จ ๋ณด์•ˆ ๊ฒ€ํ†  ํ•„์š”

Base64 ์ธ์ฝ”๋”ฉ์œผ๋กœ์˜ ๋ณ€๊ฒฝ์€ ํŠน์ˆ˜ ๋ฌธ์ž ์ฒ˜๋ฆฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, ๋ช‡ ๊ฐ€์ง€ ๊ณ ๋ ค์‚ฌํ•ญ์ด ์žˆ์Šต๋‹ˆ๋‹ค:

  1. Base64 ์ธ์ฝ”๋”ฉ์€ ๊ฐ€์—ญ์ ์ด๋ฏ€๋กœ ๋ฏผ๊ฐํ•œ ๋ฐ์ดํ„ฐ ์ „์†ก ์‹œ ๋ฐ˜๋“œ์‹œ ์ถ”๊ฐ€์ ์ธ ๋ณด์•ˆ ๊ณ„์ธต(์˜ˆ: HTTPS)์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
  2. ์ธ์ฝ”๋”ฉ ๊ณผ์ •์—์„œ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๊ฐ€ ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
  3. ๋ฌธ์ž์—ด ์ธ์ฝ”๋”ฉ(Charset) ์ฒ˜๋ฆฌ๊ฐ€ ๋ช…์‹œ์ ์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฐœ์„ ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

- val encodedPassword = Base64.getEncoder().encodeToString(state.value.password.toByteArray())
- postSideEffect(SetPasswordSideEffect.MoveToNext(password = encodedPassword.toString()))
+ try {
+     val encodedPassword = Base64.getEncoder().encodeToString(
+         state.value.password.toByteArray(Charsets.UTF_8)
+     )
+     postSideEffect(SetPasswordSideEffect.MoveToNext(password = encodedPassword))
+ } catch (e: Exception) {
+     // ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋กœ์ง ์ถ”๊ฐ€
+     setState { state.value.copy(buttonEnabled = true) }
+ }

Base64 ๋””์ฝ”๋”ฉ์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๊ตฌํ˜„๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค:


Let's check the implementation of Base64 decoding in the found file.

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Base64 ๋””์ฝ”๋”ฉ ๊ตฌํ˜„ ํ™•์ธ
rg -l "Base64.*decode" --type kotlin

Length of output: 113


Script:

#!/bin/bash
# Check Base64 decoding implementation in TermsViewModel.kt
rg "Base64.*decode" -A 5 -B 5 feature/signup/src/main/java/team/retum/signup/viewmodel/TermsViewModel.kt

Length of output: 521

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

๐Ÿ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between e735fcc and c3c336f.

๐Ÿ“’ Files selected for processing (2)
  • feature/signup/src/main/java/team/retum/signup/viewmodel/SetPasswordViewModel.kt (2 hunks)
  • feature/signup/src/main/java/team/retum/signup/viewmodel/TermsViewModel.kt (2 hunks)
๐Ÿšง Files skipped from review as they are similar to previous changes (1)
  • feature/signup/src/main/java/team/retum/signup/viewmodel/TermsViewModel.kt
๐Ÿ”‡ Additional comments (2)
feature/signup/src/main/java/team/retum/signup/viewmodel/SetPasswordViewModel.kt (2)

7-7: Base64 ์ธ์ฝ”๋”ฉ์„ ์œ„ํ•œ import ์ถ”๊ฐ€๊ฐ€ ์ ์ ˆํžˆ ์ด๋ฃจ์–ด์กŒ์Šต๋‹ˆ๋‹ค.


Line range hint 1-89: ๋ณด์•ˆ ๊ด€๋ จ ์ถ”๊ฐ€ ๊ณ ๋ ค์‚ฌํ•ญ

Base64 ์ธ์ฝ”๋”ฉ์€ ์•”ํ˜ธํ™”๊ฐ€ ์•„๋‹Œ ์ธ์ฝ”๋”ฉ ๋ฐฉ์‹์ด๋ฏ€๋กœ, ๋‹ค์Œ ์‚ฌํ•ญ๋“ค์„ ๊ณ ๋ คํ•ด์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค:

  1. ๋„คํŠธ์›Œํฌ ์ „์†ก ์‹œ ๋ฐ˜๋“œ์‹œ HTTPS๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ถ”๊ฐ€์ ์ธ ๋ณด์•ˆ ๊ณ„์ธต์„ ํ™•๋ณดํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  2. ์„œ๋ฒ„ ์ธก์—์„œ๋„ ์ ์ ˆํ•œ ๋น„๋ฐ€๋ฒˆํ˜ธ ํ•ด์‹ฑ์ด ์ด๋ฃจ์–ด์ง€๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

์„œ๋ฒ„ ์ธก ๊ตฌํ˜„์„ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค:

Comment on lines 58 to 59
val encodedPassword = Base64.getEncoder().encodeToString(state.value.password.toByteArray(Charsets.UTF_8))
postSideEffect(SetPasswordSideEffect.MoveToNext(password = encodedPassword.toString()))
Copy link
Contributor

Choose a reason for hiding this comment

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

โš ๏ธ Potential issue

Base64 ์ธ์ฝ”๋”ฉ ๊ตฌํ˜„์˜ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

  1. encodedPassword.toString()์€ ๋ถˆํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. encodeToString()์ด ์ด๋ฏธ ๋ฌธ์ž์—ด์„ ๋ฐ˜ํ™˜ํ•˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.
  2. Base64 ์ธ์ฝ”๋”ฉ ๊ณผ์ •์—์„œ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ์˜ˆ์™ธ ์ฒ˜๋ฆฌ๊ฐ€ ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆ๋“œ๋ฆฝ๋‹ˆ๋‹ค:

-        val encodedPassword = Base64.getEncoder().encodeToString(state.value.password.toByteArray(Charsets.UTF_8))
-        postSideEffect(SetPasswordSideEffect.MoveToNext(password = encodedPassword.toString()))
+        try {
+            val encodedPassword = Base64.getEncoder().encodeToString(
+                state.value.password.toByteArray(Charsets.UTF_8)
+            )
+            postSideEffect(SetPasswordSideEffect.MoveToNext(password = encodedPassword))
+        } catch (e: Exception) {
+            setState { state.value.copy(buttonEnabled = true) }
+            // TODO: ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋กœ์ง ์ถ”๊ฐ€ (์˜ˆ: ์‚ฌ์šฉ์ž์—๊ฒŒ ์•Œ๋ฆผ)
+        }

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

@parkuiery parkuiery merged commit 2526c70 into develop Nov 22, 2024
2 checks passed
@parkuiery parkuiery deleted the feature/444-ํšŒ์›๊ฐ€์ž…-๋น„๋นŒ๋ฒˆํ˜ธ-๋””์ฝ”๋”ฉ branch November 22, 2024 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
๋ฒ„๊ทธ ๋ฒ„๊ทธ๋ฅผ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค.
Projects
Development

Successfully merging this pull request may close these issues.

ํšŒ์›๊ฐ€์ž… ๋น„๋นŒ๋ฒˆํ˜ธ ๋””์ฝ”๋”ฉ
2 participants