---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [safety](../index.md) / SafetyRule

# Interface: SafetyRule

Defined in: [packages/b2c-tooling-sdk/src/safety/types.ts:37](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/safety/types.ts#L37)

A safety rule that matches operations and specifies an action.

Rules support three matcher types, all using glob patterns (via minimatch):
- `method` + `path`: Matches HTTP requests by method and URL path
- `job`: Matches job execution by job ID (extracted from OCAPI URLs)
- `command`: Matches CLI commands by oclif command ID (e.g., "sandbox:delete")

## Example

```json
{ "job": "sfcc-site-archive-export", "action": "allow" }
{ "command": "ecdn:cache:purge", "action": "confirm" }
{ "method": "DELETE", "path": "/code_versions/*", "action": "block" }
```

## Properties

### action

> **action**: [`SafetyAction`](../type-aliases/SafetyAction.md)

Defined in: [packages/b2c-tooling-sdk/src/safety/types.ts:47](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/safety/types.ts#L47)

Action to take when this rule matches.

***

### command?

> `optional` **command**: `string`

Defined in: [packages/b2c-tooling-sdk/src/safety/types.ts:45](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/safety/types.ts#L45)

CLI command ID glob pattern (e.g., "sandbox:*", "ecdn:cache:purge").

***

### job?

> `optional` **job**: `string`

Defined in: [packages/b2c-tooling-sdk/src/safety/types.ts:43](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/safety/types.ts#L43)

Job ID glob pattern. Matches OCAPI job execution URLs by job ID.

***

### method?

> `optional` **method**: `string`

Defined in: [packages/b2c-tooling-sdk/src/safety/types.ts:39](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/safety/types.ts#L39)

HTTP method pattern (e.g., "POST", "DELETE"). Omit to match any method.

***

### path?

> `optional` **path**: `string`

Defined in: [packages/b2c-tooling-sdk/src/safety/types.ts:41](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/safety/types.ts#L41)

URL path glob pattern (e.g., "/jobs/&#42;/executions"). Matched with minimatch.
