Skip to content

[K9VULN-18095] feat(aws): add agentless-scanning-policy module for SaaS mode - #294

Merged
k3nz0 merged 6 commits into
mainfrom
moez.ezzeddine/agentless-saas-scanning-module
Oct 1, 2026
Merged

k3nz0 merged 6 commits into
mainfrom
moez.ezzeddine/agentless-saas-scanning-module

Conversation

@k3nz0

@k3nz0 k3nz0 commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Adds support for Agentless Scanning in SaaS mode: only IAM permissions, no scanner infra. A single managed policy with all the scanning permissions is attached to the Datadog integration role, mirroring datadog_agentless_saas.yaml in cloudformation-template.

Changes

  • modules/agentless-scanning-policy (new): policy documents only (no resources).
    • orchestrator_json, worker_json, dspm_json: the existing self-hosted documents, unchanged.
    • json: all of them merged into one document for SaaS mode (statements shared by the orchestrator and worker are merged by Sid).
  • scanning-delegate-role: same policies, attachments and outputs as before; their content now comes from the module outputs.
  • examples/saas (new): aws_iam_policy from module.agentless_scanning_policy.json, attached to the integration role, plus datadog_agentless_scanning_aws_scan_options. Pinned to 0.13.0.
  • S3, ECR and KMS ARNs now use the current partition instead of a hardcoded arn:aws.

Self-hosted upgrade (0.12.4 → this branch)

Offline terraform plan -refresh=false against a state built from 0.12.4, for all four combinations of sensitive_data_scanning_enabled / sensitive_data_scanning_rds_enabled: identical to the plan of unchanged 0.12.4 against the same state, with byte-identical policy JSON. No breaking change, no moved blocks.

In GovCloud/China the S3/ECR/KMS statements change because of the partition fix; they never matched anything there before.

SaaS policy

Same permissions as the three self-hosted documents combined: 22 statements, no duplicate Sids, ~4.5k of the 6,144-character limit.

Things to know

  • scanning-delegate-role now loads ../agentless-scanning-policy. That works with the usual git::…//modules/… source, but breaks if someone copied only the module folder.
  • datadog_agentless_scanning_aws_scan_options has no field for SaaS mode or the policy ARN yet (CloudFormation sends SaaSScanningPolicyArn to the API).
  • The CloudFormation SaaS template is still missing ec2:DescribeImages, which Terraform grants. To be aligned separately.

🤖 Generated with Claude Code

… policies

Merge the orchestrator, worker and DSPM policies into a single managed
policy (new agentless-scanning-policy module), attached either to the
delegate role (self-hosted) or to the Datadog integration role (SaaS).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@k3nz0
k3nz0 requested a review from a team as a code owner September 30, 2026 08:55
@datadog-datadog-us1-prod

This comment has been minimized.

@k3nz0 k3nz0 changed the title feat(aws): add agentless-scanning-saas module and merge delegate role policies [K9VULN-18095] feat(aws): add agentless-scanning-saas module and merge delegate role policies Sep 30, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Comment thread modules/agentless-scanning-saas/main.tf Resolved
Comment thread modules/agentless-scanning-saas/main.tf Resolved
k3nz0 and others added 3 commits September 30, 2026 14:41
…anning-policy directly

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…module

The delegate role module and SaaS users now own the aws_iam_policy and its
attachment, using the module json output.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…for SaaS

agentless-scanning-policy outputs the orchestrator, worker and DSPM documents
used unchanged by scanning-delegate-role, plus a merged json document for SaaS
mode. Self-hosted deployments see no change on upgrade.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@k3nz0 k3nz0 changed the title [K9VULN-18095] feat(aws): add agentless-scanning-saas module and merge delegate role policies [K9VULN-18095] feat(aws): add agentless-scanning-policy module for SaaS mode Oct 1, 2026
Comment thread examples/saas/main.tf
vuln_containers_os = true
lambda = true
sensitive_data = true
compliance_host = true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

compliance_host is optional and defaults to false, do we want it set to true?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I think it's fine to set it to true in this example.
Up to users to disable it if they don't need it.

Comment thread examples/saas/main.tf
}

provider "aws" {
region = "us-east-1"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shouldn't the region be a part of the variables?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Could indeed be passed as a param.

As it's another example, I just wanted it to be consistent with the other examples (Like this one).

}

statement {
sid = "DatadogAgentlessScannerDescribeImages"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

in a previous version this permission has been dropped and I wonder if we really need it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch.

This permission is used only for the offline mode of the scanner.
So not really needed in the nominal case. You'd only need it if you run the scanner in offline mode.

But I think it's fine keeping it for now.

@sarrazaghbib-dev sarrazaghbib-dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This approach looks good to me! Thank you!

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@k3nz0
k3nz0 merged commit 84ac198 into main Oct 1, 2026
3 of 4 checks passed
@k3nz0
k3nz0 deleted the moez.ezzeddine/agentless-saas-scanning-module branch October 1, 2026 14:21
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