-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Problem:
We have some code that intends to return a friendly error if the first byte is base64 encoded:
aws-encryption-sdk-javascript/modules/serialize/src/deserialize_header_v1.ts
Lines 88 to 93 in 43813f4
/* Precondition: version and type must be the required values. */ needs( version === MessageFormat.V1 && type === 128, version === 65 && type === 89 ? 'Malformed Header: This blob may be base64 encoded.' : 'Malformed Header.' aws-encryption-sdk-javascript/modules/serialize/src/deserialize_header_v2.ts
Lines 92 to 96 in 43813f4
needs( version === MessageFormat.V2, version === 65 ? 'Malformed Header: This blob may be base64 encoded.' : 'Malformed Header.'
However we can't ever get inside those statements because we first do a check at:
needs(deserializer, 'Not a supported message format version.') |
Solution:
Move the logic checking the expected first byte in Base64 before the branch that determines which version we're deserializing.
Out of scope:
n/a
kimd14 and gauthaman92
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working