kics icon indicating copy to clipboard operation
kics copied to clipboard

feat(queries): enhance rule accuracy and reduce false positives

Open marksokolov-orca opened this issue 2 months ago • 5 comments

  • 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.

marksokolov-orca avatar Sep 29 '25 14:09 marksokolov-orca

Hi @cx-artur-ribeiro when you get the chance to approve the WFs 🙏

marksokolov-orca avatar Oct 27 '25 13:10 marksokolov-orca

⚠️ 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
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. 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


🦉 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.

gitguardian[bot] avatar Nov 10 '25 09:11 gitguardian[bot]

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.

marksokolov-orca avatar Nov 10 '25 12:11 marksokolov-orca

@cx-artur-ribeiro Any input here?

marksokolov-orca avatar Nov 16 '25 07:11 marksokolov-orca

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.

cx-artur-ribeiro avatar Nov 18 '25 10:11 cx-artur-ribeiro