@pulumi/aws-compliance-policies
Version:
This repository contains a growing set of Compliance Policies to validate your infrastructure using Pulumi's Crossguard Policy-as-Code framework.
227 lines (226 loc) • 11.2 kB
JavaScript
"use strict";
// Copyright 2016-2024, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ------------------------------- WARNING -------------------------------------
// This file was programmatically generated. Do not edit unless you know what
// you're doing.
// ------------------------------- WARNING -------------------------------------
Object.defineProperty(exports, "__esModule", { value: true });
exports.WorkGroup = exports.NamedQuery = exports.DataCatalog = void 0;
const athena_1 = require("@pulumi/aws-native/athena");
const policy_1 = require("@pulumi/policy");
const compliance_policy_manager_1 = require("@pulumi/compliance-policy-manager");
const athena_2 = require("@pulumi/aws-native/athena");
const athena_3 = require("@pulumi/aws-native/athena");
var DataCatalog;
(function (DataCatalog) {
/**
* Checks that Athena DataCatalogs have a description.
*
* @severity low
* @frameworks none
* @topics documentation
* @link https://docs.aws.amazon.com/athena/latest/ug/understanding-tables-databases-and-the-data-catalog.html
*/
DataCatalog.missingDescription = compliance_policy_manager_1.policyManager.registerPolicy({
resourceValidationPolicy: {
name: "awsnative-athena-datacatalog-missing-description",
description: "Checks that Athena DataCatalogs have a description.",
configSchema: compliance_policy_manager_1.policyManager.policyConfigSchema,
enforcementLevel: "advisory",
validateResource: (0, policy_1.validateResourceOfType)(athena_1.DataCatalog, (dataCatalog, args, reportViolation) => {
if (!compliance_policy_manager_1.policyManager.shouldEvalPolicy(args)) {
return;
}
if (!dataCatalog.description) {
reportViolation("Athena DataCatalogs should have a description.");
}
}),
},
vendors: ["aws"],
services: ["athena"],
severity: "low",
topics: ["documentation"],
});
})(DataCatalog || (DataCatalog = {}));
exports.DataCatalog = DataCatalog;
var NamedQuery;
(function (NamedQuery) {
/**
* Checks that Athena NamedQueries have a description.
*
* @severity low
* @frameworks none
* @topics documentation
* @link https://docs.aws.amazon.com/athena/latest/ug/saved-queries.html
*/
NamedQuery.missingDescription = compliance_policy_manager_1.policyManager.registerPolicy({
resourceValidationPolicy: {
name: "awsnative-athena-namedquery-missing-description",
description: "Checks that Athena NamedQueries have a description.",
configSchema: compliance_policy_manager_1.policyManager.policyConfigSchema,
enforcementLevel: "advisory",
validateResource: (0, policy_1.validateResourceOfType)(athena_2.NamedQuery, (namedQuery, args, reportViolation) => {
if (!compliance_policy_manager_1.policyManager.shouldEvalPolicy(args)) {
return;
}
if (!namedQuery.description) {
reportViolation("Athena NamedQueries should have a description.");
}
}),
},
vendors: ["aws"],
services: ["athena"],
severity: "low",
topics: ["documentation"],
});
})(NamedQuery || (NamedQuery = {}));
exports.NamedQuery = NamedQuery;
var WorkGroup;
(function (WorkGroup) {
/**
* Checks that Athena Workgroups use a customer-managed-key.
*
* @severity low
* @frameworks hitrust, iso27001, pcidss
* @topics encryption, storage
* @link https://docs.aws.amazon.com/athena/latest/ug/workgroups-procedure.html
*/
WorkGroup.configureCustomerManagedKey = compliance_policy_manager_1.policyManager.registerPolicy({
resourceValidationPolicy: {
name: "awsnative-athena-workgroup-configure-customer-managed-key",
description: "Checks that Athena Workgroups use a customer-managed-key.",
configSchema: compliance_policy_manager_1.policyManager.policyConfigSchema,
enforcementLevel: "advisory",
validateResource: (0, policy_1.validateResourceOfType)(athena_3.WorkGroup, (workgroup, args, reportViolation) => {
if (!compliance_policy_manager_1.policyManager.shouldEvalPolicy(args)) {
return;
}
if (workgroup.workGroupConfiguration &&
workgroup.workGroupConfiguration.resultConfiguration &&
workgroup.workGroupConfiguration.resultConfiguration.encryptionConfiguration &&
workgroup.workGroupConfiguration.resultConfiguration.encryptionConfiguration.encryptionOption !== "SSE_KMS") {
reportViolation("Athena Workgroups Configurations should be encrypted using a customer-managed key.");
}
if (workgroup.workGroupConfigurationUpdates &&
workgroup.workGroupConfigurationUpdates.resultConfigurationUpdates &&
workgroup.workGroupConfigurationUpdates.resultConfigurationUpdates.encryptionConfiguration &&
workgroup.workGroupConfigurationUpdates.resultConfigurationUpdates.encryptionConfiguration.encryptionOption !== "SSE_KMS") {
reportViolation("Athena Workgroups Configuration Updates should be encrypted using a customer-managed key.");
}
}),
},
vendors: ["aws"],
services: ["athena"],
severity: "low",
topics: ["encryption", "storage"],
frameworks: ["pcidss", "hitrust", "iso27001"],
});
/**
* Checks that Athena Workgroups are encrypted.
*
* @severity high
* @frameworks hitrust, iso27001, pcidss
* @topics encryption, storage
* @link https://docs.aws.amazon.com/athena/latest/ug/workgroups-procedure.html
*/
WorkGroup.disallowUnencryptedWorkgroup = compliance_policy_manager_1.policyManager.registerPolicy({
resourceValidationPolicy: {
name: "awsnative-athena-workgroup-disallow-unencrypted-workgroup",
description: "Checks that Athena Workgroups are encrypted.",
configSchema: compliance_policy_manager_1.policyManager.policyConfigSchema,
enforcementLevel: "advisory",
validateResource: (0, policy_1.validateResourceOfType)(athena_3.WorkGroup, (workgroup, args, reportViolation) => {
if (!compliance_policy_manager_1.policyManager.shouldEvalPolicy(args)) {
return;
}
if (!workgroup.workGroupConfiguration || !workgroup.workGroupConfiguration.resultConfiguration || !workgroup.workGroupConfiguration.resultConfiguration.encryptionConfiguration) {
reportViolation("Athena Workgroup Configurations should be encrypted.");
}
if (!workgroup.workGroupConfigurationUpdates ||
!workgroup.workGroupConfigurationUpdates.resultConfigurationUpdates ||
!workgroup.workGroupConfigurationUpdates.resultConfigurationUpdates.encryptionConfiguration) {
reportViolation("Athena Workgroup Configuration Updates should be encrypted.");
}
}),
},
vendors: ["aws"],
services: ["athena"],
severity: "high",
topics: ["encryption", "storage"],
frameworks: ["pcidss", "hitrust", "iso27001"],
});
/**
* Checks that Athena Workgroups enforce their configuration to their clients.
*
* @severity high
* @frameworks hitrust, iso27001, pcidss
* @topics encryption, storage
* @link https://docs.aws.amazon.com/athena/latest/ug/workgroups-procedure.html
*/
WorkGroup.enforceConfiguration = compliance_policy_manager_1.policyManager.registerPolicy({
resourceValidationPolicy: {
name: "awsnative-athena-workgroup-enforce-configuration",
description: "Checks that Athena Workgroups enforce their configuration to their clients.",
configSchema: compliance_policy_manager_1.policyManager.policyConfigSchema,
enforcementLevel: "advisory",
validateResource: (0, policy_1.validateResourceOfType)(athena_3.WorkGroup, (workgroup, args, reportViolation) => {
if (!compliance_policy_manager_1.policyManager.shouldEvalPolicy(args)) {
return;
}
if (workgroup.workGroupConfiguration && !workgroup.workGroupConfiguration.enforceWorkGroupConfiguration) {
reportViolation("Athena Workgroups Configurations should enforce their configuration to their clients.");
}
if (workgroup.workGroupConfigurationUpdates && !workgroup.workGroupConfigurationUpdates.enforceWorkGroupConfiguration) {
reportViolation("Athena Workgroups Configuration Updates should enforce their configuration to their clients.");
}
}),
},
vendors: ["aws"],
services: ["athena"],
severity: "high",
topics: ["encryption", "storage"],
frameworks: ["pcidss", "hitrust", "iso27001"],
});
/**
* Checks that Athena WorkGroups have a description.
*
* @severity low
* @frameworks none
* @topics documentation
* @link https://docs.aws.amazon.com/athena/latest/ug/workgroups-procedure.html
*/
WorkGroup.missingDescription = compliance_policy_manager_1.policyManager.registerPolicy({
resourceValidationPolicy: {
name: "awsnative-athena-workgroup-missing-description",
description: "Checks that Athena WorkGroups have a description.",
configSchema: compliance_policy_manager_1.policyManager.policyConfigSchema,
enforcementLevel: "advisory",
validateResource: (0, policy_1.validateResourceOfType)(athena_3.WorkGroup, (workgroup, args, reportViolation) => {
if (!compliance_policy_manager_1.policyManager.shouldEvalPolicy(args)) {
return;
}
if (!workgroup.description) {
reportViolation("Athena WorkGroups should have a description.");
}
}),
},
vendors: ["aws"],
services: ["athena"],
severity: "low",
topics: ["documentation"],
});
})(WorkGroup || (WorkGroup = {}));
exports.WorkGroup = WorkGroup;