View a markdown version of this page

Record visibility configuration language reference - Amazon Bedrock AgentCore

Record visibility configuration language reference

In AWS Agent Registry, a record visibility configuration is a registry setting that you define in a JavaScript Object Notation (JSON) configuration document. You write the document in version 1 of the record visibility configuration language. This reference describes the document format, its elements and structure, validation, and limit counting. The topics at the end of this page describe the fields, operators, and caller-value references that you use in a statement.

Configuration document format

A configuration document is a single JSON object, written in strict JSON. It defines the record visibility configuration, the registry setting that decides which approved records each caller discovers. The API carries the document as JSON text. If you author configurations in YAML, or build them as objects in code, serialize them to JSON before you submit them. For how to pass the document in CreateRegistry and UpdateRegistry, see Add or replace a configuration.

The service rejects a document that contains any of the following:

  • A member name that repeats within one object

  • Text that isn’t well-formed Unicode

  • A member that the language doesn’t define, such as Condition or description, or a defined name in another case, such as Effect

Document elements

A configuration has two document elements. Each statement has three required elements, effect, principal, and resource, and an optional sid. Element names are lowercase and must be spelled exactly. The following table defines each element.

Element Location Required Value and meaning

version

Document

Yes

The JSON string "1", which selects version 1 of the language. The service rejects any other value or type. The language version isn’t the configuration’s revision. For revisions, see Avoid overwriting concurrent changes.

statements

Document

Yes

A nonempty array of statement objects. At least one statement must be an Allow, so the service rejects a configuration that has only Deny statements. The order of statements doesn’t change which records a caller receives. For how statements combine, see Which statements decide visibility. To hide every record on purpose, see Hide every record on purpose.

sid

Statement

No

A label of letters, digits, hyphens, and underscores, unique within the configuration. A sid identifies the statement for you and doesn’t affect evaluation.

effect

Statement

Yes

Exactly "Allow" or "Deny". A matching Allow statement lets the caller receive the record. A matching Deny statement hides the record, whatever any Allow statement grants. For an example, see Worked example.

principal

Statement

Yes

"*", which means every caller that the registry’s authorization admits, or an object of caller-field tests. The statement applies to a caller only when every test matches. It doesn’t name who receives a permission. It tests the attributes of a caller that is already authorized. For the caller fields of AWS Identity and Access Management (IAM) and JSON Web Token (JWT) registries, see IAM caller fields and JWT caller fields.

resource

Statement

Yes

"*", which means every approved record that the registry’s authorization admits, or an object of record-field tests. The statement matches a record only when every test matches. Record fields are attributes of a record’s approved revision, not resource ARNs or API actions. For the record fields, see Record fields.

For the maximum number of statements and the maximum sid length, see Record visibility configuration limits.

Document structure

The following configuration document shows where each part of a record visibility configuration goes. It’s valid for an IAM registry whose custom metadata schema declares department as a Text field. With this configuration, each caller with a department principal tag can discover the approved MCP records labeled with the same department.

{ "version": "1", "statements": [ { "sid": "DepartmentRecords", "effect": "Allow", "principal": { "iam:principalTag/department": { "Exists": true } }, "resource": { "recordType": { "StringEquals": "MCP" }, "customMetadata/department": { "StringEquals": { "ref": "iam:principalTag/department" } } } } ] }

The following table explains each part of the preceding configuration, from the document down to the operands.

Part In the example What it holds

Document and statement

"version" and "statements", then each statement’s "sid", "effect", "principal", and "resource"

The elements that Document elements defines.

Caller tests

"principal": { …​ }

Caller fields, each mapped to a field test. The fields must belong to the registry’s identity family. For details, see Field names and identity families.

Record tests

"resource": { …​ }

Record fields, each mapped to a field test. Each metadata field must be declared in the registry’s schema. For details, see Record fields.

Field test

{"Exists": true} and {"StringEquals": "MCP"}

An object of operators, each mapped to its operand. For details, see Condition operators.

Literal operand

"MCP"

A string, or a list of strings, that the field’s value is compared with. Bool and BoolIfExists take a JSON Boolean instead, and Exists takes true.

Caller-value reference

{"ref": "iam:principalTag/department"}

An operand that compares a record’s metadata field with the caller’s own value. For details, see Caller-value references.

The following rules apply to every statement:

  • The principal and resource elements are each "*" or an object with at least one field.

  • Tests are field-first. Each field maps to an object with at least one operator, and each operator maps to its operand. The service never infers an operator from the shape of an operand.

  • Each field appears once on a side. To apply several operators to one field, put them in the same field test, where they combine with AND.

  • The structure doesn’t make every operator legal on every field. For the combinations that validation accepts, see Combining operators and choosing claim cardinality.

Validation

