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

fix(transfer): mismatched key shall result in decryption error #1828

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

maqi
Copy link
Member

@maqi maqi commented Jun 4, 2024

Description

  • add a check_sum pad to ensure mismatched key decryption shall trigger error, instead of a random hash
  • add test to check mismatched key shall result in discord_name decryption error

Related Issue

Fixes #<issue_number> (if applicable).

Type of Change

Please mark the types of changes made in this pull request.

  • Bug fix (non-breaking change which fixes an issue)

@maqi maqi changed the title chore: cypher decryption check WIP chore: cypher decryption check Jun 4, 2024
@maqi maqi added the DoNotMerge label Jun 4, 2024
@maqi maqi force-pushed the cypher_decrption_check branch 2 times, most recently from b28a4b3 to 9804dea Compare June 4, 2024 09:41
@maqi maqi changed the title WIP chore: cypher decryption check fix(transfer): mismatched key shall result in decryption error Jun 4, 2024
@maqi maqi removed the DoNotMerge label Jun 4, 2024
let mut checksum = [0; CHECK_SUM_SIZE];
checksum.copy_from_slice(&bytes[CONTENT_SIZE..LIMIT_SIZE]);
if checksum != CHECK_SUM {
return Err(TransferError::UserNameDecryptFailed);
Copy link
Member

Choose a reason for hiding this comment

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

Since there's no decryption here, we can straight away report that the key is invalid?

Suggested change
return Err(TransferError::UserNameDecryptFailed);
return Err(TransferError::InvalidDecryptionKey);

Copy link
Member

@grumbach grumbach left a comment

Choose a reason for hiding this comment

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

LGTM

@maqi maqi force-pushed the cypher_decrption_check branch from 9804dea to c17ea91 Compare June 4, 2024 10:07
@joshuef joshuef merged commit f357925 into maidsafe:main Jun 4, 2024
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants