Skip to content

added changes for github and slack token #512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pebblo/app/pebblo-ui/src/constants/keywordMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const KEYWORD_MAPPING = {
"iban-code": "IBAN code",
"us-itin": "US ITIN",
"github-token": "Github Token",
"github-finergrained-token": "Github Finergrained Token",
"slack-token": "Slack Token",
"aws-access-key": "AWS Access Key",
"aws-secret-key": "AWS Secret Key",
Expand Down
7 changes: 5 additions & 2 deletions pebblo/entity_classifier/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

secret_entities_context_mapping = {
"github-token": ["github", "github_token", "git"],
"github-finergrained-token": ["github", "github_token", "git"],
"slack-token": ["slack", "slack token", "slack_token"],
"aws-access-key": ["aws_access_key", "aws_key", "access", "id", "api"],
"aws-secret-key": ["aws_secret_key", "secret"],
Expand Down Expand Up @@ -39,6 +40,7 @@ class SecretEntities(Enum):
AZURE_KEY_ID = "azure-key-id"
AZURE_CLIENT_SECRET = "azure-client-secret"
GOOGLE_API_KEY = "google-api-key"
GITHUB_FINEGRAINED_TOKEN = "github-finergrained-token"


class PIIGroups(Enum):
Expand All @@ -59,13 +61,14 @@ class PIIGroups(Enum):
Entities.US_BANK_NUMBER.value: (0.4, PIIGroups.Financial.value),
Entities.IBAN_CODE.value: (0.8, PIIGroups.Financial.value),
# Secret
SecretEntities.GITHUB_TOKEN.value: (0.8, PIIGroups.Secrets.value),
SecretEntities.GITHUB_TOKEN.value: (0.4, PIIGroups.Secrets.value),
SecretEntities.SLACK_TOKEN.value: (0.8, PIIGroups.Secrets.value),
SecretEntities.AWS_ACCESS_KEY.value: (0.45, PIIGroups.Secrets.value),
SecretEntities.AWS_SECRET_KEY.value: (0.8, PIIGroups.Secrets.value),
SecretEntities.AZURE_KEY_ID.value: (0.8, PIIGroups.Secrets.value),
SecretEntities.AZURE_CLIENT_SECRET.value: (0.8, PIIGroups.Secrets.value),
SecretEntities.GOOGLE_API_KEY.value: (0.8, PIIGroups.Secrets.value),
SecretEntities.GOOGLE_API_KEY.value: (0.4, PIIGroups.Secrets.value),
SecretEntities.GITHUB_FINEGRAINED_TOKEN.value: (0.4, PIIGroups.Secrets.value),
# Network
Entities.IP_ADDRESS.value: (0.4, PIIGroups.Network.value),
}
Expand Down
5 changes: 3 additions & 2 deletions pebblo/entity_classifier/utils/regex_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

regex_secrets_patterns = {
"github-token": r"""\b((?:ghp|gho|ghu|ghs|ghr)_[a-zA-Z0-9]{36,255})\b""",
"slack-token": r"""(xoxb|xoxp|xapp|xoxa|xoxr)\-[0-9]{10,13}\-[a-zA-Z0-9\-]*""",
"github-finergrained-token": r"""\b((?:github_pat)_[a-zA-Z0-9_]{36,255})\b""",
"slack-token": r"""(xoxb|xoxp|xapp|xoxa|xoxr|xoxo|xoxs|xoxe)\-[0-9]{10,13}\-[a-zA-Z0-9\-]*""",
# "Slack Token V2": r"""xox[baprs]-([0-9a-zA-Z]{10,48})?""",
"aws-access-key": r"""\b((?:AKIA|ABIA|ACCA|ASIA)[0-9A-Z]{16})\b""",
"aws-secret-key": r"""\b([A-Za-z0-9+/]{40})[ \r\n'"\x60]""",
"azure-key-id": r"""(?i)(%s).{0,20}([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})""",
"azure-client-secret": r"""\b(?i)(%s).{0,20}([a-z0-9_\.\-~]{34})\b""",
"google-api-key": r"""(?i)(?:youtube)(?:.|[\n\r]){0,40}\bAIza[0-9A-Za-z\-_]{35}\b""",
"google-api-key": r"""\bAIza[0-9A-Za-z\-_]{35}\b""",
}
1 change: 1 addition & 0 deletions pebblo/reports/enums/keyword_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"iban-code": "IBAN code",
"us-itin": "US ITIN",
"github-token": "Github Token",
"github-finergrained-token": "Github Finergrained Token",
"slack-token": "Slack Token",
"aws-access-key": "AWS Access Key",
"aws-secret-key": "AWS Secret Key",
Expand Down