feat(queries): enhance rule accuracy and reduce false positives
- OpenAPI: Improve global security field detection with operation-level security checks
- ServerlessFW/SAM: Add contextual intelligence for IAM role requirements
- S3 Bucket: Add intentional public bucket detection for Terraform/CloudFormation
- Variable Description: Focus on complex/sensitive variables only
- Snake Case: Exclude external modules and legitimate naming exceptions
- K8s Namespace: Distinguish user workloads from system components
- Documentation: Enhanced rule comments with security rationale and compliance alignment
Reason for Proposed Changes
- Reduce false positives in KICS security rules by adding contextual intelligence
- Improve rule accuracy to focus on genuine security vulnerabilities
- Enhance developer experience by reducing noise from legitimate use cases
- Align rules with modern cloud security best practices and industry standards
- Maintain security coverage while being more precise in detection logic
Proposed Changes
- OpenAPI Global Security Field: Enhanced to only flag when both global security is missing AND operations lack security
- ServerlessFW/SAM IAM Role: Added contextual analysis for functions requiring different permissions
- S3 Bucket Public Policy: Added detection for intentional public buckets (websites, CDNs) to reduce false positives
- Variable Description: Focused on complex/sensitive variables only, excluding simple self-explanatory ones
- Snake Case Naming: Added exceptions for external modules and legitimate naming patterns
- Kubernetes Namespace: Distinguished between user workloads and system components
- Test Coverage: Added comprehensive negative test cases and updated expected results
- Documentation: Enhanced rule comments with security rationale and compliance alignment
I submit this contribution under the Apache-2.0 license.
Hi @cx-artur-ribeiro when you get the chance to approve the WFs 🙏
⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.
Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.
Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard. Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.
🔎 Detected hardcoded secret in your pull request
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 21271469 | Triggered | Generic Password | e8bf52bf4d0991a9233c6125534a3990695e2799 | assets/queries/terraform/azure/unrestricted_sql_server_access/test/negative3.tf | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Hi @cx-artur-ribeiro, how are you? Can I have the WF approved? Is there a way to disable the GitGuardian check for the specific secret? it looks like a test secret that was implemented into one of the test files.
@cx-artur-ribeiro Any input here?
Hi @marksokolov-orca,
Regarding GitGuardian checks, don’t worry. If it’s not on .go files, you probably don’t need to take any action. We’re currently working on improving the action output by implementing file exclusions, including the test files you mentioned.
I’ve already reviewed your pull request and will reach out to the Application Security Team to confirm and validate some of the changes you proposed. I will then contact you to make required changes if necessary.
We’re balancing a few priorities at the moment, but I’m making sure this continues to move forward.