Skip to content

fix: escape + in Base64 string regex pattern#1116

Open
vishwaksen-1 wants to merge 2 commits intomandiant:masterfrom
vishwaksen-1:fix-base64-regex-escape
Open

fix: escape + in Base64 string regex pattern#1116
vishwaksen-1 wants to merge 2 commits intomandiant:masterfrom
vishwaksen-1:fix-base64-regex-escape

Conversation

@vishwaksen-1
Copy link

Description

Fixes the unescaped + character in the Base64 alphabet regex pattern.

Problem

The + character in line 20 was not escaped in the regex pattern /ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/. This caused it to be interpreted as a regex quantifier (meaning "one or more of the preceding character") instead of a literal + character that is part of the Base64 alphabet.

Solution

Escaped the + character as \+ to match it literally.

Changed:

- string: /ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

To:

- string: /ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\+/

Testing

  • Ran python scripts/lint.py on the modified file
  • Verified the pattern now correctly matches the Base64 alphabet

Closes #1101

@google-cla
Copy link

google-cla bot commented Feb 11, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@mike-hunhoff
Copy link
Collaborator

Thanks @vishwaksen-1 , unfortunately tests are failing:

INFO     lint: collecting potentially referenced samples            lint.py:1238
INFO     lint: rule "reference Base64 string" does not match for     lint.py:409
         sample BFB9B5391A13D0AFD787E87AB90F14F5                                

 reference Base64 string
  FAIL: doesn't match on referenced example: Fix the rule logic or provide a 
different example

rules with FAIL:
  - reference Base64 string

Please investigate and address accordingly.

@mike-hunhoff mike-hunhoff self-requested a review February 11, 2026 15:38
@vishwaksen-1
Copy link
Author

Yes I'll go through that.

@vishwaksen-1
Copy link
Author

It was a mistake on my end, I was accidentally running liter on previous version rather than the one I edited and hence missed it 😅.

I think it works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"reference base64 string" unescaped +

3 participants