Skip to content
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

Add custom detectors configuration parsing #927

Merged
merged 6 commits into from Nov 21, 2022

Conversation

mcastorina
Copy link
Collaborator

No description provided.

Also create protoyaml package to test YAML unmarshalling the
configuration.
@mcastorina mcastorina requested a review from a team as a code owner November 17, 2022 20:54
@mcastorina mcastorina marked this pull request as draft November 17, 2022 20:54
Copy link
Contributor

@samdatkins samdatkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

repeated string keywords = 1;
map<string, string> regex = 2;
repeated VerifierConfig verify = 3;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we probably want to combine CustomDetector and CustomRegex together here. Because in config, I think it makes sense for them to be an array of maps containing all of the custom detectors, and the custom detector itself would look like CustomRegex plus the name. We might not actually need type for these, and I think we can forego having connection and instead combine these two messages into one. e.g.

message CustomDetector {
  string type = 1;
  string name = 2;
  repeated string keywords = 3;
  map<string, string> regex = 4;
  repeated VerifierConfig verify = 6;
}

@mcastorina mcastorina marked this pull request as ready for review November 18, 2022 16:57
@mcastorina mcastorina merged commit 4409210 into main Nov 21, 2022
@mcastorina mcastorina deleted the thog-803-custom-detectors-parsing branch November 21, 2022 21:10
Comment on lines +12 to +26
const testCustomRegexYaml = `name: Internal bi tool
keywords:
- secret_v1_
- pat_v2_
regex:
id_pat_example: ([a-zA-Z0-9]{32})
secret_pat_example: ([a-zA-Z0-9]{32})
verify:
- endpoint: http://localhost:8000/{id_pat_example}
unsafe: true
headers:
- 'Authorization: Bearer {secret_pat_example.0}'
successRanges:
- 200-250
- '288'`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to revisit the design document, this is not what was proposed and reviewed previously.

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

Successfully merging this pull request may close these issues.

None yet

4 participants