AWS Agent Registry validates a record visibility configuration when you set it with CreateRegistry or UpdateRegistry. The following sections describe what validation checks, and how the service reports a configuration that fails.

What validation checks

Validation is synchronous and all or nothing. The service rejects an invalid configuration as a whole, and the registry’s configuration doesn’t change. It never ignores an invalid statement or truncates the document. If the same request also sets a custom metadata schema, the service validates the schema first. It then validates the configuration against that schema.

The following table lists the checks, and where each rule is described.

Check What the service checks Details

Decoding

Strict JSON, document size, nesting depth, no duplicate members, and well-formed Unicode

Configuration document format

Structure

Required elements, no unknown members, element values, and field-name syntax

Document elements

Operators and operands

The eight supported operators, operand shapes, and allowed combinations on one field. In an Allow, a negated test on a caller field that can be absent must include Exists.

Condition operators

Claim cardinality

Each JWT claim is tested as a single value or as a set throughout the configuration.

Combining operators and choosing claim cardinality

Literal formats

Values for recordType, name, recordId, account IDs, organization IDs, and principal ARNs

Record fields and IAM caller fields

Identity family

Every caller field and reference target matches the registry’s authorizer type.

Field names and identity families

Uniqueness

sid values are unique, and no two IAM tag keys in the configuration differ only in case.

iam:principalTag/<key>

Metadata fields

Every metadata field is declared in the registry’s schema, with a type that suits its operators.

customMetadata/<key>

Limits

The document size and the count limits

Counting configuration limits

Validation checks how a configuration is written, not what it matches. It doesn’t check the following:

  • Whether any caller has the IAM tag or JWT claim that the configuration names

  • Whether any record carries a literal value, or whether the value is one of an Enum field’s allowed values

  • Whether a recordId belongs to an existing record

Validation rejects an undeclared metadata field. However, a misspelled but well-formed tag key, claim name, or value can pass validation. Such a typo can change which records a statement grants or hides. For more information, see Exact comparisons and author-supplied names.

Note

Validation doesn’t simulate which records a caller discovers. Test each configuration with real callers against approved records whose labels you know. For instructions, see Test a configuration.

Validation errors and paths

When a configuration fails validation, CreateRegistry or UpdateRegistry returns a ValidationException. Its message lists the violations that the service found. Fix the reported violations and submit the document again. More violations can appear. The message has the following shape:

recordVisibilityConfiguration is invalid: <code> at <path>: <message>

For example, the following message reports a metadata key that no schema in the registry declares.

recordVisibilityConfiguration is invalid: METADATA_KEY_UNDECLARED at /statements/0/resource/customMetadata~1department: No schema of the registry declares the metadata key.

Each violation has the following parts:

  • Code – A short identifier for the kind of problem. The codes aren’t a published contract, so don’t build error handling that matches on them.

  • Path – The location of the problem, in the configuration document rather than the API request that carries it. The location identifies the affected field, or the whole configuration document. In the example, the path points to the customMetadata/department test in the resource of the first statement.

  • Message – What’s wrong. In the example, the service rejects the undeclared key rather than treating it as absent. To fix the problem, declare department in the registry’s schema, or correct the key name.

Don’t put sensitive information in conditions

Conditions in the configuration document are access-control settings, not protected customer content. A path names the rejected member, so it can contain a tag key, claim name, or metadata key. AWS CloudTrail records the error message. As a result, these names can appear in CloudTrail events, even though CloudTrail redacts the configuration document. The message never echoes a condition value. Don’t put secrets or sensitive information in condition values or in the names that a configuration tests. For more information, see Data protection in AWS Agent Registry.

For errors that come from the request rather than the configuration document, such as a revision conflict, see Add or replace a configuration, Avoid overwriting concurrent changes, and Recover from a failed update.

Counting configuration limits

The numeric limits are listed in Record visibility configuration limits. The service checks each of the following counts when you set the configuration. The following table explains what each limit counts.

Limit What counts

Document size

The UTF-8 bytes of the configuration as you submit it, including whitespace

Nesting depth

Levels of nested objects and arrays. The document’s top-level object is level 1.

Statements

Each entry in statements, Allow and Deny alike

Fields per principal or resource

The fields in one principal object or one resource object, counted separately for each object

Values per literal list

The strings in one operand list, counted before the service removes duplicates. A duplicate doesn’t change matching, but it uses an entry.

Resource conditions

Each operator entry in every resource object, across all statements of both effects. A reference counts as one entry.

Reference occurrences

Each ref operand in the configuration, including repeated references to the same caller field

sid length

The characters in one sid

For example, Exists, StringEquals, and StringNotEquals on one record field count as three resource conditions. Tests in principal don’t count toward that limit.

The service also limits the distinct caller values per reference, but it counts them on each discovery request, not when you set the configuration. For how that count works, see Reference limits and overflow.

Topics