-
Notifications
You must be signed in to change notification settings - Fork 8
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
Harden KeyContent against different publicKey-file line-delimiters #1083
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1083 +/- ##
============================================
- Coverage 33.23% 33.20% -0.03%
Complexity 356 356
============================================
Files 1161 1161
Lines 25700 25699 -1
Branches 1589 1588 -1
============================================
- Hits 8541 8534 -7
- Misses 16654 16660 +6
Partials 505 505
Continue to review full report at Codecov.
|
195f441
to
f41b4dd
Compare
@eparovyshnaya can you please review this one? I already created a test case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank for your effort, @HannesWell
Needs a bit of redesign.
bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/base/io/KeyContent.java
Outdated
Show resolved
Hide resolved
....eclipse.passage.lic.net.tests/src/org/eclipse/passage/lic/net/tests/io/SafePayloadTest.java
Outdated
Show resolved
Hide resolved
....eclipse.passage.lic.net.tests/src/org/eclipse/passage/lic/net/tests/io/SafePayloadTest.java
Outdated
Show resolved
Hide resolved
....eclipse.passage.lic.net.tests/src/org/eclipse/passage/lic/net/tests/io/SafePayloadTest.java
Outdated
Show resolved
Hide resolved
.../src/org/eclipse/passage/lic/net/tests/io/TestKeyKeeperWithOppositeLineDelimiterFactory.java
Outdated
Show resolved
Hide resolved
.../src/org/eclipse/passage/lic/net/tests/io/TestKeyKeeperWithOppositeLineDelimiterFactory.java
Outdated
Show resolved
Hide resolved
.../src/org/eclipse/passage/lic/net/tests/io/TestKeyKeeperWithOppositeLineDelimiterFactory.java
Outdated
Show resolved
Hide resolved
...pse.passage.lic.net.tests/src/org/eclipse/passage/lic/net/tests/io/TestKeyKeeperFactory.java
Outdated
Show resolved
Hide resolved
....eclipse.passage.lic.net.tests/src/org/eclipse/passage/lic/net/tests/io/SafePayloadTest.java
Outdated
Show resolved
Hide resolved
....eclipse.passage.lic.net.tests/src/org/eclipse/passage/lic/net/tests/io/SafePayloadTest.java
Outdated
Show resolved
Hide resolved
...pse.passage.lic.net.tests/src/org/eclipse/passage/lic/net/tests/io/TestKeyKeeperFactory.java
Outdated
Show resolved
Hide resolved
5b4c4e6
to
69a92c7
Compare
I tried to address your remarks as good as possible. |
...ests/src/org/eclipse/passage/lic/net/tests/io/KeyKeeperWithOppositeLineDelimiterFactory.java
Outdated
Show resolved
Hide resolved
...pse.passage.lic.net.tests/src/org/eclipse/passage/lic/net/tests/io/TestKeyKeeperFactory.java
Outdated
Show resolved
Hide resolved
f56ba9b
to
120feef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HannesWell nice work!
one final touch, and it's ready for merge.
...ests/src/org/eclipse/passage/lic/net/tests/io/KeyKeeperWithOppositeLineDelimiterFactory.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/base/io/KeyContent.java
Show resolved
Hide resolved
...e.passage.lic.net.tests/src/org/eclipse/passage/lic/net/tests/io/SimpleKeyKeeperFactory.java
Outdated
Show resolved
Hide resolved
...ests/src/org/eclipse/passage/lic/net/tests/io/KeyKeeperWithOppositeLineDelimiterFactory.java
Outdated
Show resolved
Hide resolved
69c9fe0
to
4930ca2
Compare
...c.net.tests/src/org/eclipse/passage/lic/net/tests/io/KeyKeeperWithOppositeLineDelimiter.java
Outdated
Show resolved
Hide resolved
...c.net.tests/src/org/eclipse/passage/lic/net/tests/io/KeyKeeperWithOppositeLineDelimiter.java
Outdated
Show resolved
Hide resolved
....eclipse.passage.lic.net.tests/src/org/eclipse/passage/lic/net/tests/io/SafePayloadTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @HannesWell
Thank you, too. |
The class
KeyContent
reads the entire content of a publicKey-file and returns its raw content as byte-array.This is problematic if the publicKey-file on server- and client-site use different line endings.
This can happen for example if the file is under git version-control and git is configured to use platform-specific line-endings for text files.
This PR attempts to fix this issue by effectively ignoring line-feed and carriage-return characters when reading the file-content.
Using a
BufferedReader
makes the method even a bit more compact.The additional test-case outlines the issue and only passes with the change in this PR.