A database or instance is given a public address that the internet can reach

tx0/ts:publicly-accessible-resourcerecommendedwarningsecurity/iacdepth fastsecurity

What it finds

A database with publiclyAccessible: true, or an instance with a public IP address, can be reached from anywhere the security groups allow. Keeping them in private subnets behind a load balancer or bastion removes that exposure.

Reported are publiclyAccessible: true and associatePublicIpAddress: true in the properties of constructs, in files that use the CDK.

From the rule's source, publicly_accessible_resource.rs.

Example from the rule's tests
import * as rds from "aws-cdk-lib/aws-rds";declare const stack: any;declare const engine: any;export const db = new rds.DatabaseInstance(stack, "Db", { engine, publiclyAccessible: true });tx0 reports: publiclyAccessible makes this resource reachable
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:publicly-accessible-resource" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/ts:publicly-accessible-resource] reason="..."

tx0 explain tx0/ts:publicly-accessible-resource shows the same in the terminal. Found a false positive? Report it.