Skip to main content

Function: createEvaluator()

createEvaluator(args): object

Defined in: evaluation.ts:124

Parameters​

ParameterTypeDescription
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) => PolicyDocumentdocument 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) => booleanWhether key is an action key (tasks:Transition): one only the actions declaring it supply, unlike the namespace's own family.
args.conditions.isPlatformConditionKey(key) => booleanWhether key is one the namespace supplies to every check that has it.
args.conditions.namespacestring-
args.conditions.namesRequestTag(args) => booleanWhether 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.requestTagKeyPrefixstringFollowed by a tag name: the value the request writes for that tag.
args.conditions.resourceTagKey(tag) => string-
args.conditions.resourceTagKeyPrefixstringFollowed by a tag name, verbatim.
args.conditions.resourceTypeKeystring-
args.conditions.unknownVariables(value) => string[]The variables value names that the namespace does not supply.
args.conditions.variablesstring[]-
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) => stringBuilds a name from its containment chain, root first.
args.names.buildPathAlias(args) => stringBuilds a path alias from raw (unencoded) path segments.
args.names.isPathAliasPattern(args) => booleanWhether pattern names path aliases: it names the path node.
args.names.leafType(parsed) => stringThe leaf's type: the last step's, path for an alias.
args.names.matchPattern(args) => booleanTrue 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.pathAliasRootTypestring | undefined-
args.names.patternCovers(args) => booleanTrue when every name inner reaches, outer reaches. Sound: true is never wrong.
args.names.patternError(pattern) => string | nullValidates 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) => stringThe 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) => booleanTrue 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.prefixstring-
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​

ParameterType
check{ action: string; chain: ResourceChain; pattern: string; }
check.actionstring
check.chainResourceChain
check.patternstring

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​

ParameterType
check{ action: string; chain: ResourceChain; context?: Record<string, string>; policies: readonly OwnedPolicy[]; }
check.actionstring
check.chainResourceChain
check.context?Record<string, string>
check.policiesreadonly OwnedPolicy[]

Returns​

PolicyDecision

ownerRoot​

ownerRoot: (owner) => string | null

The name an owner's reach is rooted at; null for top, which reaches everything.

Parameters​

ParameterType
ownerPolicyOwner

Returns​

string | null

withinReach​

withinReach: (check) => boolean

True when the resource sits within the owner's reach for action.

Parameters​

ParameterType
check{ action: string; chain: ResourceChain; owner: PolicyOwner; }
check.actionstring
check.chainResourceChain
check.ownerPolicyOwner

Returns​

boolean