Function: createIam()
createIam(
config):object
Defined in: createIam.ts:32
One deployment's IAM: its names, catalog, conditions, validator and evaluator.
Parameters
| Parameter | Type |
|---|---|
config | IamConfig |
Returns
catalog
catalog:
object
catalog.actionForOperation
actionForOperation: (
operationId) =>string|undefined
Parameters
| Parameter | Type |
|---|---|
operationId | string |
Returns
string | undefined
catalog.actionsMatching
actionsMatching: (
pattern) =>string[] |null
The listed actions pattern reaches; null when its module is not listed.
Parameters
| Parameter | Type |
|---|---|
pattern | string |
Returns
string[] | null
catalog.conditionKeysOf
conditionKeysOf: (
action) =>ReadonlySet<string>
The action keys action supplies to a condition; empty when it declares none.
Parameters
| Parameter | Type |
|---|---|
action | string |
Returns
ReadonlySet<string>
catalog.describeAction
describeAction: (
action) =>CatalogAction|undefined
Parameters
| Parameter | Type |
|---|---|
action | string |
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
| Parameter | Type |
|---|---|
action | string |
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
| Parameter | Type |
|---|---|
check | { action: string; list: ListedRows; policies: PolicySets; } |
check.action | string |
check.list | ListedRows |
check.policies | PolicySets |
Returns
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
| Parameter | Type |
|---|---|
args | { document: PolicyDocument; values: Record<string, string | null | undefined>; } |
args.document | PolicyDocument |
args.values | Record<string, string | null | undefined> |
Returns
conditions.evaluateCondition
evaluateCondition: (
args) =>boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { condition: Condition; context: Record<string, string>; effect: Effect; } | - |
args.condition | Condition | - |
args.context | Record<string, string> | - |
args.effect | Effect | The 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
| Parameter | Type |
|---|---|
key | string |
Returns
boolean
conditions.isPlatformConditionKey
isPlatformConditionKey: (
key) =>boolean
Whether key is one the namespace supplies to every check that has it.
Parameters
| Parameter | Type |
|---|---|
key | string |
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
| Parameter | Type |
|---|---|
args | { keys: readonly string[]; sets: PolicySets; } |
args.keys | readonly string[] |
args.sets | PolicySets |
Returns
boolean
conditions.requestTagKey
requestTagKey: (
tag) =>string
Parameters
| Parameter | Type |
|---|---|
tag | string |
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
| Parameter | Type |
|---|---|
tag | string |
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
| Parameter | Type |
|---|---|
value | string |
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
| 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
evaluator
evaluator:
object
evaluator.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
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
| 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
evaluator.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
evaluator.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
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
| Parameter | Type |
|---|---|
check | { action: string; chain: ResourceChain | null; context?: Record<string, string>; groups: LabeledPolicySets<Principal>; } |
check.action | string |
check.chain | ResourceChain | null |
check.context? | Record<string, string> |
check.groups | LabeledPolicySets<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
| Parameter | Type |
|---|---|
value | string |
Returns
string[]
names.buildName
buildName: (
args) =>string
Builds a name from its containment chain, root first.
Parameters
| Parameter | Type |
|---|---|
args | { steps: NameStep[]; } |
args.steps | NameStep[] |
Returns
string
names.buildPathAlias
buildPathAlias: (
args) =>string
Builds a path alias from raw (unencoded) path segments.
Parameters
| Parameter | Type |
|---|---|
args | { rootId: string; segments: string[]; } |
args.rootId | string |
args.segments | string[] |
Returns
string
names.isPathAliasPattern
isPathAliasPattern: (
args) =>boolean
Whether pattern names path aliases: it names the path node.
Parameters
| Parameter | Type |
|---|---|
args | { pattern: string; } |
args.pattern | string |
Returns
boolean
names.leafType
leafType: (
parsed) =>string
The leaf's type: the last step's, path for an alias.
Parameters
| Parameter | Type |
|---|---|
parsed | ParsedName |
Returns
string
names.matchPattern
matchPattern: (
args) =>boolean
True when pattern matches name or any of its ancestors.
Parameters
| Parameter | Type |
|---|---|
args | { name: string; pattern: string; } |
args.name | string |
args.pattern | string |
Returns
boolean
names.parseName
parseName: (
value) =>NameResult<ParsedName>
Parses a name or a path alias; never a pattern.
Parameters
| Parameter | Type |
|---|---|
value | string |
Returns
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
| Parameter | Type |
|---|---|
args | { inner: string; outer: string; } |
args.inner | string |
args.outer | string |
Returns
boolean
names.patternError
patternError: (
pattern) =>string|null
Validates a resource pattern; null when it is well formed.
Parameters
| Parameter | Type |
|---|---|
pattern | string |
Returns
string | null
names.patternKinds
patternKinds: (
pattern) =>SegmentKind[]
The kind of each segment of a well-formed pattern, aligned with splitPattern.
Parameters
| Parameter | Type |
|---|---|
pattern | string |
Returns
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
| Parameter | Type |
|---|---|
args | { pattern: string; } |
args.pattern | string |
Returns
string
names.patternsOverlap
patternsOverlap: (
args) =>boolean
True when some name is reached by both patterns.
Parameters
| Parameter | Type |
|---|---|
args | { a: string; b: string; } |
args.a | string |
args.b | string |
Returns
boolean
names.patternTypes
patternTypes: (
pattern) =>string[]
The types a well-formed pattern names literally, for a registry to check.
Parameters
| Parameter | Type |
|---|---|
pattern | string |
Returns
string[]
names.prefix
prefix:
string=config.prefix
names.splitPattern
splitPattern: (
pattern) =>string[]
A well-formed pattern's segments, ** among them.
Parameters
| Parameter | Type |
|---|---|
pattern | string |
Returns
string[]
policyGroupsAllow
policyGroupsAllow: <
Principal>(check) =>boolean
Whether groups allow the check, without recording a refusal.
Type Parameters
| Type Parameter |
|---|
Principal |
Parameters
| Parameter | Type |
|---|---|
check | { action: string; chain: ResourceChain | null; context?: Record<string, string>; groups: LabeledPolicySets<Principal>; } |
check.action | string |
check.chain | ResourceChain | null |
check.context? | Record<string, string> |
check.groups | LabeledPolicySets<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
| Parameter | Type |
|---|---|
doc | unknown |
options | { allowResourceForm?: string; } |
options.allowResourceForm? | string |