Skip to content

Add new security plugins, SaaS sync integration, and fix lint issues - #58

Merged
khulnasoft-bot merged 2 commits into
masterfrom
feature/security-plugins-saas-sync
Aug 10, 2026
Merged

Add new security plugins, SaaS sync integration, and fix lint issues#58
khulnasoft-bot merged 2 commits into
masterfrom
feature/security-plugins-saas-sync

Conversation

@khulnasoft-bot

@khulnasoft-bot khulnasoft-bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Adds multiple new security checks (AWS, Azure, GCP, GitHub), SaaS sync integration, and resolves lint errors across the codebase.

Summary by Sourcery

Introduce SaaS sync integration and new security checks across AWS, Azure, GCP, and GitHub, while tightening public access and secret handling policies and improving robustness of rate/quota handling and tooling.

New Features:

  • Add SaaS sync capability with configurable API key, account ID, and endpoint for hosted platform integration.
  • Introduce new security plugins for detecting Lambda and Cloud Functions environment secrets, GitHub secret scanning status, GitHub repo public access, VPC peering least-access routing, and subnet auto-assign public IP configuration.
  • Extend existing privilege-analysis plugins with realtime triggers and clarify guidance without requiring extra APIs.

Bug Fixes:

  • Correct security group protocol handling in the CIFS check and broaden coverage to both TCP and UDP ports.
  • Fix logic around allowed IPs for Azure MySQL/PostgreSQL firewall rules and refine public access evaluations for Key Vaults, SQL Server, AKS, Function Apps, Event Hubs, Event Grid, OpenAI, and Service Bus namespaces.
  • Resolve quota-related retry handling for Google API calls and update multiple service maps and call definitions for GCP and Azure to match current APIs and data structures.
  • Update EKS Kubernetes version checks to include upcoming supported versions and fix S3 encryption module import usage.

Enhancements:

  • Normalize exports formatting and ensure new plugins are correctly wired into the main export registry for AWS, Azure, GCP, and GitHub.
  • Improve Azure helper utilities with CIDR-range detection and remediation helpers, and tighten network exposure checks.
  • Add comprehensive tests around SaaS sync integration, new plugins, and adjusted public access/secret scanning logic to increase confidence.
  • Refine CLI banner generation and engine handling of plugin API lists and integration metadata.

Tests:

  • Add unit tests for SaaS sync HTTP integration behavior and error handling.
  • Add coverage for new AWS, GCP, Azure, and GitHub plugins, including environment secret detection, VPC peering routes, subnet public IP, secret scanning, and repo public access.
  • Extend existing specs for multiple Azure and AWS checks to validate updated public access and IP rule logic, including IPv6 cases.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @khulnasoft-bot, your pull request is larger than the review limit of 150000 diff characters

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 46c351fa-fabb-4b12-b1b8-f495ded9e8fb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gitguardian

gitguardian Bot commented Aug 10, 2026

Copy link
Copy Markdown

⚠️ 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.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
35942090 Triggered Generic High Entropy Secret a9e007f plugins/aws/lambda/lambdaEnvSecrets.spec.js 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.

@sourcery-ai

sourcery-ai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds new secret exposure and network access security checks across AWS Lambda, GCP Cloud Functions, GitHub repos, and AWS VPC peering/subnets; introduces SaaS sync support and improves various cloud API helpers and Azure/GCP public access logic while cleaning up lint/formatting across the codebase.

Sequence diagram for new SaaS sync integration flow

sequenceDiagram
    actor User
    participant CLI as CloudExploit_CLI
    participant Engine
    participant SaaSSync as initializeSaasSync
    participant SaaS as KhulnaSoft_SaaS_API

    User ->> CLI: run scan with --sync / KHULNASOFT_SAAS_SYNC
    CLI ->> SaaSSync: initializeSaasSync(cloudConfig, settings, config)
    SaaSSync ->> SaaSSync: resolve saasKey, saasAccountId, saasUrl
    SaaSSync ->> SaaSSync: auto-detect cloud_account_identifier
    SaaSSync ->> CLI: set settings.identifier & settings.integration
    CLI ->> Engine: engine(cloudConfig, settings)
    Engine ->> Engine: collect cloud metadata (api_calls)
    loop for each service metadata event
        Engine ->> CLI: emit localEvent
        CLI ->> SaaS: integration(localEvent)
        SaaS ->> SaaS: POST /sync with X-Khulnasoft-Saas-Key
        SaaS -->> CLI: 2xx/4xx response
    end
Loading

File-Level Changes

Change Details Files
Introduce new security plugins for secret exposure and network/access checks in AWS, GCP, and GitHub, and wire them into the exports registry.
  • Add aws Lambda environment secret scanner plugin and tests (lambdaEnvSecrets).
  • Add GCP Cloud Functions environment secret scanner plugin and tests (cfEnvSecrets).
  • Add AWS IAM CloudShellFullAccess policy restriction plugin and tests.
  • Add AWS EC2 VPC peering least‑access routes plugin and tests.
  • Add AWS EC2 subnet auto‑assign public IP plugin and tests.
  • Add GitHub repo secret scanning enabled plugin and tests.
  • Add GitHub repo public access plugin and tests.
  • Register all new plugins in exports.js under aws, google, and github sections.
exports.js
plugins/aws/lambda/lambdaEnvSecrets.js
plugins/aws/lambda/lambdaEnvSecrets.spec.js
plugins/google/cloudfunctions/cfEnvSecrets.js
plugins/google/cloudfunctions/cfEnvSecrets.spec.js
plugins/aws/iam/cloudShellFullAccess.js
plugins/aws/iam/cloudShellFullAccess.spec.js
plugins/aws/ec2/vpcPeeringLeastAccessRoutes.js
plugins/aws/ec2/vpcPeeringLeastAccessRoutes.spec.js
plugins/aws/ec2/subnetAutoAssignPublicIp.js
plugins/aws/ec2/subnetAutoAssignPublicIp.spec.js
plugins/github/repos/secretScanningEnabled.js
plugins/github/repos/secretScanningEnabled.spec.js
plugins/github/repos/repoPublicAccess.js
plugins/github/repos/repoPublicAccess.spec.js
Add SaaS sync integration pipeline, configuration, and tests to push scan metadata to a hosted service.
  • Extend CLI (index.js) with SaaS sync flags (--sync, --saas-key, --saas-account-id, --saas-url) and initializeSaasSync helper wiring identifier and integration callback into settings.
  • Implement HTTP(S) integration function that POSTs scan metadata to SaaS endpoint with KhulnaSoft headers and handles success/error responses.
  • Extend engine.js and shared helpers to pass identifier/integration/previousCollection into data collection and integration processing.
  • Add config_example.js saas section for enabling sync and configuring key/account/url.
  • Add tests/sync.spec.js to validate SaaS integration behavior against a mock HTTP server.
index.js
engine.js
config_example.js
helpers/shared.js
tests/sync.spec.js
Improve cloud helper logic for Google and Azure APIs, including functionsv2 discovery, quota/rate handling, and new Azure servicebus/servicebus rule-set calls.
  • Reformat helpers/google/api.js serviceMap and calls blocks to standard JS style and fix minor spacing/typo issues.
  • Change Google functionsv2 list endpoint from Cloud Functions v2 to Cloud Run v2 services and adjust dataFilterKey from functions to services; update IAM policy postcall URL accordingly.
  • Add isQuotaError and enhanced retry logic in helpers/google/index.js to distinguish quota vs rate limit errors and adjust backoff timing; refactor makeApiCall and execute/setData paths with style fixes.
  • Normalize Azure api.js serviceMap entries and add new serviceBus.getNamespaceNetworkRuleSet postcall and wire to serviceBus namespacePublicAccess plugin.
  • Fix/extend various Azure calls/postcalls/tertiarycalls (containerApps, availabilitySets, automationAccounts, mediaServices, diagnosticSettings) and ensure integrationReliesOn lists include proper services.
  • Add and export isOpenCidrRange helper in helpers/azure/functions.js for shared CIDR open‑range checks.
helpers/google/api.js
helpers/google/index.js
helpers/azure/api.js
helpers/azure/functions.js
Strengthen Azure public access checks for Service Bus namespaces, Event Grid domains, App Service, OpenAI accounts, Key Vaults, Event Hubs, and PostgreSQL/MySQL servers with IP rule and publicNetworkAccess logic fixes plus tests.
  • Enhance azure/servicebus/namespacePublicAccess plugin to also consume getNamespaceNetworkRuleSet, add setting check_selected_networks, and treat restricted IP/virtual network rules as non‑public while flagging open CIDRs; add new spec cases.
  • Update azure/eventGrid/domainPublicAccess to treat inboundIpRules with non‑open CIDRs as restricted and flag open ranges; extend tests.
  • Update azure/appservice/appServicePublicAccess to honor ipSecurityRestrictionsDefaultAction and ipSecurityRestrictions with open cidrs using shared isOpenCidrRange; extend tests.
  • Update azure/openai/accountPublicAccessDisabled to evaluate networkAcls.ipRules and defaultAction for restricted vs open scenarios; add tests.
  • Extend azure/keyvaults/keyVaultPublicAccess to use isOpenCidrRange and add IPv6 open range test case.
  • Update azure/eventhub/eventHubPublicAccess to consider open CIDRs when check_selected_networks is enabled and treat restricted rules as pass; add tests.
  • Fix azure/mysqlserver/mysqlFlexibleServerPublicAccess and postgresqlServerPublicAccess allowedIps logic (now fail when firewall end IP not in allowed list).
  • Fix azure/sqlserver/noPublicAccess and appservice/functionAppNetworkExposure publicNetworkAccess comparisons to be case‑insensitive lowercase checks.
