Skip to content

[INS-398] Added tests to ensure that custom endpoint configuration works in artifactory detectors#4832

Merged
MuneebUllahKhan222 merged 6 commits intotrufflesecurity:mainfrom
MuneebUllahKhan222:artifactory-custom-ep
Apr 14, 2026
Merged

[INS-398] Added tests to ensure that custom endpoint configuration works in artifactory detectors#4832
MuneebUllahKhan222 merged 6 commits intotrufflesecurity:mainfrom
MuneebUllahKhan222:artifactory-custom-ep

Conversation

@MuneebUllahKhan222
Copy link
Copy Markdown
Contributor

@MuneebUllahKhan222 MuneebUllahKhan222 commented Mar 24, 2026

Description

This PR adds test coverage for both Artifactory detectors by introducing:

  • 1 unit test
  • 1 integration test

for each detector.

The tests explicitly configure detector endpoints using s.SetConfiguredEndpoints to ensure that:

  • Detected secrets are validated against the intended configured endpoint

Purpose

  • Improves confidence in detector behavior
  • Ensures that the custom endpoint configuration works as expected in artifactory detectors.

Checklist:

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

Note

Low Risk
Low risk: changes are test-only and primarily add coverage around endpoint configuration and RawV2 construction for Artifactory detectors.

Overview
Adds new unit and integration tests for the artifactory and artifactoryreferencetoken detectors to validate custom endpoint configuration via SetConfiguredEndpoints.

The new tests assert that configured endpoints are included in Scanner.Endpoints() and that detection/verification builds RawV2 using the secret plus the configured endpoint (including URL trimming behavior for the reference-token detector).

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

@MuneebUllahKhan222 MuneebUllahKhan222 requested a review from a team March 24, 2026 09:53
@MuneebUllahKhan222 MuneebUllahKhan222 requested a review from a team as a code owner March 24, 2026 09:53
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 2 potential issues.

Fix All in Cursor

Copy link
Copy Markdown
Contributor

@camgunz camgunz left a comment

Choose a reason for hiding this comment

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

There's something very "vanilla JS is all you need" about only using Go's builtin testing stuff, but we use testify all over the place and it simplifies things a lot, like you don't need things like:

got, err := s.FromData(ctx, true, data)
if err != nil {
  t.Fatalf("unexpected error from FromData: %v", err)
}

you can just do:

got, err := s.FromData(ctx, true, data)
// I usually leave the additional message off, but you do you
require.NoError(t, err, "unexpected error from FromData")

@camgunz
Copy link
Copy Markdown
Contributor

camgunz commented Apr 10, 2026

Oh also I meant to say I love starting w/ tests here! 🏆

@MuneebUllahKhan222 MuneebUllahKhan222 merged commit 0e7f630 into trufflesecurity:main Apr 14, 2026
14 checks passed
@MuneebUllahKhan222 MuneebUllahKhan222 deleted the artifactory-custom-ep branch April 14, 2026 10:02
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.

2 participants