Improve PlanetScale token detection (#874)

This improves the PlanetScale token detection. It add some flexibility
in length. There is no guarantee that the length is always 43 characters
(in fact, it's very likely to change a bit soon).

Additionally, it adds support for detecting oauth tokens as well.
This commit is contained in:
Dirkjan Bussink authored and GitHub committed 2022-05-24 22:15:36 -05:00
1 parent d6c0de7c85
commit 865478bcdc
3 files changed
+41 -6

No files matched your search

+11 -2
View File
@@ -545,7 +545,7 @@ keywords = [
[[rules]]
description = "PlanetScale password"
id = "planetscale-password"
regex = '''(?i)\b(pscale_pw_(?i)[a-z0-9=\-_\.]{43})(?:['|\"|\n|\r|\s|\x60]|$)'''
regex = '''(?i)\b(pscale_pw_(?i)[a-z0-9=\-_\.]{32,64})(?:['|\"|\n|\r|\s|\x60]|$)'''
secretGroup = 1
keywords = [
"pscale_pw_",
@@ -554,12 +554,21 @@ keywords = [
[[rules]]
description = "PlanetScale API token"
id = "planetscale-api-token"
regex = '''(?i)\b(pscale_tkn_(?i)[a-z0-9=\-_\.]{43})(?:['|\"|\n|\r|\s|\x60]|$)'''
regex = '''(?i)\b(pscale_tkn_(?i)[a-z0-9=\-_\.]{32,64})(?:['|\"|\n|\r|\s|\x60]|$)'''
secretGroup = 1
keywords = [
"pscale_tkn_",
]
[[rules]]
description = "PlanetScale OAuth token"
id = "planetscale-oauth-token"
regex = '''(?i)\b(pscale_oauth_(?i)[a-z0-9=\-_\.]{32,64})(?:['|\"|\n|\r|\s|\x60]|$)'''
secretGroup = 1
keywords = [
"pscale_oauth_",
]
[[rules]]
description = "Postman API token"
id = "postman-api-token"