Skip to main content

Function: createIam()

createIam(config): object

Defined in: createIam.ts:32

One deployment's IAM: its names, catalog, conditions, validator and evaluator.

Parameters​

ParameterType
configIamConfig

Returns​

catalog​

catalog: object

catalog.actionForOperation​

actionForOperation: (operationId) => string | undefined

Parameters​
ParameterType
operationIdstring
Returns​

string | undefined

catalog.actionsMatching​

actionsMatching: (pattern) => string[] | null

The listed actions pattern reaches; null when its module is not listed.

Parameters​
ParameterType
patternstring
Returns​

string[] | null

catalog.conditionKeysOf​

conditionKeysOf: (action) => ReadonlySet<string>

The action keys action supplies to a condition; empty when it declares none.

Parameters​
ParameterType
actionstring
Returns​

ReadonlySet<string>

catalog.describeAction​

describeAction: (action) => CatalogAction | undefined

Parameters​
ParameterType
actionstring
Returns​

CatalogAction | undefined

catalog.isKnownAction​

isKnownAction: (action) => boolean

True when action names an enforceable permission: *, module:* for a listed module, or a listed module:Operation.

Parameters​
ParameterType
actionstring
Returns​

boolean

catalog.listActionConditionKeys​

listActionConditionKeys: () => string[]

Every action key a listed action declares, sorted.

Returns​

string[]

catalog.listActions​

listActions: () => string[]

Returns​

string[]

catalog.listModules​

listModules: () => string[]

Returns​

string[]

compileRowFilter​

compileRowFilter: (check) => RowFilter

Parameters​

ParameterType
check{ action: string; list: ListedRows; policies: PolicySets; }
check.actionstring
check.listListedRows
check.policiesPolicySets

Returns​

RowFilter

conditions​

conditions: object

conditions.bindVariables​

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.

Parameters​
ParameterType
args{ document: PolicyDocument; values: Record<string, string | null | undefined>; }
args.documentPolicyDocument
args.valuesRecord<string, string | null | undefined>
Returns​

PolicyDocument

conditions.evaluateCondition​

evaluateCondition: (args) => boolean

Parameters​
ParameterTypeDescription
args{ condition: Condition; context: Record<string, string>; effect: Effect; }-
args.conditionCondition-
args.contextRecord<string, string>-
args.effectEffectThe statement's effect, which decides a condition on an absent key.
Returns​

boolean

conditions.isActionConditionKey​

isActionConditionKey: (key) => boolean

Whether key is an action key (tasks:Transition): one only the actions declaring it supply, unlike the namespace's own family.

Parameters​
ParameterType
keystring
Returns​

boolean

conditions.isPlatformConditionKey​

isPlatformConditionKey: (key) => boolean

Whether key is one the namespace supplies to every check that has it.

Parameters​
ParameterType
keystring
Returns​

boolean

conditions.namespace​

namespace: string

conditions.namesRequestTag​

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.

Parameters​
ParameterType
args{ keys: readonly string[]; sets: PolicySets; }
args.keysreadonly string[]
args.setsPolicySets
Returns​

boolean

conditions.requestTagKey​

requestTagKey: (tag) => string

Parameters​
ParameterType
tagstring
Returns​

string

conditions.requestTagKeyPrefix​

requestTagKeyPrefix: string

Followed by a tag name: the value the request writes for that tag.

conditions.resourceTagKey​

resourceTagKey: (tag) => string

Parameters​
ParameterType
tagstring
Returns​

string

conditions.resourceTagKeyPrefix​

resourceTagKeyPrefix: string

Followed by a tag name, verbatim.

conditions.resourceTypeKey​

resourceTypeKey: string

conditions.unknownVariables​

unknownVariables: (value) => string[]

The variables value names that the namespace does not supply.

Parameters​
ParameterType
valuestring
Returns​

string[]

conditions.variables​

variables: string[]

decideOnChain​

decideOnChain: (check) => PolicyDecision = evaluator.decideOnChain

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

evaluator​

evaluator: object

evaluator.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

evaluator.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

evaluator.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

evaluator.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

findRefusal​

findRefusal: <Principal>(check) => Refusal<Principal> | undefined

The first group refusing the check, with the denial of the Deny that decided it. A group holding no set allows nothing, as one holding an empty set; so does a check that names no resource.

