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
Conditionordescription, or a defined name in another case, such asEffect
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 |
|---|---|---|---|
|
|
Document |
Yes |
The JSON string |
|
|
Document |
Yes |
A nonempty array of statement objects. At least one statement must be an |
|
|
Statement |
No |
A label of letters, digits, hyphens, and underscores, unique within the configuration. A |
|
|
Statement |
Yes |
Exactly |
|
|
Statement |
Yes |
|
|
|
Statement |
Yes |
|
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 |
|
The elements that Document elements defines. |
|
Caller tests |
|
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 |
|
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 |
|
An object of operators, each mapped to its operand. For details, see Condition operators. |
|
Literal operand |
|
A string, or a list of strings, that the field’s value is compared with. |
|
Caller-value reference |
|
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
principalandresourceelements 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 |
|
|
Structure |
Required elements, no unknown members, element values, and field-name syntax |
|
|
Operators and operands |
The eight supported operators, operand shapes, and allowed combinations on one field. In an |
|
|
Claim cardinality |
Each JWT claim is tested as a single value or as a set throughout the configuration. |
|
|
Literal formats |
Values for |
|
|
Identity family |
Every caller field and reference target matches the registry’s authorizer type. |
|
|
Uniqueness |
|
|
|
Metadata fields |
Every metadata field is declared in the registry’s schema, with a type that suits its operators. |
|
|
Limits |
The document size and the count 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
recordIdbelongs 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.
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/departmenttest in theresourceof 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
departmentin the registry’s schema, or correct the key name.
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 |
|
Fields per |
The fields in one |
|
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 |
|
Reference occurrences |
Each |
|
|
The characters in one |
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.