Skip to content

Conversation

@knqyf263
Copy link
Collaborator

Description

Add HTTP basic authentication functionality to the Git test server in gittest package. This allows testing authentication scenarios in Git repository scanning.

Key Changes

  • Added Options struct with Username and Password fields to configure authentication
  • Modified NewServer and NewTestServer to accept Options parameter directly
  • Implemented authentication using gitkit's AuthFunc
  • Added tests for both environment variable and URL-embedded authentication

Test Coverage

The implementation includes tests for:

  • Environment variable authentication (GITHUB_TOKEN, GITLAB_TOKEN)
  • URL-embedded credentials (username:password@host format)
  • Authentication failure scenarios
  • Local repository scanning after authenticated clone

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@knqyf263 knqyf263 self-assigned this Aug 29, 2025
@knqyf263 knqyf263 added the autoready Automatically mark PR as ready for review when all checks pass label Aug 29, 2025
- Add Options struct with Username and Password fields for authentication
- Implement authentication functions: NewServerWithOptions, NewServerWithRepositoryOptions, NewTestServerWithOptions
- Add CloneWithOptions helper function for authenticated cloning
- Use gitkit's built-in AuthFunc for HTTP basic authentication
- Add comprehensive tests for authentication scenarios:
  - Support for GITHUB_TOKEN and GITLAB_TOKEN environment variables
  - Support for URL-embedded credentials (username:password@host)
  - Test authentication success and failure cases
- Use t.Setenv for proper test cleanup instead of os.Setenv
@knqyf263 knqyf263 force-pushed the feature/add-git-server-auth branch from 875c1a0 to 5c61621 Compare August 29, 2025 10:51
@github-actions github-actions bot marked this pull request as ready for review August 29, 2025 11:52
@github-actions github-actions bot removed the autoready Automatically mark PR as ready for review when all checks pass label Aug 29, 2025
@knqyf263 knqyf263 mentioned this pull request Sep 1, 2025
@DmitriyLewen DmitriyLewen added this pull request to the merge queue Sep 1, 2025
Merged via the queue into aquasecurity:main with commit 6fa3849 Sep 1, 2025
13 checks passed
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