Skip to content

obfuscator breaks code string.split(" ") not working. #722

@tamis-laan

Description

@tamis-laan

I'm receiving a JWT token I need to verify, which I split to get the token and remove the word bearer:

    const bearerHeader = req.headers['authorization'];
    const bearer = bearerHeader.split(" ")

With obfuscation on I get:

[
  'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTgyNjU5NjksImlhdCI6MTU5ODI2NTM2OX0.gYp5wThUw8E7F-I0yhOvMuCwWkCNd8v1XomsWKnm2ss'
]

With obfuscation off I get:

[
  'Bearer',
  'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1OTgyNjU5NjksImlhdCI6MTU5ODI2NTM2OX0.gYp5wThUw8E7F-I0yhOvMuCwWkCNd8v1XomsWKnm2ss'
]

Looks like white spaces are replaced with some other character that breaks the split(" ") code. I also noticed a bunch of \x20 in my console output instead of spaces. What gives? How can I fix this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions