Skip to main content
With Custom checks, you can turn your own security rules into findings. You write a rule as a policy in Rego, the policy language of Open Policy Agent (OPA). Plerion runs it against the assets it collects from your cloud integrations. Use custom checks for rules only your organization has, such as required tags, approved accounts, or naming standards.

How custom checks work

A custom check has three parts:
  • Primary asset type: The kind of asset the check judges, such as AWS::S3::Bucket or GCP::Storage::Bucket. Each finding belongs to one asset of this type.
  • Additional asset types (optional): Other asset types the policy can read, for rules that look across assets. For example, a check on Lambda functions can also read IAM roles.
  • Policy: Rego code that receives the assets and returns a verdict for each one it judges: FAILED or PASSED.
Every verdict becomes a finding. Custom check findings appear in the Findings dashboard next to Plerion’s own findings, with a Custom badge and the check’s slug as their name. Plerion runs a check:
  • As soon as you publish it, and again each time you change it.
  • After every scan of each integration from the matching cloud provider.
  • Within minutes of a change to a target asset, when continuous scanning is on.
A check sees the assets of one integration at a time, so a rule never compares assets across two cloud accounts. To see the custom checks page, your role needs the CustomCheck:Read permission. To create, change, preview, or delete checks, it needs CustomCheck:Modify.

Steps to create a custom check

This walkthrough builds a check that fails every S3 bucket without all four S3 Block Public Access settings. Buckets tagged PublicAccess=approved are left out.
1

Go to Settings > Custom checks

The page lists every custom check in the tenant with its asset type, default severity, run status, and number of findings. Click New check.
Custom checks page listing two checks with their asset type, severity, status, findings count, and author, and the New check button
2

Start from an example (optional)

To begin from a working policy, pick one under Examples. The example fills in the whole form, which you can then change. The examples are:
  • Match every asset (test): Fails every asset of the chosen type. Use it to see findings flow end to end before you write real logic.
  • OIDC trust constraint — GitHub Actions: Fails IAM roles that trust GitHub Actions without limiting which repository can assume them.
  • S3 buckets must have versioning + KMS encryption: Fails buckets missing either control.
  • EBS volumes must be encrypted: Fails unencrypted EBS volumes.
Examples section with the Start from an example dropdown
3

Fill in the details

  • Title: What the check enforces, written as a rule. For example, S3 buckets must block public access.
  • Slug: A short ID shown on findings and in exports. Plerion fills it in from the title. Use lowercase letters, numbers, and hyphens. The slug must be unique in the tenant.
  • Description (optional): More detail on what the check enforces and why.
  • Default severity: The severity of each finding, unless the policy sets one: Informational, Low, Medium, High, or Critical.
  • Default remediation (optional): How to fix a failing asset. It’s shown on the check’s failed findings.
Details section filled in with title, slug, description, S3 Bucket as the primary asset type, High default severity, and a default remediation
4

Choose the asset types

In Primary asset type, search by name or type and pick the type the check judges. Here, it’s S3 Bucket (AWS::S3::Bucket). The list covers every asset type Plerion collects across AWS, Azure, and GCP.If the policy needs other assets, add their types in Additional asset types. Plerion collects these from the same cloud account.
Asset type search showing S3 and GCP bucket types for the search term bucket
5

Write the policy

Enter the policy in the Rego policy editor. This one returns a failed verdict for each bucket with a Block Public Access setting turned off, and names the settings in the finding’s message:
A bucket with no Block Public Access configuration at all fails on all four settings. That’s because not is true when a field is missing.
Rego policy editor showing the S3 Block Public Access policy
6

Preview the findings

Under Preview, pick an integration in Run against integration and click Run preview. Plerion runs the policy against the assets from that integration’s latest scan and shows the findings it would create. Nothing is saved.If the policy has an error, the preview shows the error and the line it’s on. If it produces no findings, check the asset type, the field paths, and the conditions.
Preview section showing 12 preview findings, each failed with High severity, the bucket name, and the message listing the settings that are off
7

