Enforce AWS CDK security and compliance controls with cdk-nag. Use when adding rule packs, triaging findings, writing justified suppressions, integrating checks in CI/CD, or preventing insecure infrastructure patterns in CDK stacks.
77
97%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
AwsSolutionsChecks to a CDK app.npx cdk synth.npm install --save-dev cdk-nagExpected result: cdk-nag dependency available for CDK app.
npx cdk synthExpected result: nag findings shown during synthesis.
npx cdk synth MyStackExpected result: targeted findings for the selected stack.
npm test && npx cdk synthExpected result: failing status when tests or nag checks fail.
pantheon-skill-auditor evaluate infrastructure/aws-cdk/cdk-nag --jsonExpected result: updated skill score and grade.
import { App, Aspects } from 'aws-cdk-lib';
import { AwsSolutionsChecks } from 'cdk-nag';
const app = new App();
// Apply the AWS Solutions rule pack to every stack in the app
Aspects.of(app).add(new AwsSolutionsChecks({ verbose: true }));Expected result: all stacks synthesized with the AwsSolutionsChecks pack applied; findings printed to stdout during cdk synth.
import { NagSuppressions } from 'cdk-nag';
// Suppress a single rule on a specific construct, not the whole stack
NagSuppressions.addResourceSuppressions(
myBucket,
[
{
id: 'AwsSolutions-S1',
reason:
'Server access logging disabled intentionally: bucket stores only ephemeral build artifacts ' +
'with no PII; access is restricted to the CI role via bucket policy. ' +
'Risk accepted and documented in ADR-042.',
},
],
);Expected result: only myBucket is exempted from AwsSolutions-S1; all other resources and rules remain enforced.
WHY: Unjustified suppressions hide unresolved risk.
BAD: reason: "false positive" with no evidence.
GOOD: reason: "resource isolated in private subnet; compensating controls documented".
Consequence: Audit posture weakens and real issues stay unresolved.
WHY: Broad suppressions mask unrelated violations.
BAD: Suppress an entire rule for every resource in a stack. GOOD: Scope suppression to exact resource and finding.
Consequence: New regressions pass undetected.
WHY: Late checks create expensive rework.
BAD: Add strict rule packs only before deployment. GOOD: Run target rule packs continuously in feature branches.
Consequence: Security defects are found too late.
WHY: Repeated failures indicate systemic misconfiguration.
BAD: Re-run pipeline until flake passes without remediation. GOOD: Fix root cause or add justified suppression once.
Consequence: Compliance debt accumulates quickly.
WHY: Fixing the resource removes the risk; a suppression only hides it.
BAD: Suppress AwsSolutions-S10 instead of adding enforceSSL: true.
GOOD: Change the construct so the finding no longer fires.
Consequence: Fixable gaps stay in production behind a reason string.
WHY: An undecided finding is neither fixed nor accepted, so nobody is accountable.
BAD: Move on to suppressions with three findings still unclassified. GOOD: Categorize each as fix / suppress / defer before advancing.
Consequence: Findings are lost between triage and merge.
WHY: A fix or suppression can change the findings that remain.
BAD: Merge straight after editing a suppression.
GOOD: Re-run npx cdk synth and the CI pipeline first.
Consequence: The merged change fails the pipeline or ships a new violation.
WHY: Stacks without the aspect are never checked.
BAD: Aspects.of(stack).add(new AwsSolutionsChecks()) on a single stack.
GOOD: Aspects.of(app).add(new AwsSolutionsChecks({ verbose: true })) once on the app.
Consequence: Unchecked stacks drift out of compliance silently.
WHY: cdk-nag inspects AWS CDK constructs and has nothing to analyse elsewhere.
BAD: Add cdk-nag guidance to a pure Terraform module. GOOD: Use a Terraform-appropriate checker instead.
Consequence: Effort is wasted and the repository gains no real guardrail.
pantheon-org/tekhne
268add6
Also appears in
last in sync Aug 28, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.