gombocai/orl

By gombocai

Updated 9 days ago

A remediation tool that read IaC based remediation rules.

Image
Security
Languages & frameworks
Developer tools
0

10K+

gombocai/orl repository overview

Usage

Cache a set of rules:

docker run -rm -v ./rules:/workspace orl:latest rules pull --channel default

Remediate some IaC (terraform)

docker run -rm -v ./rules:/rules -v ./code:/workspace orl:latest -rulespace /rules .

You can remediate other languages using the --language option.

Authentication

A PAT from https://app.gomboc.ai is needed to pull rules.

Rules

You can write your own rules in the following format:

# rule.orl
type: Rule
version: v1
metadata:
  name: Some Unique Name
  priority: 0 # lower = executed first
  description: |
    Long description

  # Optional
  required_contexts:
    - "variables" # Skip the rule if no variables are defined

spec:
  language: terraform # the IaC language this can fix
  audit_language: ast # The parser to use to understand the IaC.  Only "ast" is supported

  # optional
  variables:
    - "foo.bar" # the "bar" variable in the "foo" variables namespace needs to be defined or the rule is skipped

  # optional
  # Collects all object across the entire workspace (all files)
  # {{ }} is the expr template language
  # This needs to be valid for the `audit_language`
  collect: |
    - name: logging_buckets
      audit: {{ aResource("aws_s3_bucket_logging_bucket", anAttribute("bucket")) }}

  # required
  # find objects that need to be fixed
  audit: |
    {{ aResource("aws_s3_bucket", aMissingBlock("logging")) }}

  # optional
  # skip the finding based on expr
  # In this example collect all the bucket strings, and check them to see if they are the name of the finding
  skip_finding: 'collect(collections, "logging-rules.*.bucket") | hasSubString( finding.name )'

  # List of commands to execute per finding
  # commands are
  #  audit - throw an error.  value is the text
  #  replace - replace the finding with value
  #  insert_before - insert value before the finding
  #  insert_after - insert value after the finding
  remediation:
    - command: audit
      value: "{{ finding.name }}"

Variables

Variables allow your adjust the rule behavior at runtime. They are defined in a variables namespace. They can be defined in the workspace itself, or loaded using the --var path/to/variables option.

# vars.orl
type: Variables
version: v1
metadata:
  name: foo # This is the namespace where the variable live
data:
  bar: "baz" # All variables are defined here as strings

Tag summary

Content type

Image

Digest

sha256:af730272a

Size

98.9 MB

Last updated

9 days ago

docker pull gombocai/orl