Skip to content

[INS-403] Support Custom endpoint config in hashicorpvaultauth Detector#4825

Open
MuneebUllahKhan222 wants to merge 6 commits intotrufflesecurity:mainfrom
MuneebUllahKhan222:vaultauth-custom-ep
Open

[INS-403] Support Custom endpoint config in hashicorpvaultauth Detector#4825
MuneebUllahKhan222 wants to merge 6 commits intotrufflesecurity:mainfrom
MuneebUllahKhan222:vaultauth-custom-ep

Conversation

@MuneebUllahKhan222
Copy link
Copy Markdown
Contributor

@MuneebUllahKhan222 MuneebUllahKhan222 commented Mar 19, 2026

Description:

This PR enabled custom endpoint configuration for the existing hashicorpvaultauth detector.

It enables custom endpoint configuration by making the detector comply to detectors.EndpointCustomizer interface and updating to default client to detectors.DetectorHttpClientWithNoLocalAddresses to avoid potential security risks like ssrf attacks.

This PR also updates the existing test to make sure that the test work fine with the new changes and also introduces a new integration test to emulate custom endpoint configuration.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

Note

Medium Risk
Changes how the hashicorpvaultauth detector selects verification endpoints and introduces configurable endpoints, which can affect network verification behavior; SSRF risk is mitigated by switching to DetectorHttpClientWithNoLocalAddresses. Test updates reduce regression risk but endpoint selection paths need review.

Overview
Adds custom endpoint support to the hashicorpvaultauth detector by embedding EndpointSetter and implementing EndpointCustomizer, allowing verification against configured endpoints in addition to (or instead of) URLs found in data.

Switches the detector’s default HTTP client to detectors.DetectorHttpClientWithNoLocalAddresses and relaxes matching so results can be produced when role_id/secret_id are present even if no Vault URL is embedded, relying on configured/cloud/found endpoint selection.

Updates unit/integration tests to enable endpoint selection flags and adds an integration test covering SetConfiguredEndpoints; engine tests are adjusted to treat HashiCorpVaultAuth as a detector that may have no cloud endpoint by default.

Reviewed by Cursor Bugbot for commit 9def14a. Bugbot is set up for automated code reviews on this repo. Configure here.

@MuneebUllahKhan222 MuneebUllahKhan222 requested a review from a team March 19, 2026 11:53
@MuneebUllahKhan222 MuneebUllahKhan222 requested review from a team as code owners March 19, 2026 11:53
if endpoint != vaultUrl {
t.Fatalf("expected endpoint %s, got %s", vaultUrl, endpoint)
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This loop will always run only one time. Also, do you think this loop provides value? because the cmp.Diff at the end is sufficient as it does the same job.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Forgot to remove the manual loop check. cmp.Diff is good enough

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit fe49c7f. Configure here.

for roleId := range uniqueRoleIds {
for secretId := range uniqueSecretIds {
for vaultUrl := range uniqueVaultUrls {
for _, vaultUrl := range s.Endpoints(endpoints...) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing deduplication of endpoints causes duplicate results

Low Severity

The old code iterated directly over uniqueVaultUrls (a map that naturally deduplicates). The new code converts found URLs to a slice, passes them to s.Endpoints(endpoints...), which merges configured endpoints with found endpoints without deduplication. When a configured endpoint also appears in the scanned data, Endpoints() returns it twice, producing duplicate Result entries and redundant verification API calls. The Artifactory detector, which follows the same EndpointSetter pattern, avoids this by collecting Endpoints() output into a dedup map before iterating.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fe49c7f. Configure here.

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.

3 participants