CentralCSP
APIInventory Rules

Create an inventory rule

Adds a rule so scripts from a known vendor are decided without being reviewed one by one. Reconciliation runs straight away and applies the rule to every script in the inventory that nobody has decided yet. An exclude rule takes matching scripts out of PCI scope rather than authorizing them, which also removes them from the compliance figures and stops them raising an unjustified-script alert, so keep its pattern narrow. A rule never changes a decision someone made by hand. A website is limited to 200 rules.

Requires the manager role on the website and the compliance plan feature.

POST
/v1/workspaces/{workspaceId}/websites/{websiteId}/compliance/rules

Authorization

AuthorizationBearer <token>

An OpenID Connect access token issued by Keycloak, acting as the signed-in user.

In: header

Path Parameters

workspaceId*string
websiteId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

name*string

Display name for the rule.

Length1 <= length <= 255
urlPattern*string

Pattern to match script URLs against.

Length1 <= length <= 1024
patternType?PatternType

How urlPattern is read. glob uses * wildcards and is the default. regex is a regular expression, kept for existing integrations. Patterns are matched safely, and one with too many unbounded repetitions is rejected.

Value in

  • "glob"
  • "regex"
action?RuleAction

What happens to a script the rule matches. justify records it as reviewed and allowed, and is the default. exclude takes it out of PCI scope instead, for the software a visitor's own browser injects - an extension, a security product, a translating proxy - which the site never asked for. An excluded script leaves the review queue and the compliance figures entirely and raises no unjustified-script alert, so keep the pattern narrow: anything the site really does load belongs in the inventory.

Value in

  • "justify"
  • "exclude"
justification*string

Applied to every script the pattern matches: the justification on a justify rule, the reason it is out of scope on an exclude one.

Length1 <= length <= 4096
tagIds?array<string>

Tags to apply to every script this rule matches.

Itemsitems <= 50
enabled?boolean

Defaults to true.

sortOrder?|

Rules are tried from the lowest value up, and the first match wins. Put the most specific rules first.

Range0 <= value

Response Body

application/json

curl -X POST "https://example.com/v1/workspaces/string/websites/string/compliance/rules" \  -H "Content-Type: application/json" \  -d '{    "name": "Stripe",    "urlPattern": "https://*.stripe.com/*",    "justification": "Stripe payment scripts, approved vendor."  }'
{  "id": "string",  "workspaceId": "string",  "websiteId": "string",  "name": "Stripe",  "urlPattern": "https://*.stripe.com/*",  "patternType": "glob",  "action": "justify",  "justification": "string",  "tagIds": [    "string"  ],  "enabled": true,  "sortOrder": 0,  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}