Skip to content

Security: SourceCode/aitools-cdk-factory

Security

docs/security.md

Security & Compliance

The Aitool CDK Factory is built with a "Security First" philosophy. It enforces NIST 800-53 compliance checks at the factory level, ensuring that generated infrastructure is secure by default.

NIST 800-53 Compliance

The following controls are enforced by the SecurityValidator and SafetyAspects (cdk-nag):

Control ID Description Implementation
SC-13 Cryptographic Protection All data at rest (S3, RDS, DynamoDB) must be encrypted.
AC-3 Access Enforcement Public access to S3 buckets is blocked by default.
SC-7 Boundary Protection Security Groups must restrict inbound traffic to known ports.
AU-3 Content of Audit Records Access logging is enabled for LB and S3.

Roles & Permissions

Least Privilege

The factory analyzes the ProjectConfig to generate IAM roles with minimum necessary permissions.

  • Task Execution Role: Grants permission to pull images (ECR) and write logs (CloudWatch).
  • Task Role: Grants application-specific permissions (e.g., s3:GetObject only if an S3 resource is defined).

IAM Validation

We use AWS Access Analyzer during validation to detect over-permissive policies (like Action: *) before any code is deployed.

Secret Management

Never commit secrets to git.

The factory uses a reference system for secrets:

  1. Define in IR:
    secrets: {
      DB_PASSWORD: "dev/myservice/db_primary_password" 
    }
  2. Resolve at Runtime: The ECS Task Definition maps the environment variable DB_PASSWORD to the value from SSM Parameter Store or Secrets Manager.

Validating Security

To run security checks without generating code:

pnpm exec factory generate --type docker ... --dry-run

(Note: Failed validation will exit with a non-zero code).

There aren’t any published security advisories