Return friendly error if input is Base64 encoded

Open
#630 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
42/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
typescript
Domain
backend

Research direction

Start in modules/serialize/src/deserialize_factory.ts, then compare the first-byte handling in deserialize_header_v1.ts and deserialize_header_v2.ts. Trace the current version-selection branch and verify that Base64-encoded input reaches a friendly error before deserialization version selection; confirm the relevant serialization tests pass.

Written by the indexing model from the issue text.

Description

bug
Problem:

We have some code that intends to return a friendly error if the first byte is base64 encoded:

However we can't ever get inside those statements because we first do a check at: https://github.com/aws/aws-encryption-sdk-javascript/blob/43813f463ef6c53bd4de1963e7843b56733d1bec/modules/serialize/src/deserialize_factory.ts#L74

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

Dominant language
TypeScript
Stars
260
Forks
68
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws/aws-encryption-sdk-javascript

All issues in aws/aws-encryption-sdk-javascript

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.