Skip to content

Conversation

kashifkhan0771
Copy link
Contributor

@kashifkhan0771 kashifkhan0771 commented Aug 11, 2025

Description:

This PR improves and fixes the Couchbase detector.
Improvements:

  • Refactored overall code structure for better readability.
  • Enhanced regex patterns for matching Couchbase usernames and passwords.
  • Separated the verification logic into its own function.
  • Updated test cases for better coverage.

Fixes:

  • The previous meetsCouchbasePasswordRequirements function had a bug: it returned the password as soon as all character requirements were met, without validating the entire string. For example, given the password AB-1aiop, it would incorrectly return AB-1a. The logic has now been corrected to validate the full string and updated to return only a boolean.
  • The Raw field previously combined all three matches (connection string, username, and password), which could cause issues for the engine when trying to determine the line number. To address this, the connection string has been set as the primary secret to improve line number detection by the engine.

Checklist:

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

@kashifkhan0771 kashifkhan0771 requested a review from a team as a code owner August 11, 2025 10:37
@kashifkhan0771 kashifkhan0771 merged commit 626887c into trufflesecurity:main Aug 12, 2025
13 checks passed
@kashifkhan0771 kashifkhan0771 deleted the update/oss-56-couchbase branch August 12, 2025 06:51
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