@aaa-sentinel/iac-cost 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/cli.js +213 -94
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -130,7 +130,8 @@ neither can change it. A check that **could not be decided** (see below) never b
|
|
|
130
130
|
With `--fail-on-budget` the CLI sends the estimated monthly change (`totalMonthlyDeltaUsd`, one
|
|
131
131
|
number) to AAA Sentinel, which compares it with your budgets: for each budget that applies, this
|
|
132
132
|
month's spend so far scaled to the whole month, plus the change. The budgets that apply are the
|
|
133
|
-
organization ones,
|
|
133
|
+
organization ones, those of the account in `--budget-account` (or `--drift-account`) and, when
|
|
134
|
+
that account belongs to one of your MSP clients, the budgets of that client.
|
|
134
135
|
|
|
135
136
|
**Limitation of this version: budgets scoped to one billing service are not checked.** A
|
|
136
137
|
Terraform plan names resource types, not the billing services they are charged under, so the CLI
|
package/dist/cli.js
CHANGED
|
@@ -31,12 +31,13 @@ Options:
|
|
|
31
31
|
--drift-account <accountId> Compare with the last scan of this AAA Sentinel
|
|
32
32
|
account (needs IAC_SECURITY_CLIENT_ID/SECRET)
|
|
33
33
|
--fail-on-budget[=strict] Exit 1 when the change takes an AAA Sentinel budget over
|
|
34
|
-
(organization budgets, and the account ones
|
|
35
|
-
--budget-account). With =strict a budget without a
|
|
34
|
+
(organization budgets, and the account and client ones
|
|
35
|
+
with --budget-account). With =strict a budget without a
|
|
36
36
|
forecast, or no budget at all, also fails. Needs the
|
|
37
37
|
budgets:read scope on IAC_COST_CLIENT_ID. Service
|
|
38
38
|
budgets are not checked in this version
|
|
39
|
-
--budget-account <accountId> Account whose budgets also apply
|
|
39
|
+
--budget-account <accountId> Account whose budgets, and its client's, also apply
|
|
40
|
+
(default: --drift-account)
|
|
40
41
|
-h, --help Show this help`;
|
|
41
42
|
function parseCliArgs(argv, env) {
|
|
42
43
|
const warnings = [];
|
|
@@ -13040,6 +13041,7 @@ var signed = (n, currency) => `${n < 0 ? "-" : "+"}${money2(Math.abs(n), currenc
|
|
|
13040
13041
|
function scopeText(scope) {
|
|
13041
13042
|
if (scope.kind === "org") return "organization";
|
|
13042
13043
|
if (scope.kind === "account") return `account ${scope.accountId}`;
|
|
13044
|
+
if (scope.kind === "client") return `client ${scope.clientId}`;
|
|
13043
13045
|
return scope.accountId ? `${scope.service} in ${scope.accountId}` : scope.service;
|
|
13044
13046
|
}
|
|
13045
13047
|
var STATUS_TEXT = {
|
|
@@ -13052,7 +13054,7 @@ function renderBudgetMarkdown(response, mode) {
|
|
|
13052
13054
|
const lines2 = ["### \u{1F3AF} Budgets", ""];
|
|
13053
13055
|
if (response.results.length === 0) {
|
|
13054
13056
|
lines2.push(
|
|
13055
|
-
mode === "strict" ? "No budget applies to this change (organization budgets, or account budgets with `--budget-account`). Strict mode fails the check." : "No budget applies to this change (organization budgets, or account budgets with `--budget-account`)."
|
|
13057
|
+
mode === "strict" ? "No budget applies to this change (organization budgets, or account and client budgets with `--budget-account`). Strict mode fails the check." : "No budget applies to this change (organization budgets, or account and client budgets with `--budget-account`)."
|
|
13056
13058
|
);
|
|
13057
13059
|
return lines2.join("\n");
|
|
13058
13060
|
}
|
|
@@ -13420,6 +13422,153 @@ var AWS_SECURITY_COMBOS = [
|
|
|
13420
13422
|
}
|
|
13421
13423
|
];
|
|
13422
13424
|
|
|
13425
|
+
// ../../services/security/src/collectors/aws/check-ids.ts
|
|
13426
|
+
var CLOUDTRAIL_CHECKS = {
|
|
13427
|
+
describeTrails: "aws:cloudtrail:DescribeTrails",
|
|
13428
|
+
trailStatus: "aws:cloudtrail:GetTrailStatus",
|
|
13429
|
+
eventSelectors: "aws:cloudtrail:GetEventSelectors"
|
|
13430
|
+
};
|
|
13431
|
+
var EC2_CHECKS = {
|
|
13432
|
+
securityGroups: "aws:ec2:DescribeSecurityGroups",
|
|
13433
|
+
networkAcls: "aws:ec2:DescribeNetworkAcls",
|
|
13434
|
+
snapshots: "aws:ec2:DescribeSnapshots",
|
|
13435
|
+
publicSnapshots: "aws:ec2:DescribeSnapshots#public",
|
|
13436
|
+
vpcs: "aws:ec2:DescribeVpcs",
|
|
13437
|
+
subnets: "aws:ec2:DescribeSubnets",
|
|
13438
|
+
flowLogs: "aws:ec2:DescribeFlowLogs",
|
|
13439
|
+
prefixListEntries: "aws:ec2:GetManagedPrefixListEntries",
|
|
13440
|
+
flowLogInterfaces: "aws:ec2:DescribeNetworkInterfaces#flowLogs"
|
|
13441
|
+
};
|
|
13442
|
+
var ALL_PROTOCOLS = "-1";
|
|
13443
|
+
var ELB_CHECKS = {
|
|
13444
|
+
loadBalancers: "aws:elasticloadbalancing:DescribeLoadBalancers",
|
|
13445
|
+
listeners: "aws:elasticloadbalancing:DescribeListeners",
|
|
13446
|
+
targetGroups: "aws:elasticloadbalancing:DescribeTargetGroups",
|
|
13447
|
+
targetGroupAttributes: "aws:elasticloadbalancing:DescribeTargetGroupAttributes",
|
|
13448
|
+
targetHealth: "aws:elasticloadbalancing:DescribeTargetHealth"
|
|
13449
|
+
};
|
|
13450
|
+
var IAM_CHECKS = {
|
|
13451
|
+
accountSummary: "aws:iam:GetAccountSummary",
|
|
13452
|
+
passwordPolicy: "aws:iam:GetAccountPasswordPolicy",
|
|
13453
|
+
listUsers: "aws:iam:ListUsers",
|
|
13454
|
+
loginProfile: "aws:iam:GetLoginProfile",
|
|
13455
|
+
mfaDevices: "aws:iam:ListMFADevices",
|
|
13456
|
+
accessKeys: "aws:iam:ListAccessKeys",
|
|
13457
|
+
accessKeyLastUsed: "aws:iam:GetAccessKeyLastUsed",
|
|
13458
|
+
attachedPolicies: "aws:iam:ListAttachedUserPolicies"
|
|
13459
|
+
};
|
|
13460
|
+
var KMS_CHECKS = {
|
|
13461
|
+
listKeys: "aws:kms:ListKeys",
|
|
13462
|
+
listAliases: "aws:kms:ListAliases",
|
|
13463
|
+
describeKey: "aws:kms:DescribeKey",
|
|
13464
|
+
rotation: "aws:kms:GetKeyRotationStatus"
|
|
13465
|
+
};
|
|
13466
|
+
var LAMBDA_CHECKS = {
|
|
13467
|
+
functions: "aws:lambda:ListFunctions",
|
|
13468
|
+
functionUrl: "aws:lambda:GetFunctionUrlConfig",
|
|
13469
|
+
policy: "aws:lambda:GetPolicy"
|
|
13470
|
+
};
|
|
13471
|
+
var LIGHTSAIL_CHECKS = {
|
|
13472
|
+
regions: "aws:lightsail:GetRegions",
|
|
13473
|
+
instances: "aws:lightsail:GetInstances"
|
|
13474
|
+
};
|
|
13475
|
+
var MONITORING_CHECKS = {
|
|
13476
|
+
metricFilters: "aws:logs:DescribeMetricFilters",
|
|
13477
|
+
alarms: "aws:cloudwatch:DescribeAlarms",
|
|
13478
|
+
topicSubscriptions: "aws:sns:ListSubscriptionsByTopic"
|
|
13479
|
+
};
|
|
13480
|
+
var RDS_CHECKS = {
|
|
13481
|
+
instances: "aws:rds:DescribeDBInstances",
|
|
13482
|
+
clusters: "aws:rds:DescribeDBClusters",
|
|
13483
|
+
snapshots: "aws:rds:DescribeDBSnapshots",
|
|
13484
|
+
snapshotAttributes: "aws:rds:DescribeDBSnapshotAttributes",
|
|
13485
|
+
clusterSnapshots: "aws:rds:DescribeDBClusterSnapshots",
|
|
13486
|
+
clusterSnapshotAttributes: "aws:rds:DescribeDBClusterSnapshotAttributes"
|
|
13487
|
+
};
|
|
13488
|
+
var REGION_CHECKS = {
|
|
13489
|
+
listRegions: "aws:ec2:DescribeRegions"
|
|
13490
|
+
};
|
|
13491
|
+
var S3_CHECKS = {
|
|
13492
|
+
listBuckets: "aws:s3:ListBuckets",
|
|
13493
|
+
accountPublicAccessBlock: "aws:s3control:GetPublicAccessBlock",
|
|
13494
|
+
publicAccessBlock: "aws:s3:GetPublicAccessBlock",
|
|
13495
|
+
policyStatus: "aws:s3:GetBucketPolicyStatus",
|
|
13496
|
+
acl: "aws:s3:GetBucketAcl",
|
|
13497
|
+
encryption: "aws:s3:GetBucketEncryption"
|
|
13498
|
+
};
|
|
13499
|
+
var TRAIL_BUCKET_CHECKS = {
|
|
13500
|
+
lifecycle: "aws:s3:GetBucketLifecycleConfiguration",
|
|
13501
|
+
versioning: "aws:s3:GetBucketVersioning",
|
|
13502
|
+
objectLock: "aws:s3:GetObjectLockConfiguration"
|
|
13503
|
+
};
|
|
13504
|
+
var IAM_ACCESS_CHECKS = {
|
|
13505
|
+
authorizationDetails: "aws:iam:GetAccountAuthorizationDetails",
|
|
13506
|
+
generateLastAccessed: "aws:iam:GenerateServiceLastAccessedDetails",
|
|
13507
|
+
lastAccessed: "aws:iam:GetServiceLastAccessedDetails",
|
|
13508
|
+
analyzers: "aws:access-analyzer:ListAnalyzers",
|
|
13509
|
+
analyzerFindings: "aws:access-analyzer:ListFindings",
|
|
13510
|
+
analyzerFinding: "aws:access-analyzer:GetFinding",
|
|
13511
|
+
// Solo para reconocer los roles de la cuenta de gestión; ninguna regla depende de ella.
|
|
13512
|
+
organization: "aws:organizations:DescribeOrganization"
|
|
13513
|
+
};
|
|
13514
|
+
var CIEM_WINDOW_DAYS = 90;
|
|
13515
|
+
|
|
13516
|
+
// ../../services/security/src/rules/aws/backup.ts
|
|
13517
|
+
function rdsSinCopiasEvaluate(observation) {
|
|
13518
|
+
if (typeof observation.attributes.clusterId === "string") return { status: "ok" };
|
|
13519
|
+
if (typeof observation.attributes.readReplicaSource === "string") return { status: "ok" };
|
|
13520
|
+
const dias = observation.attributes.backupRetentionDays;
|
|
13521
|
+
if (typeof dias !== "number") return { status: "unknown", check: RDS_CHECKS.instances, attribute: "backupRetentionDays" };
|
|
13522
|
+
if (dias > 0) return { status: "ok" };
|
|
13523
|
+
return { status: "finding", evidence: { backupRetentionDays: 0, engine: observation.attributes.engine ?? null } };
|
|
13524
|
+
}
|
|
13525
|
+
var rdsSinCopias = {
|
|
13526
|
+
id: "SEC_AWS_BACKUP_RDS_SIN_COPIAS",
|
|
13527
|
+
scope: "resource",
|
|
13528
|
+
category: "security_backup",
|
|
13529
|
+
severity: "high",
|
|
13530
|
+
provider: "aws",
|
|
13531
|
+
kinds: ["rds_instance"],
|
|
13532
|
+
requires: [REGION_CHECKS.listRegions, RDS_CHECKS.instances],
|
|
13533
|
+
evaluate: rdsSinCopiasEvaluate,
|
|
13534
|
+
// Se juzga en la cuenta: el adaptador de planes de Terraform aún no traduce las copias.
|
|
13535
|
+
runtimeOnly: true
|
|
13536
|
+
};
|
|
13537
|
+
|
|
13538
|
+
// ../../services/security/src/rules/aws/log-retention.ts
|
|
13539
|
+
var LOG_RETENTION_MIN_DAYS = 365;
|
|
13540
|
+
function retencionCortaEvaluate(observation) {
|
|
13541
|
+
const bucket = observation.attributes.s3BucketName;
|
|
13542
|
+
if (bucket === null) return { status: "ok" };
|
|
13543
|
+
if (typeof bucket !== "string") return { status: "unknown", check: CLOUDTRAIL_CHECKS.describeTrails, attribute: "s3BucketName" };
|
|
13544
|
+
const dias = observation.attributes.logRetentionDays;
|
|
13545
|
+
if (dias === null) return { status: "ok" };
|
|
13546
|
+
if (typeof dias !== "number") return { status: "unknown", check: TRAIL_BUCKET_CHECKS.lifecycle, attribute: "logRetentionDays" };
|
|
13547
|
+
if (dias >= LOG_RETENTION_MIN_DAYS) return { status: "ok" };
|
|
13548
|
+
return {
|
|
13549
|
+
status: "finding",
|
|
13550
|
+
evidence: {
|
|
13551
|
+
logRetentionDays: dias,
|
|
13552
|
+
minimumDays: LOG_RETENTION_MIN_DAYS,
|
|
13553
|
+
bucket: observation.attributes.s3BucketName,
|
|
13554
|
+
objectLock: observation.attributes.logObjectLock ?? null,
|
|
13555
|
+
expirationDate: observation.attributes.logExpirationDate ?? null
|
|
13556
|
+
}
|
|
13557
|
+
};
|
|
13558
|
+
}
|
|
13559
|
+
var trailRetencionCorta = {
|
|
13560
|
+
id: "SEC_AWS_LOGGING_RETENCION_CORTA",
|
|
13561
|
+
scope: "resource",
|
|
13562
|
+
category: "security_logging",
|
|
13563
|
+
severity: "medium",
|
|
13564
|
+
provider: "aws",
|
|
13565
|
+
kinds: ["cloudtrail_trail"],
|
|
13566
|
+
requires: [REGION_CHECKS.listRegions, CLOUDTRAIL_CHECKS.describeTrails, TRAIL_BUCKET_CHECKS.lifecycle, TRAIL_BUCKET_CHECKS.versioning, TRAIL_BUCKET_CHECKS.objectLock],
|
|
13567
|
+
evaluate: retencionCortaEvaluate,
|
|
13568
|
+
// Se juzga en la cuenta: un plan de Terraform no trae el ciclo de vida efectivo del bucket del trail.
|
|
13569
|
+
runtimeOnly: true
|
|
13570
|
+
};
|
|
13571
|
+
|
|
13423
13572
|
// ../../shared/src/security-rule-verdicts.ts
|
|
13424
13573
|
var SECURITY_RULE_CHECKS = {
|
|
13425
13574
|
securityGroups: "aws:ec2:DescribeSecurityGroups",
|
|
@@ -13430,7 +13579,7 @@ var SECURITY_RULE_CHECKS = {
|
|
|
13430
13579
|
describeKey: "aws:kms:DescribeKey",
|
|
13431
13580
|
rotation: "aws:kms:GetKeyRotationStatus"
|
|
13432
13581
|
};
|
|
13433
|
-
var
|
|
13582
|
+
var ALL_PROTOCOLS2 = "-1";
|
|
13434
13583
|
var FAMILIAS = [
|
|
13435
13584
|
{ atributo: "cidrs", maximo: 32, umbral: 7 },
|
|
13436
13585
|
{ atributo: "ipv6Cidrs", maximo: 128, umbral: 3 }
|
|
@@ -13476,7 +13625,7 @@ function abiertaAInternet(regla) {
|
|
|
13476
13625
|
function puertosAlcanzados(regla) {
|
|
13477
13626
|
if (typeof regla.protocol !== "string") return void 0;
|
|
13478
13627
|
const protocolo = POR_NUMERO[regla.protocol] ?? regla.protocol;
|
|
13479
|
-
if (protocolo ===
|
|
13628
|
+
if (protocolo === ALL_PROTOCOLS2) return [...PUERTOS_DE_ADMINISTRACION];
|
|
13480
13629
|
if (!CON_PUERTOS.includes(protocolo)) return [];
|
|
13481
13630
|
const desde = numero(regla.fromPort);
|
|
13482
13631
|
const hasta = numero(regla.toPort);
|
|
@@ -13614,92 +13763,6 @@ function evaluateSecAwsEncryptionKmsSinRotacion(attributes) {
|
|
|
13614
13763
|
};
|
|
13615
13764
|
}
|
|
13616
13765
|
|
|
13617
|
-
// ../../services/security/src/collectors/aws/check-ids.ts
|
|
13618
|
-
var CLOUDTRAIL_CHECKS = {
|
|
13619
|
-
describeTrails: "aws:cloudtrail:DescribeTrails",
|
|
13620
|
-
trailStatus: "aws:cloudtrail:GetTrailStatus",
|
|
13621
|
-
eventSelectors: "aws:cloudtrail:GetEventSelectors"
|
|
13622
|
-
};
|
|
13623
|
-
var EC2_CHECKS = {
|
|
13624
|
-
securityGroups: "aws:ec2:DescribeSecurityGroups",
|
|
13625
|
-
networkAcls: "aws:ec2:DescribeNetworkAcls",
|
|
13626
|
-
snapshots: "aws:ec2:DescribeSnapshots",
|
|
13627
|
-
publicSnapshots: "aws:ec2:DescribeSnapshots#public",
|
|
13628
|
-
vpcs: "aws:ec2:DescribeVpcs",
|
|
13629
|
-
subnets: "aws:ec2:DescribeSubnets",
|
|
13630
|
-
flowLogs: "aws:ec2:DescribeFlowLogs",
|
|
13631
|
-
prefixListEntries: "aws:ec2:GetManagedPrefixListEntries",
|
|
13632
|
-
flowLogInterfaces: "aws:ec2:DescribeNetworkInterfaces#flowLogs"
|
|
13633
|
-
};
|
|
13634
|
-
var ALL_PROTOCOLS2 = "-1";
|
|
13635
|
-
var ELB_CHECKS = {
|
|
13636
|
-
loadBalancers: "aws:elasticloadbalancing:DescribeLoadBalancers",
|
|
13637
|
-
listeners: "aws:elasticloadbalancing:DescribeListeners",
|
|
13638
|
-
targetGroups: "aws:elasticloadbalancing:DescribeTargetGroups",
|
|
13639
|
-
targetGroupAttributes: "aws:elasticloadbalancing:DescribeTargetGroupAttributes",
|
|
13640
|
-
targetHealth: "aws:elasticloadbalancing:DescribeTargetHealth"
|
|
13641
|
-
};
|
|
13642
|
-
var IAM_CHECKS = {
|
|
13643
|
-
accountSummary: "aws:iam:GetAccountSummary",
|
|
13644
|
-
passwordPolicy: "aws:iam:GetAccountPasswordPolicy",
|
|
13645
|
-
listUsers: "aws:iam:ListUsers",
|
|
13646
|
-
loginProfile: "aws:iam:GetLoginProfile",
|
|
13647
|
-
mfaDevices: "aws:iam:ListMFADevices",
|
|
13648
|
-
accessKeys: "aws:iam:ListAccessKeys",
|
|
13649
|
-
accessKeyLastUsed: "aws:iam:GetAccessKeyLastUsed",
|
|
13650
|
-
attachedPolicies: "aws:iam:ListAttachedUserPolicies"
|
|
13651
|
-
};
|
|
13652
|
-
var KMS_CHECKS = {
|
|
13653
|
-
listKeys: "aws:kms:ListKeys",
|
|
13654
|
-
listAliases: "aws:kms:ListAliases",
|
|
13655
|
-
describeKey: "aws:kms:DescribeKey",
|
|
13656
|
-
rotation: "aws:kms:GetKeyRotationStatus"
|
|
13657
|
-
};
|
|
13658
|
-
var LAMBDA_CHECKS = {
|
|
13659
|
-
functions: "aws:lambda:ListFunctions",
|
|
13660
|
-
functionUrl: "aws:lambda:GetFunctionUrlConfig",
|
|
13661
|
-
policy: "aws:lambda:GetPolicy"
|
|
13662
|
-
};
|
|
13663
|
-
var LIGHTSAIL_CHECKS = {
|
|
13664
|
-
regions: "aws:lightsail:GetRegions",
|
|
13665
|
-
instances: "aws:lightsail:GetInstances"
|
|
13666
|
-
};
|
|
13667
|
-
var MONITORING_CHECKS = {
|
|
13668
|
-
metricFilters: "aws:logs:DescribeMetricFilters",
|
|
13669
|
-
alarms: "aws:cloudwatch:DescribeAlarms",
|
|
13670
|
-
topicSubscriptions: "aws:sns:ListSubscriptionsByTopic"
|
|
13671
|
-
};
|
|
13672
|
-
var RDS_CHECKS = {
|
|
13673
|
-
instances: "aws:rds:DescribeDBInstances",
|
|
13674
|
-
clusters: "aws:rds:DescribeDBClusters",
|
|
13675
|
-
snapshots: "aws:rds:DescribeDBSnapshots",
|
|
13676
|
-
snapshotAttributes: "aws:rds:DescribeDBSnapshotAttributes",
|
|
13677
|
-
clusterSnapshots: "aws:rds:DescribeDBClusterSnapshots",
|
|
13678
|
-
clusterSnapshotAttributes: "aws:rds:DescribeDBClusterSnapshotAttributes"
|
|
13679
|
-
};
|
|
13680
|
-
var REGION_CHECKS = {
|
|
13681
|
-
listRegions: "aws:ec2:DescribeRegions"
|
|
13682
|
-
};
|
|
13683
|
-
var S3_CHECKS = {
|
|
13684
|
-
listBuckets: "aws:s3:ListBuckets",
|
|
13685
|
-
accountPublicAccessBlock: "aws:s3control:GetPublicAccessBlock",
|
|
13686
|
-
publicAccessBlock: "aws:s3:GetPublicAccessBlock",
|
|
13687
|
-
policyStatus: "aws:s3:GetBucketPolicyStatus",
|
|
13688
|
-
acl: "aws:s3:GetBucketAcl",
|
|
13689
|
-
encryption: "aws:s3:GetBucketEncryption"
|
|
13690
|
-
};
|
|
13691
|
-
var IAM_ACCESS_CHECKS = {
|
|
13692
|
-
authorizationDetails: "aws:iam:GetAccountAuthorizationDetails",
|
|
13693
|
-
generateLastAccessed: "aws:iam:GenerateServiceLastAccessedDetails",
|
|
13694
|
-
lastAccessed: "aws:iam:GetServiceLastAccessedDetails",
|
|
13695
|
-
analyzers: "aws:access-analyzer:ListAnalyzers",
|
|
13696
|
-
analyzerFindings: "aws:access-analyzer:ListFindings",
|
|
13697
|
-
analyzerFinding: "aws:access-analyzer:GetFinding",
|
|
13698
|
-
// Solo para reconocer los roles de la cuenta de gestión; ninguna regla depende de ella.
|
|
13699
|
-
organization: "aws:organizations:DescribeOrganization"
|
|
13700
|
-
};
|
|
13701
|
-
var CIEM_WINDOW_DAYS = 90;
|
|
13702
|
-
|
|
13703
13766
|
// ../../services/security/src/rules/aws/encryption.ts
|
|
13704
13767
|
function falta2(check, attribute) {
|
|
13705
13768
|
return { status: "unknown", check, attribute };
|
|
@@ -14537,7 +14600,7 @@ var adminAbiertoAInternet = {
|
|
|
14537
14600
|
function puertosDeAdministracion(regla) {
|
|
14538
14601
|
if (typeof regla.protocol !== "string") return void 0;
|
|
14539
14602
|
const protocolo = protocolName(regla.protocol);
|
|
14540
|
-
if (protocolo ===
|
|
14603
|
+
if (protocolo === ALL_PROTOCOLS) return [...ADMIN_PORTS2];
|
|
14541
14604
|
if (protocolo !== "tcp" && protocolo !== "udp") return [];
|
|
14542
14605
|
const desde = regla.fromPort;
|
|
14543
14606
|
const hasta = regla.toPort;
|
|
@@ -14629,7 +14692,7 @@ function lightsailEvaluate(observation) {
|
|
|
14629
14692
|
const protocolo = typeof regla.protocol === "string" ? protocolName(regla.protocol) : void 0;
|
|
14630
14693
|
const alcanzados = puertosDeAdministracion({
|
|
14631
14694
|
...regla,
|
|
14632
|
-
protocol: protocolo === "all" ?
|
|
14695
|
+
protocol: protocolo === "all" ? ALL_PROTOCOLS : protocolo
|
|
14633
14696
|
});
|
|
14634
14697
|
if (alcanzados === void 0) {
|
|
14635
14698
|
indecisa = true;
|
|
@@ -15181,6 +15244,8 @@ var AWS_SECURITY_RULES = [
|
|
|
15181
15244
|
lambdaPublica,
|
|
15182
15245
|
kmsSinRotacion,
|
|
15183
15246
|
rdsSinCifrar,
|
|
15247
|
+
rdsSinCopias,
|
|
15248
|
+
trailRetencionCorta,
|
|
15184
15249
|
rdsSinActualizacionMenor,
|
|
15185
15250
|
rootSinMfa,
|
|
15186
15251
|
usuarioSinMfa,
|
|
@@ -15295,10 +15360,38 @@ var AZURE_IAM_CHECKS = {
|
|
|
15295
15360
|
// Métodos de autenticación registrados: `UserAuthenticationMethod.Read.All` de aplicación, opcional.
|
|
15296
15361
|
authMethods: "azure:graph:users.authentication.methods"
|
|
15297
15362
|
};
|
|
15363
|
+
var AZURE_BACKUP_CHECKS = {
|
|
15364
|
+
virtualMachines: "azure:compute:virtualMachines",
|
|
15365
|
+
vaults: "azure:recoveryservices:vaults",
|
|
15366
|
+
protectedItems: "azure:recoveryservices:backupProtectedItems"
|
|
15367
|
+
};
|
|
15298
15368
|
var AZURE_LOGGING_CHECKS = {
|
|
15299
15369
|
diagnosticSettings: "azure:insights:diagnosticSettings"
|
|
15300
15370
|
};
|
|
15301
15371
|
|
|
15372
|
+
// ../../services/security/src/rules/azure/backup.ts
|
|
15373
|
+
function vmSinCopiaEvaluate(observation) {
|
|
15374
|
+
const copia = observation.attributes.backedUp;
|
|
15375
|
+
if (typeof copia !== "boolean") return { status: "unknown", check: AZURE_BACKUP_CHECKS.protectedItems, attribute: "backedUp" };
|
|
15376
|
+
if (copia) return { status: "ok" };
|
|
15377
|
+
return {
|
|
15378
|
+
status: "finding",
|
|
15379
|
+
evidence: { protectionState: observation.attributes.protectionState ?? null, lastBackupStatus: observation.attributes.lastBackupStatus ?? null }
|
|
15380
|
+
};
|
|
15381
|
+
}
|
|
15382
|
+
var vmSinCopia = {
|
|
15383
|
+
id: "SEC_AZURE_BACKUP_VM_SIN_COPIA",
|
|
15384
|
+
scope: "resource",
|
|
15385
|
+
category: "security_backup",
|
|
15386
|
+
severity: "high",
|
|
15387
|
+
provider: "azure",
|
|
15388
|
+
kinds: ["virtual_machine"],
|
|
15389
|
+
requires: [AZURE_BACKUP_CHECKS.virtualMachines, AZURE_BACKUP_CHECKS.vaults, AZURE_BACKUP_CHECKS.protectedItems],
|
|
15390
|
+
evaluate: vmSinCopiaEvaluate,
|
|
15391
|
+
// Se juzga en la cuenta: el adaptador de planes de Terraform no puede saber en qué almacén de Recovery Services está la máquina.
|
|
15392
|
+
runtimeOnly: true
|
|
15393
|
+
};
|
|
15394
|
+
|
|
15302
15395
|
// ../../services/security/src/rules/azure/encryption.ts
|
|
15303
15396
|
var TLS_DEBIL = /* @__PURE__ */ new Set(["tls1_0", "tls1.0", "1.0", "tls1_1", "tls1.1", "1.1"]);
|
|
15304
15397
|
function storageTlsEvaluate(observation) {
|
|
@@ -15455,6 +15548,8 @@ function evaluate4(observation) {
|
|
|
15455
15548
|
role,
|
|
15456
15549
|
principalType: observation.attributes.principalType ?? null,
|
|
15457
15550
|
scope: observation.attributes.scope ?? null,
|
|
15551
|
+
// Sin el permiso de Graph no hay nombre: el id del principal es lo único que permite saber a quién preguntar.
|
|
15552
|
+
principalId: observation.attributes.principalId ?? null,
|
|
15458
15553
|
// Solo con el permiso opcional de Graph: quién es y, si es un grupo, quiénes entran por él.
|
|
15459
15554
|
...pick2(observation, ["principalName", "groupMemberCount", "groupMembersComplete"])
|
|
15460
15555
|
}
|
|
@@ -15702,6 +15797,7 @@ var AZURE_SECURITY_RULES = [
|
|
|
15702
15797
|
sqlTlsDebil,
|
|
15703
15798
|
keyVaultSinPurga,
|
|
15704
15799
|
sqlSinTde,
|
|
15800
|
+
vmSinCopia,
|
|
15705
15801
|
rolPrivilegiado,
|
|
15706
15802
|
asignacionHuerfana,
|
|
15707
15803
|
adminSinMfa,
|
|
@@ -15833,6 +15929,28 @@ var GCP_LOGGING_CHECKS = {
|
|
|
15833
15929
|
};
|
|
15834
15930
|
var GCP_CIEM_WINDOW_DAYS = 90;
|
|
15835
15931
|
|
|
15932
|
+
// ../../services/security/src/rules/gcp/backup.ts
|
|
15933
|
+
function sqlSinCopiasEvaluate(observation) {
|
|
15934
|
+
const tipo = observation.attributes.instanceType;
|
|
15935
|
+
if (typeof tipo === "string" && tipo !== "CLOUD_SQL_INSTANCE") return { status: "ok" };
|
|
15936
|
+
const activas = observation.attributes.backupEnabled;
|
|
15937
|
+
if (typeof activas !== "boolean") return { status: "unknown", check: GCP_SQL_CHECKS.instances, attribute: "backupEnabled" };
|
|
15938
|
+
if (activas) return { status: "ok" };
|
|
15939
|
+
return { status: "finding", evidence: { backupEnabled: false } };
|
|
15940
|
+
}
|
|
15941
|
+
var sqlSinCopias = {
|
|
15942
|
+
id: "SEC_GCP_BACKUP_SQL_SIN_COPIAS",
|
|
15943
|
+
scope: "resource",
|
|
15944
|
+
category: "security_backup",
|
|
15945
|
+
severity: "high",
|
|
15946
|
+
provider: "gcp",
|
|
15947
|
+
kinds: ["cloud_sql_instance"],
|
|
15948
|
+
requires: [GCP_SQL_CHECKS.instances],
|
|
15949
|
+
evaluate: sqlSinCopiasEvaluate,
|
|
15950
|
+
// Se juzga en la cuenta: el adaptador de planes de Terraform aún no traduce las copias.
|
|
15951
|
+
runtimeOnly: true
|
|
15952
|
+
};
|
|
15953
|
+
|
|
15836
15954
|
// ../../services/security/src/rules/gcp/encryption.ts
|
|
15837
15955
|
function discoSinCmekEvaluate(observation) {
|
|
15838
15956
|
const boot = observation.attributes.boot;
|
|
@@ -16432,6 +16550,7 @@ var GCP_SECURITY_RULES = [
|
|
|
16432
16550
|
discoSinCmek,
|
|
16433
16551
|
sqlSinCmek,
|
|
16434
16552
|
sqlSinSsl,
|
|
16553
|
+
sqlSinCopias,
|
|
16435
16554
|
kmsSinRotacion2,
|
|
16436
16555
|
secretoEnFunction,
|
|
16437
16556
|
rolPrimitivo,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aaa-sentinel/iac-cost",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Estimate the monthly cost delta of a Terraform plan, check it against the AAA Sentinel security rules, open security fixes as pull requests and report how the security posture changed, from your CI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|