Type Parameters​

Type Parameter
Principal

Parameters​

ParameterType
check{ action: string; chain: ResourceChain | null; context?: Record<string, string>; groups: LabeledPolicySets<Principal>; }
check.actionstring
check.chainResourceChain | null
check.context?Record<string, string>
check.groupsLabeledPolicySets<Principal>

Returns​

Refusal<Principal> | undefined

names​

names: object

names.ancestors​

ancestors: (value) => string[]

Every ancestor node of a name, itself first, the root last.

Parameters​
ParameterType
valuestring
Returns​

string[]

names.buildName​

buildName: (args) => string

Builds a name from its containment chain, root first.

Parameters​
ParameterType
args{ steps: NameStep[]; }
args.stepsNameStep[]
Returns​

string

names.buildPathAlias​

buildPathAlias: (args) => string

Builds a path alias from raw (unencoded) path segments.

Parameters​
ParameterType
args{ rootId: string; segments: string[]; }
args.rootIdstring
args.segmentsstring[]
Returns​

string

names.isPathAliasPattern​

isPathAliasPattern: (args) => boolean

Whether pattern names path aliases: it names the path node.

Parameters​
ParameterType
args{ pattern: string; }
args.patternstring
Returns​

boolean

names.leafType​

leafType: (parsed) => string

The leaf's type: the last step's, path for an alias.

Parameters​
ParameterType
parsedParsedName
Returns​

string

names.matchPattern​

matchPattern: (args) => boolean

True when pattern matches name or any of its ancestors.

Parameters​
ParameterType
args{ name: string; pattern: string; }
args.namestring
args.patternstring
Returns​

boolean

names.parseName​

parseName: (value) => NameResult<ParsedName>

Parses a name or a path alias; never a pattern.

Parameters​
ParameterType
valuestring
Returns​

NameResult<ParsedName>

names.pathAliasRootType​

pathAliasRootType: string | undefined = config.pathAliasRootType

names.patternCovers​

patternCovers: (args) => boolean

True when every name inner reaches, outer reaches. Sound: true is never wrong.

Parameters​
ParameterType
args{ inner: string; outer: string; }
args.innerstring
args.outerstring
Returns​

boolean

names.patternError​

patternError: (pattern) => string | null

Validates a resource pattern; null when it is well formed.

Parameters​
ParameterType
patternstring
Returns​

string | null

names.patternKinds​

patternKinds: (pattern) => SegmentKind[]

The kind of each segment of a well-formed pattern, aligned with splitPattern.

Parameters​
ParameterType
patternstring
Returns​

SegmentKind[]

names.patternRegex​

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.

Parameters​
ParameterType
args{ pattern: string; }
args.patternstring
Returns​

string

names.patternsOverlap​

patternsOverlap: (args) => boolean

True when some name is reached by both patterns.

Parameters​
ParameterType
args{ a: string; b: string; }
args.astring
args.bstring
Returns​

boolean

names.patternTypes​

patternTypes: (pattern) => string[]

The types a well-formed pattern names literally, for a registry to check.

Parameters​
ParameterType
patternstring
Returns​

string[]

names.prefix​

prefix: string = config.prefix

names.splitPattern​

splitPattern: (pattern) => string[]

A well-formed pattern's segments, ** among them.

Parameters​
ParameterType
patternstring
Returns​

string[]

policyGroupsAllow​

policyGroupsAllow: <Principal>(check) => boolean

Whether groups allow the check, without recording a refusal.

Type Parameters​

Type Parameter
Principal

Parameters​

ParameterType
check{ action: string; chain: ResourceChain | null; context?: Record<string, string>; groups: LabeledPolicySets<Principal>; }
check.actionstring
check.chainResourceChain | null
check.context?Record<string, string>
check.groupsLabeledPolicySets<Principal>

Returns​

boolean

validatePolicyDocument​

validatePolicyDocument: (doc, options) => ValidationResult<PolicyDocument>

Structure and meaning of a document: shapes, known actions, well-formed patterns of known types, supplied condition keys, declared denials. allowResourceForm is what a refused Allow resource is told to be, for a policy whose Allow accepts less than *.

Parameters​

ParameterType
docunknown
options{ allowResourceForm?: string; }
options.allowResourceForm?string

Returns​

ValidationResult<PolicyDocument>