Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
base64ToUtf8(): reject invalid characters (#1277)
#1214 changed the implemention of `base64ToUtf8()` from `atob(...)` to `Buffer.from(...)`. This also introduced a change in behaviour, which did not trigger any test failures. This commit reverts to behaviour similar to the previous version while continuing to avoid the deprecated `atob()` function. RFC4648 states: > Implementations MUST reject the encoded data if it contains characters outside the base alphabet when interpreting base-encoded data, unless the specification referring to this document explicitly states otherwise. See: https://datatracker.ietf.org/doc/html/rfc4648#section-3.2 `base64ToUtf8()` diverges from `atob()` by rejecting `null` instead of treating it as the string `"null"`
- Loading branch information