plugins/azure/servicebus/namespacePublicAccess.js
plugins/azure/servicebus/namespacePublicAccess.spec.js
plugins/azure/eventGrid/domainPublicAccess.js
plugins/azure/eventGrid/domainPublicAccess.spec.js
plugins/azure/appservice/appServicePublicAccess.js
plugins/azure/appservice/appServicePublicAccess.spec.js
plugins/azure/openai/accountPublicAccessDisabled.js
plugins/azure/openai/accountPublicAccessDisabled.spec.js
plugins/azure/keyvaults/keyVaultPublicAccess.js
plugins/azure/keyvaults/keyVaultPublicAccess.spec.js
plugins/azure/eventhub/eventHubPublicAccess.js
plugins/azure/eventhub/eventHubPublicAccess.spec.js
plugins/azure/mysqlserver/mysqlFlexibleServerPublicAccess.js
plugins/azure/postgresqlserver/postgresqlServerPublicAccess.js
plugins/azure/postgresqlserver/postgresqlServerPublicAccess.spec.js
plugins/azure/sqlserver/noPublicAccess.js
plugins/azure/appservice/functionAppNetworkExposure.js
Refine existing AWS, GCP, Azure, and Alibaba security plugins and metadata (descriptions, realtime triggers, logic) plus fix lint/style issues across many files.
  • Update aws/ec2/openCIFS plugin to check both TCP and UDP port 445, adjust description/recommended_action, and extend tests with UDP/TCP scenarios.
  • Update multiple privilegeAnalysis plugins (aws/ec2, aws/eks, aws/lambda, azure/virtualmachines, azure/kubernetesservice, azure/appservice, google/compute, google/kubernetes, google/cloudfunctions, alibaba/securitycenter) to clarify that they are informational and remove/adjust apis lists where appropriate.
  • Update aws/eks/eksKubernetesVersion supported version map and tests to include new Kubernetes versions (1.33, 1.34).
  • Fix aws/s3/s3Encryption import to use named minimatch import from the minimatch module.
  • Improve alibaba/securitycenter/securityNotificationsEnabled text and switch run signature to consistent style.
  • Adjust azure/networksecuritygroups/findOpenPorts and remediation helpers for style, bug fixes in destinationPortRanges iteration, and ensure remediation_file handling and security rule preservation behave correctly.
  • Normalize various realtime_triggers arrays and small logic in plugins (e.g., Google privilege analysis plugins, GCP Cloud Functions privilege analysis apis, etc.).
plugins/aws/ec2/openCIFS.js
plugins/aws/ec2/openCIFS.spec.js
plugins/aws/eks/eksKubernetesVersion.js
plugins/aws/eks/eksKubernetesVersion.spec.js
plugins/aws/s3/s3Encryption.js
plugins/aws/ec2/ec2PrivilegeAnalysis.js
plugins/aws/eks/eksPrivilegeAnalysis.js
plugins/aws/lambda/lambdaPrivilegeAnalysis.js
plugins/azure/virtualmachines/vmPrivilegeAnalysis.js
plugins/azure/kubernetesservice/aksPrivilegeAnalysis.js
plugins/azure/appservice/functionPrivilegeAnalysis.js
plugins/google/compute/computePrivilegeAnalysis.js
plugins/google/kubernetes/kubernetesPrivilegeAnalysis.js
plugins/google/cloudfunctions/cloudFunctionsPrivilegeAnalysis.js
plugins/alibaba/securitycenter/securityNotificationsEnabled.js
plugins/azure/functions.js
General linting, style normalization, banner tool fix, and dependency lockfile addition.
  • Normalize spacing, colons, and object literal formatting across exports.js (AWS, Azure, GitHub, Oracle, Google, Alibaba sections).
  • Fix bannerGenerator.js to remove unused chalk, import boxen via default export, and reformat options.
  • Add yarn.lock to capture dependency versions.
  • Minor fixes in helpers/google/index.js (var/const spacing, option object formatting) and azure helper/tests for consistent code style.
exports.js
bannerGenerator.js
helpers/google/index.js
yarn.lock

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
5.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@khulnasoft-bot
khulnasoft-bot enabled auto-merge (squash) August 10, 2026 20:33
@khulnasoft-bot
khulnasoft-bot merged commit b5d6f53 into master Aug 10, 2026
4 of 9 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.

3 participants