Function: createEvaluator()
createEvaluator(
args):object
Defined in: evaluation.ts:124
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { conditions: { bindVariables: (args) => PolicyDocument; evaluateCondition: (args) => boolean; isActionConditionKey: (key) => boolean; isPlatformConditionKey: (key) => boolean; namespace: string; namesRequestTag: (args) => boolean; requestTagKey: (tag) => string; requestTagKeyPrefix: string; resourceTagKey: (tag) => string; resourceTagKeyPrefix: string; resourceTypeKey: string; unknownVariables: (value) => string[]; variables: string[]; }; names: { ancestors: (value) => string[]; buildName: (args) => string; buildPathAlias: (args) => string; isPathAliasPattern: (args) => boolean; leafType: (parsed) => string; matchPattern: (args) => boolean; parseName: (value) => NameResult<ParsedName>; pathAliasRootType: string | undefined; patternCovers: (args) => boolean; patternError: (pattern) => string | null; patternKinds: (pattern) => SegmentKind[]; patternRegex: (args) => string; patternsOverlap: (args) => boolean; patternTypes: (pattern) => string[]; prefix: string; splitPattern: (pattern) => string[]; }; } | - |
args.conditions | { bindVariables: (args) => PolicyDocument; evaluateCondition: (args) => boolean; isActionConditionKey: (key) => boolean; isPlatformConditionKey: (key) => boolean; namespace: string; namesRequestTag: (args) => boolean; requestTagKey: (tag) => string; requestTagKeyPrefix: string; resourceTagKey: (tag) => string; resourceTagKeyPrefix: string; resourceTypeKey: string; unknownVariables: (value) => string[]; variables: string[]; } | - |
args.conditions.bindVariables | (args) => PolicyDocument | document with each ${variable} of values replaced; a null or absent value leaves it unbound, so a Deny naming it applies and an Allow grants nothing. |
args.conditions.evaluateCondition | (args) => boolean | - |
args.conditions.isActionConditionKey | (key) => boolean | Whether key is an action key (tasks:Transition): one only the actions declaring it supply, unlike the namespace's own family. |
args.conditions.isPlatformConditionKey | (key) => boolean | Whether key is one the namespace supplies to every check that has it. |
args.conditions.namespace | string | - |
args.conditions.namesRequestTag | (args) => boolean | Whether a statement in sets conditions on a request tag for one of keys: asked before authorizing a write whose value for such a key is not known yet, which no evaluation can answer. |
args.conditions.requestTagKey | (tag) => string | - |
args.conditions.requestTagKeyPrefix | string | Followed by a tag name: the value the request writes for that tag. |
args.conditions.resourceTagKey | (tag) => string | - |
args.conditions.resourceTagKeyPrefix | string | Followed by a tag name, verbatim. |
args.conditions.resourceTypeKey | string | - |
args.conditions.unknownVariables | (value) => string[] | The variables value names that the namespace does not supply. |
args.conditions.variables | string[] | - |
args.names | { ancestors: (value) => string[]; buildName: (args) => string; buildPathAlias: (args) => string; isPathAliasPattern: (args) => boolean; leafType: (parsed) => string; matchPattern: (args) => boolean; parseName: (value) => NameResult<ParsedName>; pathAliasRootType: string | undefined; patternCovers: (args) => boolean; patternError: (pattern) => string | null; patternKinds: (pattern) => SegmentKind[]; patternRegex: (args) => string; patternsOverlap: (args) => boolean; patternTypes: (pattern) => string[]; prefix: string; splitPattern: (pattern) => string[]; } | - |
args.names.ancestors | (value) => string[] | Every ancestor node of a name, itself first, the root last. |
args.names.buildName | (args) => string | Builds a name from its containment chain, root first. |
args.names.buildPathAlias | (args) => string | Builds a path alias from raw (unencoded) path segments. |
args.names.isPathAliasPattern | (args) => boolean | Whether pattern names path aliases: it names the path node. |
args.names.leafType | (parsed) => string | The leaf's type: the last step's, path for an alias. |
args.names.matchPattern | (args) => boolean | True when pattern matches name or any of its ancestors. |
args.names.parseName | (value) => NameResult<ParsedName> | Parses a name or a path alias; never a pattern. |
args.names.pathAliasRootType | string | undefined | - |
args.names.patternCovers | (args) => boolean | True when every name inner reaches, outer reaches. Sound: true is never wrong. |
args.names.patternError | (pattern) => string | null | Validates a resource pattern; null when it is well formed. |
args.names.patternKinds | (pattern) => SegmentKind[] | The kind of each segment of a well-formed pattern, aligned with splitPattern. |
args.names.patternRegex | (args) => string | The regular expression matching exactly the names matchPattern says pattern reaches, for a store that filters rows by it; JavaScript and PostgreSQL (~) read it alike. |
args.names.patternsOverlap | (args) => boolean | True when some name is reached by both patterns. |
args.names.patternTypes | (pattern) => string[] | The types a well-formed pattern names literally, for a registry to check. |
args.names.prefix | string | - |
args.names.splitPattern | (pattern) => string[] | A well-formed pattern's segments, ** among them. |
Returns
chainMatches
chainMatches: (
check) =>boolean
True when pattern reaches the resource for action.
Parameters
| Parameter | Type |
|---|---|
check | { action: string; chain: ResourceChain; pattern: string; } |
check.action | string |
check.chain | ResourceChain |
check.pattern | string |
Returns
boolean
decideOnChain
decideOnChain: (
check) =>PolicyDecision
Every tagged node's evaluation must allow; the first refusal decides. A path alias names a place, not a type, so a chain named by one alone states its type or is refused.
Parameters
| Parameter | Type |
|---|---|
check | { action: string; chain: ResourceChain; context?: Record<string, string>; policies: readonly OwnedPolicy[]; } |
check.action | string |
check.chain | ResourceChain |
check.context? | Record<string, string> |
check.policies | readonly OwnedPolicy[] |
Returns
ownerRoot
ownerRoot: (
owner) =>string|null
The name an owner's reach is rooted at; null for top, which reaches everything.
Parameters
| Parameter | Type |
|---|---|
owner | PolicyOwner |
Returns
string | null
withinReach
withinReach: (
check) =>boolean
True when the resource sits within the owner's reach for action.
Parameters
| Parameter | Type |
|---|---|
check | { action: string; chain: ResourceChain; owner: PolicyOwner; } |
check.action | string |
check.chain | ResourceChain |
check.owner | PolicyOwner |
Returns
boolean