-
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
fix: dont base64 encode rejection reasons #36
Conversation
Current coverage is 91.97% (diff: 100%)@@ master #36 diff @@
==========================================
Files 6 6
Lines 297 299 +2
Methods 38 38
Messages 0 0
Branches 68 69 +1
==========================================
+ Hits 273 275 +2
Misses 24 24
Partials 0 0
|
@@ -536,7 +536,9 @@ class FiveBellsLedger extends EventEmitter2 { | |||
relatedResources.cancellation_condition_fulfillment) | |||
} else if (fiveBellsTransfer.state === 'rejected') { | |||
const rejectedCredit = find(fiveBellsTransfer.credits, 'rejected') | |||
const rejectionMessage = rejectedCredit ? rejectedCredit.rejection_message : 'transfer timed out.' | |||
const rejectionMessage = rejectedCredit | |||
? new Buffer(rejectedCredit.rejection_message, 'base64').toString() |
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.
You should use Buffer.from (see https://nodejs.org/api/buffer.html#buffer_buffer_from_buffer_alloc_and_buffer_allocunsafe)
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.
That causes the FTs to fail when run against older versions of node.
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.
Hmm. I think not using it though would expose the DoS vulnerability that caused that switch in the first place. What if I set the rejection_message
to 10000000000000
?
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.
Ok, so we need to run the circleci tests with node 6, and then use Buffer.from
.
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.
New issue: interledgerjs/five-bells-integration-test#39
LGTM |
No description provided.