Skip to main content

Getting Started

First Glance

Our rule editor supports both Javascript code (legacy rules) and Typescript code

For example, the following two code snippets are equivalent:

var volumes = Utils.getElements(aws, "Volumes"); // you can also write aws.Volumes
for (var v of volumes) {
if (!v.Raw.Encrypted) {
var action = "Enable encryption for EBS volumes with Id [" + v.Id + "] created in " + v.CreateTime + " in region " + v.Region.Name + "."
result("Low", [v], action)
}
}"
var volumes: OutputInstanceVolume[] = aws.Volumes;
for (var v of volumes) {
if (!v.Raw.Encrypted) {
var action: string =
"Enable encryption for EBS volumes with Id [" +
v.Id +
"] created in " +
v.CreateTime +
" in region " +
v.Region.Name +
".";
result(LOW, [v], action);
}
}

The major advantage of using typescripts is that you can have autocomplete when accessing cloud resources , such as the v.Id or v.Region.Name for an OutputInstanceVolume instance. For a full list of available classes, refer to the Classes page.

Accessing Cloud Resources

To access and evaluate cloud resources, you can use the following constants to get the cloud instances. They are all instances of Output

The result Function

declare function result(
level: "Critical" | "High" | "Medium" | "Low" | "Information",
affectedResources: any[],
action: string,
remark: string
): void;

The code snippets in the first glance section checks whether the volumes of a aws are all encrypted. If the condition is not satisfied, the general audit report will show a Low risk. This is done by calling the result function.

Parameter List

  • level - string should be used as constants, please refer to Result Constants
  • affectedResources - any[] can append any checked cloud instance
  • action - string recommended action provided to the audit report
  • remark - string any additional remark

Result Constants

  • CRITICAL
  • HIGH
  • MEDIUM
  • LOW
  • INFORMATION

More Information

Ruleset JSON schema can be found here.

For more helper util functions, please refer to the Utils page.

For more information on the classes, please refer to the Classes page.