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
Throw UnsupportedError
on unknown algorithm in keys, signatures and encrypted session keys
#1523
Conversation
…lformed or unsupported packets
} catch (err) { | ||
if (err instanceof UnsupportedError) throw err; | ||
// avoid throwing potentially sensitive errors | ||
throw new Error('Error reading MPIs'); | ||
} |
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.
Same here - can it throw anything else? And, is the UnsupportedError
sensitive, here?
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.
This is parsing secret key material, so I'd rather not risk it. Even an MPI-bad-length error can be sensitive.
The Unsupported error is only thrown on wrong algo, which is already public information, so it's not sensitive, at least for now.
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.
Even an MPI-bad-length error can be sensitive
But do we throw any such error? From looking at the code I think we just return a Uint8Array with a different length in that 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.
It seems the only thing that can throw is the Curve
constructor (which can throw "Not valid curve"), but actually that should probably be an UnsupportedError
as well
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.
If the declared length is too long, is it guaranteed that .subarray
doesn't throw? Is it not up to the platform?
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.
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.
We're temporarily leaving the if-else here; #1523 is a more permanent solution to avoid not hiding sensitive errors introduced by future changes.
bba4451
to
3fd57a8
Compare
…rror messages with "Unknown"
UnsupportedError
on unknown algorithm in keys and signaturesUnsupportedError
on unknown algorithm in keys, signatures and encrypted session keys
With this change, the relevant packets will be considered unsupported instead of malformed.
To merge after #1522 .