Classes
Name | Description |
---|---|
AwsSolutionsChecks | Check Best practices based on AWS Solutions Security Matrix. |
HIPAASecurityChecks | Check for HIPAA Security compliance. |
NIST80053R4Checks | Check for NIST 800-53 rev 4 compliance. |
NIST80053R5Checks | Check for NIST 800-53 rev 5 compliance. |
NagPack | Base class for all rule packs. |
NagRules | Helper class with methods for rule creation. |
NagSuppressions | Helper class with methods to add cdk-nag suppressions to cdk resources. |
PCIDSS321Checks | Check for PCI DSS 3.2.1 compliance. Based on the PCI DSS 3.2.1 AWS operational best practices: https://docs.aws.amazon.com/config/latest/developerguide/operational-best-practices-for-pci-dss.html. |
Structs
Name | Description |
---|---|
NagPackProps | Interface for creating a Nag rule pack. |
NagPackSuppression | Interface for creating a rule suppression. |
RegexAppliesTo | A regular expression to apply to matching findings. |
Interfaces
Name | Description |
---|---|
IApplyRule | Interface for JSII interoperability for passing parameters and the Rule Callback to @applyRule method. |
Enums
Name | Description |
---|---|
NagMessageLevel | The level of the message that the rule applies. |
NagRuleCompliance | The compliance level of a resource in relation to a rule. |
Check Best practices based on AWS Solutions Security Matrix.
Implements: IAspect Extends: NagPack
new AwsSolutionsChecks(props?: NagPackProps)
- props (
NagPackProps
) No description- logIgnores (
boolean
) Whether or not to log triggered rules that have been suppressed as informational messages (default: false). Optional - reports (
boolean
) Whether or not to generate CSV compliance reports for applied Stacks in the App's output directory (default: true). Optional - verbose (
boolean
) Whether or not to enable extended explanatory descriptions on warning, error, and logged ignore messages (default: false). Optional
- logIgnores (
All aspects can visit an IConstruct.
visit(node: IConstruct): void
- node (
IConstruct
) No description
Check for HIPAA Security compliance.
Based on the HIPAA Security AWS operational best practices: https://docs.aws.amazon.com/config/latest/developerguide/operational-best-practices-for-hipaa_security.html
Implements: IAspect Extends: NagPack
new HIPAASecurityChecks(props?: NagPackProps)
- props (
NagPackProps
) No description- logIgnores (
boolean
) Whether or not to log triggered rules that have been suppressed as informational messages (default: false). Optional - reports (
boolean
) Whether or not to generate CSV compliance reports for applied Stacks in the App's output directory (default: true). Optional - verbose (
boolean
) Whether or not to enable extended explanatory descriptions on warning, error, and logged ignore messages (default: false). Optional
- logIgnores (
All aspects can visit an IConstruct.
visit(node: IConstruct): void
- node (
IConstruct
) No description
Check for NIST 800-53 rev 4 compliance.
Based on the NIST 800-53 rev 4 AWS operational best practices: https://docs.aws.amazon.com/config/latest/developerguide/operational-best-practices-for-nist-800-53_rev_4.html
Implements: IAspect Extends: NagPack
new NIST80053R4Checks(props?: NagPackProps)
- props (
NagPackProps
) No description- logIgnores (
boolean
) Whether or not to log triggered rules that have been suppressed as informational messages (default: false). Optional - reports (
boolean
) Whether or not to generate CSV compliance reports for applied Stacks in the App's output directory (default: true). Optional - verbose (
boolean
) Whether or not to enable extended explanatory descriptions on warning, error, and logged ignore messages (default: false). Optional
- logIgnores (
All aspects can visit an IConstruct.
visit(node: IConstruct): void
- node (
IConstruct
) No description
Check for NIST 800-53 rev 5 compliance.
Based on the NIST 800-53 rev 5 AWS operational best practices: https://docs.aws.amazon.com/config/latest/developerguide/operational-best-practices-for-nist-800-53_rev_5.html
Implements: IAspect Extends: NagPack
new NIST80053R5Checks(props?: NagPackProps)
- props (
NagPackProps
) No description- logIgnores (
boolean
) Whether or not to log triggered rules that have been suppressed as informational messages (default: false). Optional - reports (
boolean
) Whether or not to generate CSV compliance reports for applied Stacks in the App's output directory (default: true). Optional - verbose (
boolean
) Whether or not to enable extended explanatory descriptions on warning, error, and logged ignore messages (default: false). Optional
- logIgnores (
All aspects can visit an IConstruct.
visit(node: IConstruct): void
- node (
IConstruct
) No description
Base class for all rule packs.
Implements: IAspect Implemented by: AwsSolutionsChecks, HIPAASecurityChecks, NIST80053R4Checks, NIST80053R5Checks, PCIDSS321Checks
new NagPack(props?: NagPackProps)
- props (
NagPackProps
) No description- logIgnores (
boolean
) Whether or not to log triggered rules that have been suppressed as informational messages (default: false). Optional - reports (
boolean
) Whether or not to generate CSV compliance reports for applied Stacks in the App's output directory (default: true). Optional - verbose (
boolean
) Whether or not to enable extended explanatory descriptions on warning, error, and logged ignore messages (default: false). Optional
- logIgnores (
Name | Type | Description |
---|---|---|
logIgnores | boolean |
|
packName | string |
|
readPackName | string |
|
readReportStacks | Array |
|
reportStacks | Array |
|
reports | boolean |
|
verbose | boolean |
All aspects can visit an IConstruct.
visit(node: IConstruct): void
- node (
IConstruct
) No description
Create a rule to be used in the NagPack.
protected applyRule(params: IApplyRule): void
- params (
IApplyRule
) The.
Helper function to create a line for the compliance report.
protected createComplianceReportLine(params: IApplyRule, ruleId: string, compliance: NagRuleCompliance | string, explanation?: string): string
- params (
IApplyRule
) The. - ruleId (
string
) The id of the rule. - compliance (
NagRuleCompliance | string
) The compliance status of the rule. - explanation (
string
) The explanation for suppressed rules.
Returns:
string
The message to output to the console when a rule is triggered.
protected createMessage(ruleId: string, findingId: string, info: string, explanation: string): string
- ruleId (
string
) The id of the rule. - findingId (
string
) The id of the finding. - info (
string
) Why the rule was triggered. - explanation (
string
) Why the rule exists.
Returns:
string
Check whether a specific rule should be ignored.
protected ignoreRule(ignores: Array<NagPackSuppression>, ruleId: string, findingId: string): string
- ignores (
Array<NagPackSuppression>
) The ignores listed in cdk-nag metadata. - ruleId (
string
) The id of the rule to ignore. - findingId (
string
) The id of the finding that is being checked.
Returns:
string
Initialize the report for the rule pack's compliance report for the resource's Stack if it doesn't exist.
protected initializeStackReport(params: IApplyRule): void
- params (
IApplyRule
) No description
Write a line to the rule pack's compliance report for the resource's Stack.
protected writeToStackComplianceReport(params: IApplyRule, ruleId: string, compliance: NagRuleCompliance | string, explanation?: string): void
- params (
IApplyRule
) The. - ruleId (
string
) The id of the rule. - compliance (
NagRuleCompliance | string
) The compliance status of the rule. - explanation (
string
) The explanation for suppressed rules.
Helper class with methods for rule creation.
new NagRules()
Use in cases where a primitive value must be known to pass a rule.
https://developer.mozilla.org/en-US/docs/Glossary/Primitive
static resolveIfPrimitive(node: CfnResource, parameter: any): any
- node (
CfnResource
) The CfnResource to check. - parameter (
any
) The value to attempt to resolve.
Returns:
any
Use in cases where a token resolves to an intrinsic function and the referenced resource must be known to pass a rule.
static resolveResourceFromInstrinsic(node: CfnResource, parameter: any): any
- node (
CfnResource
) The CfnResource to check. - parameter (
any
) The value to attempt to resolve.
Returns:
any
Helper class with methods to add cdk-nag suppressions to cdk resources.
new NagSuppressions()
Add cdk-nag suppressions to a CfnResource and optionally its children.
static addResourceSuppressions(construct: IConstruct, suppressions: Array<NagPackSuppression>, applyToChildren?: boolean): void
- construct (
IConstruct
) The IConstruct to apply the suppression to. - suppressions (
Array<NagPackSuppression>
) A list of suppressions to apply to the resource. - applyToChildren (
boolean
) Apply the suppressions to children CfnResources (default:false).
Add cdk-nag suppressions to a CfnResource and optionally its children via its path.
static addResourceSuppressionsByPath(stack: Stack, path: string, suppressions: Array<NagPackSuppression>, applyToChildren?: boolean): void
- stack (
Stack
) The Stack the construct belongs to. - path (
string
) The path to the construct in the provided stack. - suppressions (
Array<NagPackSuppression>
) A list of suppressions to apply to the resource. - applyToChildren (
boolean
) Apply the suppressions to children CfnResources (default:false).
Apply cdk-nag suppressions to a Stack and optionally nested stacks.
static addStackSuppressions(stack: Stack, suppressions: Array<NagPackSuppression>, applyToNestedStacks?: boolean): void
- stack (
Stack
) The Stack to apply the suppression to. - suppressions (
Array<NagPackSuppression>
) A list of suppressions to apply to the stack. - applyToNestedStacks (
boolean
) Apply the suppressions to children stacks (default:false).
Check for PCI DSS 3.2.1 compliance. Based on the PCI DSS 3.2.1 AWS operational best practices: https://docs.aws.amazon.com/config/latest/developerguide/operational-best-practices-for-pci-dss.html.
Implements: IAspect Extends: NagPack
new PCIDSS321Checks(props?: NagPackProps)
- props (
NagPackProps
) No description- logIgnores (
boolean
) Whether or not to log triggered rules that have been suppressed as informational messages (default: false). Optional - reports (
boolean
) Whether or not to generate CSV compliance reports for applied Stacks in the App's output directory (default: true). Optional - verbose (
boolean
) Whether or not to enable extended explanatory descriptions on warning, error, and logged ignore messages (default: false). Optional
- logIgnores (
All aspects can visit an IConstruct.
visit(node: IConstruct): void
- node (
IConstruct
) No description
Interface for JSII interoperability for passing parameters and the Rule Callback to @applyRule method.
Name | Type | Description |
---|---|---|
explanation | string |
Why the rule exists. |
info | string |
Why the rule was triggered. |
level | NagMessageLevel |
The annotations message level to apply to the rule if triggered. |
node | CfnResource |
Ignores listed in cdk-nag metadata. |
ruleSuffixOverride? | string |
Override for the suffix of the Rule ID for this rule. Optional |
The callback to the rule.
rule(node: CfnResource): NagRuleCompliance | Array<string>
- node (
CfnResource
) The CfnResource to check.
Returns:
NagRuleCompliance | Array
Interface for creating a Nag rule pack.
Name | Type | Description |
---|---|---|
logIgnores? | boolean |
Whether or not to log triggered rules that have been suppressed as informational messages (default: false). Optional |
reports? | boolean |
Whether or not to generate CSV compliance reports for applied Stacks in the App's output directory (default: true). Optional |
verbose? | boolean |
Whether or not to enable extended explanatory descriptions on warning, error, and logged ignore messages (default: false). Optional |
Interface for creating a rule suppression.
Name | Type | Description |
---|---|---|
id | string |
The id of the rule to ignore. |
reason | string |
The reason to ignore the rule (minimum 10 characters). |
appliesTo? | Array<string | RegexAppliesTo> |
Rule specific granular suppressions. Optional |
A regular expression to apply to matching findings.
Name | Type | Description |
---|---|---|
regex | string |
An ECMA-262 regex string. |
The level of the message that the rule applies.
Name | Description |
---|---|
WARN | |
ERROR |
The compliance level of a resource in relation to a rule.
Name | Description |
---|---|
COMPLIANT | |
NON_COMPLIANT | |
NOT_APPLICABLE |