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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #849. Catch decryption failure #850

Merged
merged 3 commits into from May 18, 2021

Conversation

cintolas
Copy link
Contributor

If decryption fails, catch the error and silently continue.
This prevents a misconfigured node from crashing nodes using Middlewares.Transport.Encryption

馃摑 Description

A misconfigured node should not crash other nodes.
I wrapped the decrypt code in a try/catch block. This will log the following error on the sender's side
[2020-12-28T22:09:47.008Z] WARN plaintext/TRANSPORTER: Invalid incoming GOSSIP_REQ packet

馃幆 Relevant issues

#849

馃拵 Type of change

  • [ x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

馃摐 Example code

馃殾 How Has This Been Tested?

Tested against the breaking code in case 849

馃弫 Checklist:

  • [x ] My code follows the style guidelines of this project
  • [x ] I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have commented my code, particularly in hard-to-understand areas

If decryption fails, catch the error and silently continue.
This prevents a misconfigured node from crashing nodes using Middlewares.Transport.Encryption
@coveralls
Copy link

coveralls commented Dec 28, 2020

Pull Request Test Coverage Report for Build 2590

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0007%) to 92.062%

Totals Coverage Status
Change from base Build 2586: 0.0007%
Covered Lines: 7397
Relevant Lines: 7747

馃挍 - Coveralls

Copy link
Member

@icebob icebob left a comment

Choose a reason for hiding this comment

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

Nice job, but please don't use silent catch, because it makes the debugging difficult. Please add a logger.error because it's not a normal case and the developer should know about it.

@icebob icebob merged commit aad66d1 into moleculerjs:master May 18, 2021
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.

None yet

3 participants