Click Publish

Plerion saves the check and runs it against every integration from the matching cloud provider. You go back to the list, where the check’s Status shows the run’s progress:
  • Running: At least one integration is still being evaluated.
  • Completed: The check has run on every integration.
  • Error: The run failed on at least one integration.
  • Pending: The check hasn’t run yet, or no integration has assets of its type.
Until you publish, the form keeps your changes as an Unsaved draft, so you can leave the page and come back.

See a check’s results

On the custom checks page:
  • Click a check’s Status to see how its last run went on each integration, with the number of findings and the time of the run.
  • Click the number in Findings to open the check’s findings. To open them on the Findings page instead, open the link in a new tab.
Run status by integration panel showing the sandbox integration completed with 12 findings
Findings panel for the check, each finding showing the check slug, a Custom badge, High severity, and the message
To change a check, click its edit icon. When you publish the change, Plerion runs the check again and updates its findings. To delete a check, click its delete icon. Plerion also removes the check’s findings in the background, which can take a few minutes. You can also map custom checks to the controls of your own compliance frameworks. In the custom compliance builder, choose them under Mapped Custom Checks on a control with no child controls.

What a policy receives and returns

A policy must declare package custom and define a rule named result. Plerion evaluates the rule and reads its value as a list of verdicts. The policy receives: Each asset has these fields: Each verdict in result is an object: Some rules for verdicts:
  • Every verdict becomes a finding. An asset left out of result has no finding, and leaving out an asset that had a finding removes that finding.
  • Return one verdict per asset. Gather every reason an asset fails into one verdict, as the examples below do.
  • A PASSED verdict without a message gets the check’s default message, which reads as a violation. Set a message on passed verdicts, or return failed verdicts only.
  • If any verdict has another status, names an asset that isn’t in input.assets, or lists a relatedAssetIds entry that isn’t in input.additionalAssets, Plerion rejects the whole evaluation.
With continuous scanning on, Plerion re-evaluates a check soon after an asset of its primary type changes. Set relatedAssetIds to also re-evaluate a verdict when one of the additional assets it names changes. Without it, a change to an additional asset updates the verdict at the next scheduled scan.
To learn which fields an asset type has, preview a policy that lists them. Each finding’s message shows the field names of one asset.

Examples

Paste an example into a new check, set the asset types it names, and preview it.

Require tags on Lambda functions

Primary asset type: AWS::Lambda::Function Reports every function, passing those with all the required tags and failing the rest. The message names the missing tags. The check reads tags from meta.resource.providerTags, so it works on any asset type once you change the primary asset type.

Flag IAM roles that trust unapproved accounts

Primary asset type: AWS::IAM::Role Fails roles that another AWS account can assume when that account isn’t on your allow list. A trust policy that lets in any AWS account, with the principal "*" or {"AWS": "*"}, shows as * in the message. The policy sets each finding’s severity itself:
  • Critical when a statement lets in an unapproved account without an sts:ExternalId condition, so anyone in that account can assume the role.
  • Medium when every statement that lets in an unapproved account requires an external ID.
Replace the account IDs in trusted_accounts with your own.

Find Lambda functions that run with administrator access

Primary asset type: AWS::Lambda::Function Additional asset types: AWS::IAM::Role Fails each function whose execution role has the AWS managed AdministratorAccess policy attached. The function only names its role by ARN, so the policy finds the role among the additional assets. It returns the role in relatedAssetIds, so a change to the role updates the finding too.

Manage custom checks outside the app

  • Customer API: create, list, change, and delete checks, and preview a check’s findings with a dry run, from your own scripts and pipelines. See the custom checks API reference.
  • Terraform: keep checks in code, review policy changes in pull requests, and preview findings during terraform plan. See Manage with Terraform.
  • CLI: run one-off tasks from a terminal with the plerion custom-checks commands.