This project contains the metadata for rules that will feed into IaC tools and potentially CSPM.
Rules are broken down into provider/category/rule and will eventually contain markdown files for remediation.
The json metadata should be converted to code files for use in downstream tools. This can be done by running
make generate
OR from Windows build and run ./cmd/metadata
A GitHub action will run on each PR to ensure that changes to the metadata.json
files still meet the schema.
Metadata files define the common information about rules; description, impact, severity and links to the external tools ids (tfsec, cspm, cfsec)
An example metadata.json
{
"id": "AVD-AWS-0028",
"apiVersion": 2,
"version": 1,
"title": "aws_instance should activate session tokens for Instance Metadata Service.",
"description": "IMDS v2 (Instance Metadata Service) introduced session authentication tokens which improve security when talking to IMDS.\nBy default eaws_instance resource sets IMDS session auth tokens to be optional. \nTo fully protect IMDS you need to enable session tokens by using metadata_options block and its http_tokens variable set to required.",
"custom": {
"severity": "HIGH",
"possibleImpact": "Instance metadata service can be interacted with freely",
"references": [
{
"title": "EC2 Instance Metadata Service blog post",
"url": "https://aws.amazon.com/blogs/security/defense-in-depth-open-firewalls-reverse-proxies-ssrf-vulnerabilities-ec2-instance-metadata-service"
}
],
"externalToolIds": {
"cfsec": [
"aws-ec2-enforce-http-token-imds"
],
"cspm": [
{
"id": 692,
"name": "ec2/ec2MetadataOptions"
}
],
"tfsec": [
"aws-ec2-enforce-http-token-imds"
]
}
}
}
The metadata.json
file for each rule should match the following schema
Type: object
path: #
$schema: http://json-schema.org/draft-04/schema#
Properties
- id
required
- Type:
string
- path: #/properties/id
- Type:
- apiVersion
required
- Type:
integer
- path: #/properties/apiVersion
- Type:
- version
required
- Type:
integer
- path: #/properties/version
- Type:
- title
required
- Type:
string
- path: #/properties/title
- Type:
- description
required
- Type:
string
- path: #/properties/description
- Type:
- description_file_path
- Type:
string
- path: #/properties/description_file_path
- Type:
- custom
required
- Type:
object
- path: #/properties/custom
- Properties
- severity
required
- Type:
string
- path: #/properties/custom/properties/severity
- Type:
- possibleImpact
required
- Type:
string
- path: #/properties/custom/properties/possibleImpact
- Type:
- remediations
- Type:
array
- path: #/properties/custom/properties/remediations
- Items
- Type:
object
- path: #/properties/custom/properties/remediations/items
- Properties
- title
required
- Type:
string
- path: #/properties/custom/properties/remediations/items/properties/title
- Type:
- remediation_path
required
- Type:
string
- path: #/properties/custom/properties/remediations/items/properties/remediation_path
- Type:
- remediation_type
required
- Type:
string
- path: #/properties/custom/properties/remediations/items/properties/remediation_type
- Type:
- title
- Type:
- references
required
- Type:
array
- path: #/properties/custom/properties/references
- Items
- Type:
object
- path: #/properties/custom/properties/references/items
- Properties
- title
required
- Type:
string
- path: #/properties/custom/properties/references/items/properties/title
- Type:
- url
required
- Type:
string
- path: #/properties/custom/properties/references/items/properties/url
- Type:
- title
- Type:
- externalToolIds
required
- Type:
object
- path: #/properties/custom/properties/externalToolIds
- Properties
- cfsec
- Type:
array
- path: #/properties/custom/properties/externalToolIds/properties/cfsec
- Items
- Type:
string
- path: #/properties/custom/properties/externalToolIds/properties/cfsec/items
- Type:
- cspm
- Type:
array
- path: #/properties/custom/properties/externalToolIds/properties/cspm
- Items
- Type:
object
- path: #/properties/custom/properties/externalToolIds/properties/cspm/items
- Properties
- id
required
- Type:
integer
- path: #/properties/custom/properties/externalToolIds/properties/cspm/items/properties/id
- Type:
- name
required
- Type:
string
- path: #/properties/custom/properties/externalToolIds/properties/cspm/items/properties/name
- Type:
- id
- Type:
- tfsec
- Type:
array
- path: #/properties/custom/properties/externalToolIds/properties/tfsec
- Items
- Type:
string
- path: #/properties/custom/properties/externalToolIds/properties/tfsec/items
- Type:
- cfsec
- Type:
- severity
- Type: