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

annotate test files for secrets #676

Merged
merged 5 commits into from
Apr 7, 2025
Merged

annotate test files for secrets #676

merged 5 commits into from
Apr 7, 2025

Conversation

juli1
Copy link
Collaborator

@juli1 juli1 commented Apr 2, 2025

What problem are you trying to solve?

We want to detect when a secret is detected in a test file.

What is your solution?

Run the same file classification for secrets than static analysis. When a result is found, we attempt to detect if this is a test file or not. If yes, we add the test classification that is later added to the SARIF file.

Testing

Added integration/end to end tests in misc/integration-test-secrets.sh

@juli1 juli1 requested a review from a team as a code owner April 2, 2025 22:24
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Apr 2, 2025

Datadog Summary

✅ Code Quality    ✅ Code Security    ✅ Dependencies

@juli1 juli1 changed the title Julien/secrets test file annotate test files for secrets Apr 2, 2025
@juli1 juli1 requested a review from Copilot April 2, 2025 22:52
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR aims to improve secret detection in test files by refining file classification logic.

  • Introduces a new function get_language_for_file that determines the language based on file extension, exact filename, or prefix.
  • Adds integration tests to verify this classification logic.
  • Updates a comment for a minor spelling correction.
Files not reviewed (1)
  • misc/integration-test-secrets.sh: Language not supported
Comments suppressed due to low confidence (2)

crates/cli/src/file_utils.rs:85

  • [nitpick] Consider renaming 'extensions_string' to 'extension_strings' to more clearly indicate that it represents a collection of extension strings.
let extensions_string = extensions

crates/cli/src/file_utils.rs:109

  • [nitpick] Consider renaming 'prefix_string' to 'prefix_strings' to reflect that it contains multiple items.
let prefix_string = prefixes

Verified

This commit was signed with the committer’s verified signature.
juli1 Julien Delange
@juli1 juli1 requested a review from amaanq April 3, 2025 15:18
juli1 added 2 commits April 4, 2025 22:31

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was signed with the committer’s verified signature.
juli1 Julien Delange
@jasonforal jasonforal self-requested a review April 7, 2025 17:53
juli1 added 2 commits April 7, 2025 14:16

Verified

This commit was signed with the committer’s verified signature.
juli1 Julien Delange

Verified

This commit was signed with the committer’s verified signature.
juli1 Julien Delange
@juli1 juli1 requested a review from jasonforal April 7, 2025 18:18
@juli1 juli1 merged commit 49b811e into main Apr 7, 2025
74 of 75 checks passed
@juli1 juli1 deleted the julien/secrets-test-file branch April 7, 2025 18:29
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.

None yet

3 participants