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: skip reserved keys from sync conflict #1065

Merged
merged 7 commits into from
Jun 15, 2023
Merged

fix: skip reserved keys from sync conflict #1065

merged 7 commits into from
Jun 15, 2023

Conversation

sitaram-kalluri
Copy link
Member

- What I did

  • Fix the exception "shared_key" fails to decrypt in setConflictInfo method.
  • Fix the exception "Key not found in Key store" when the uncommitted entry has a CommitOp.Delete

- How I did it

  • For 1: Modify the IF condition, startsWith(shared_key) to contains(shared_key)
  • For 2: When fetching the local value, catch KeyNotFoundException and return null.

- How to verify it

  • For 1, Updated the existing unit test
  • For 2, Added a new unit test

- Description for the changelog

  • fix: skip reserved keys from sync conflict

// and do not require actions. Hence skipping from checking conflict resolution.
if (key.startsWith('publickey.') ||
key.startsWith('shared_key.') ||
key.contains('shared_key') ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's be a bit more precise - we should match on the key looking like either @alice:shared_key@bob or shared_key.alice@bob

Copy link
Member Author

@sitaram-kalluri sitaram-kalluri Jun 14, 2023

Choose a reason for hiding this comment

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

Modified the conditions as key.startsWith(RegExp('shared_key.+@.+|@.+shared_key@.+'))

@sitaram-kalluri sitaram-kalluri requested a review from gkc June 15, 2023 05:24
// and do not require actions. Hence skipping from checking conflict resolution.
if (key.startsWith('publickey.') ||
key.startsWith('shared_key.') ||
key.startsWith(RegExp('shared_key.+@.+|@.+shared_key@.+')) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

shared_key.+@.+ will match shared_keyyyyyyy@alice
@.+shared_key@.+ will match @ssssssshared_key:phone.wavi@alice

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the Regular expression and added unit tests.

@sitaram-kalluri sitaram-kalluri requested a review from gkc June 15, 2023 11:31
Copy link
Contributor

@gkc gkc left a comment

Choose a reason for hiding this comment

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

@gkc gkc merged commit 6c56293 into trunk Jun 15, 2023
6 checks passed
@gkc gkc deleted the srk_sync_conflict_fix branch June 15, 2023 14:51
gkc added a commit that referenced this pull request Jun 19, 2023
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.

Invalid or corrupted pad block issue while sharing a file with a new contact
2 participants