@kensio/yulin 1.21.13 → 1.21.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-attributes.d.ts +27 -0
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-attributes.js +35 -0
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-authorizer.d.ts +2 -1
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-authorizer.js +5 -18
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-reached.d.ts +17 -0
- package/dist/service/dynamodb/command/authorize/sim-dynamodb-reached.js +11 -0
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-get-item.js +4 -1
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-read-limit.d.ts +6 -0
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-read-limit.js +16 -0
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-reads.d.ts +2 -0
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-reads.js +14 -22
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-tables.d.ts +5 -5
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-tables.js +1 -1
- package/dist/service/dynamodb/command/batch/sim-dynamodb-batch-write-item.js +5 -1
- package/dist/service/dynamodb/command/item/sim-dynamodb-condition-check.d.ts +5 -1
- package/dist/service/dynamodb/command/item/sim-dynamodb-condition-check.js +9 -2
- package/dist/service/dynamodb/command/item/sim-dynamodb-delete-item.js +7 -1
- package/dist/service/dynamodb/command/item/sim-dynamodb-get-item.js +9 -2
- package/dist/service/dynamodb/command/item/sim-dynamodb-put-item.js +5 -1
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-expressions.d.ts +2 -0
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-expressions.js +1 -1
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-item.js +7 -1
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-plan.d.ts +8 -6
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-plan.js +14 -13
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-touched.d.ts +10 -0
- package/dist/service/dynamodb/command/item/sim-dynamodb-update-touched.js +16 -0
- package/dist/service/dynamodb/command/query/sim-dynamodb-query-expressions.d.ts +2 -0
- package/dist/service/dynamodb/command/query/sim-dynamodb-query-expressions.js +6 -1
- package/dist/service/dynamodb/command/query/sim-dynamodb-query.js +5 -2
- package/dist/service/dynamodb/command/scan/sim-dynamodb-scan-expressions.d.ts +2 -0
- package/dist/service/dynamodb/command/scan/sim-dynamodb-scan-expressions.js +2 -2
- package/dist/service/dynamodb/command/scan/sim-dynamodb-scan.js +1 -1
- package/dist/service/dynamodb/command/table/sim-dynamodb-table-access.d.ts +3 -3
- package/dist/service/dynamodb/command/table/sim-dynamodb-table-access.js +5 -21
- package/dist/service/dynamodb/command/table/sim-dynamodb-table-reach.d.ts +25 -0
- package/dist/service/dynamodb/command/table/sim-dynamodb-table-reach.js +27 -0
- package/dist/service/dynamodb/command/transact/sim-dynamodb-transact-gets.js +1 -1
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-expression.d.ts +9 -1
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-expression.js +2 -2
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-grammar.js +1 -1
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-operand-parser.d.ts +3 -2
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-operand-parser.js +3 -3
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-parser.d.ts +2 -1
- package/dist/service/dynamodb/expression/condition/sim-dynamodb-condition-parser.js +1 -1
- package/dist/service/dynamodb/expression/key-condition/sim-dynamodb-key-condition-expression.js +1 -1
- package/dist/service/dynamodb/expression/key-condition/sim-dynamodb-key-condition-operands.d.ts +3 -2
- package/dist/service/dynamodb/expression/key-condition/sim-dynamodb-key-condition-operands.js +8 -6
- package/dist/service/dynamodb/expression/key-condition/sim-dynamodb-key-condition-parser.d.ts +2 -1
- package/dist/service/dynamodb/expression/key-condition/sim-dynamodb-key-condition-parser.js +1 -1
- package/dist/service/dynamodb/expression/projection/sim-dynamodb-projection-expression.d.ts +9 -1
- package/dist/service/dynamodb/expression/projection/sim-dynamodb-projection-expression.js +5 -5
- package/dist/service/dynamodb/expression/sim-dynamodb-document-path-parser.d.ts +3 -3
- package/dist/service/dynamodb/expression/sim-dynamodb-document-path-parser.js +8 -4
- package/dist/service/dynamodb/expression/sim-dynamodb-expression-attributes.d.ts +33 -0
- package/dist/service/dynamodb/expression/sim-dynamodb-expression-attributes.js +40 -0
- package/dist/service/dynamodb/expression/sim-dynamodb-expression-parameters.d.ts +6 -0
- package/dist/service/dynamodb/expression/sim-dynamodb-expression-parameters.js +7 -0
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-clause.d.ts +3 -3
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-clause.js +3 -3
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-expression.js +1 -1
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-operand-parser.d.ts +3 -2
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-operand-parser.js +3 -3
- package/dist/service/dynamodb/expression/update/sim-dynamodb-update-parser.d.ts +2 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-for-all-values-string-operator.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-for-all-values-string-operator.js +6 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-for-any-value-string-operator.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-for-any-value-string-operator.js +6 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-scalar-string-operator.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-scalar-string-operator.js +6 -1
- package/dist/service/iam/authorize/match/condition/null/sim-iam-null.d.ts +23 -0
- package/dist/service/iam/authorize/match/condition/null/sim-iam-null.js +59 -0
- package/dist/service/iam/authorize/match/condition/numeric/less-than-equals/sim-iam-number-lte.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/numeric/less-than-equals/sim-iam-number-lte.js +6 -1
- package/dist/service/iam/authorize/match/condition/sim-iam-condition-operator-parser.js +2 -0
- package/dist/service/iam/authorize/match/condition/sim-iam-condition-operator.d.ts +5 -1
- package/dist/service/iam/authorize/match/condition/sim-iam-policy-condition-matcher.js +1 -1
- package/dist/service/iam/authorize/match/condition/string/all-values/sim-iam-for-all-values-string-condition-operator.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/string/all-values/sim-iam-for-all-values-string-condition-operator.js +6 -1
- package/dist/service/iam/authorize/match/condition/string/any-value/sim-iam-for-any-value-string-condition-operator.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/string/any-value/sim-iam-for-any-value-string-condition-operator.js +6 -1
- package/dist/service/iam/authorize/match/condition/string/sim-iam-scalar-string-condition-operator.d.ts +4 -1
- package/dist/service/iam/authorize/match/condition/string/sim-iam-scalar-string-condition-operator.js +6 -1
- package/docs/services/dynamodb/README.md +23 -4
- package/docs/services/iam/README.md +17 -3
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SimDynamoDbExpressionAttributes } from "../sim-dynamodb-expression-attributes.js";
|
|
2
2
|
import type { SimDynamoDbExpressionTokens } from "../sim-dynamodb-expression-tokens.js";
|
|
3
3
|
import { SimDynamoDbUpdateTarget } from "./sim-dynamodb-update-target.js";
|
|
4
4
|
interface SimDynamoDbUpdateClausesProperties {
|
|
5
5
|
readonly tokens: SimDynamoDbExpressionTokens;
|
|
6
|
-
readonly
|
|
6
|
+
readonly attributes: SimDynamoDbExpressionAttributes;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* The clauses of an update expression, and the paths their actions write to.
|
|
@@ -14,7 +14,7 @@ interface SimDynamoDbUpdateClausesProperties {
|
|
|
14
14
|
*/
|
|
15
15
|
export declare class SimDynamoDbUpdateClauses {
|
|
16
16
|
private readonly tokens;
|
|
17
|
-
private readonly
|
|
17
|
+
private readonly attributes;
|
|
18
18
|
private readonly read;
|
|
19
19
|
constructor(properties: SimDynamoDbUpdateClausesProperties);
|
|
20
20
|
/**
|
|
@@ -19,11 +19,11 @@ const clauseWords = new Set([
|
|
|
19
19
|
*/
|
|
20
20
|
export class SimDynamoDbUpdateClauses {
|
|
21
21
|
tokens;
|
|
22
|
-
|
|
22
|
+
attributes;
|
|
23
23
|
read = new Set();
|
|
24
24
|
constructor(properties) {
|
|
25
25
|
this.tokens = properties.tokens;
|
|
26
|
-
this.
|
|
26
|
+
this.attributes = properties.attributes;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Read the keyword the next clause starts with, refusing one already used.
|
|
@@ -47,7 +47,7 @@ export class SimDynamoDbUpdateClauses {
|
|
|
47
47
|
target() {
|
|
48
48
|
return new SimDynamoDbUpdateTarget(new SimDynamoDbDocumentPathParser({
|
|
49
49
|
tokens: this.tokens,
|
|
50
|
-
|
|
50
|
+
attributes: this.attributes,
|
|
51
51
|
}).parse());
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
@@ -13,7 +13,7 @@ import { SimDynamoDbUpdateParser } from "./sim-dynamodb-update-parser.js";
|
|
|
13
13
|
export function parseSimDynamoDbUpdate(expression, parameters) {
|
|
14
14
|
return new SimDynamoDbUpdateParser({
|
|
15
15
|
tokens: SimDynamoDbExpressionTokens.of(updateExpressionName, expression, "the expression says nothing, and an expression cannot be empty"),
|
|
16
|
-
|
|
16
|
+
attributes: parameters.attributes,
|
|
17
17
|
values: parameters.values,
|
|
18
18
|
}).parse();
|
|
19
19
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { SimDynamoDbValue } from "../../item/sim-dynamodb-value.js";
|
|
2
|
+
import type { SimDynamoDbExpressionAttributes } from "../sim-dynamodb-expression-attributes.js";
|
|
2
3
|
import type { SimDynamoDbExpressionPlaceholders } from "../sim-dynamodb-expression-placeholders.js";
|
|
3
4
|
import type { SimDynamoDbExpressionTokens } from "../sim-dynamodb-expression-tokens.js";
|
|
4
5
|
import { type SimDynamoDbUpdateOperand, SimDynamoDbUpdatePathOperand, SimDynamoDbUpdateValueOperand } from "./sim-dynamodb-update-operand.js";
|
|
5
6
|
interface SimDynamoDbUpdateOperandParserProperties {
|
|
6
7
|
readonly tokens: SimDynamoDbExpressionTokens;
|
|
7
|
-
readonly
|
|
8
|
+
readonly attributes: SimDynamoDbExpressionAttributes;
|
|
8
9
|
readonly values: SimDynamoDbExpressionPlaceholders<SimDynamoDbValue>;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
@@ -20,7 +21,7 @@ interface SimDynamoDbUpdateOperandParserProperties {
|
|
|
20
21
|
*/
|
|
21
22
|
export declare class SimDynamoDbUpdateOperandParser {
|
|
22
23
|
private readonly tokens;
|
|
23
|
-
private readonly
|
|
24
|
+
private readonly attributes;
|
|
24
25
|
private readonly values;
|
|
25
26
|
private readonly functions;
|
|
26
27
|
constructor(properties: SimDynamoDbUpdateOperandParserProperties);
|
|
@@ -20,12 +20,12 @@ const operators = new Set(["+", "-"]);
|
|
|
20
20
|
*/
|
|
21
21
|
export class SimDynamoDbUpdateOperandParser {
|
|
22
22
|
tokens;
|
|
23
|
-
|
|
23
|
+
attributes;
|
|
24
24
|
values;
|
|
25
25
|
functions;
|
|
26
26
|
constructor(properties) {
|
|
27
27
|
this.tokens = properties.tokens;
|
|
28
|
-
this.
|
|
28
|
+
this.attributes = properties.attributes;
|
|
29
29
|
this.values = properties.values;
|
|
30
30
|
this.functions = new SimDynamoDbUpdateFunctionParser({
|
|
31
31
|
tokens: properties.tokens,
|
|
@@ -80,7 +80,7 @@ export class SimDynamoDbUpdateOperandParser {
|
|
|
80
80
|
path() {
|
|
81
81
|
return new SimDynamoDbUpdatePathOperand(new SimDynamoDbDocumentPathParser({
|
|
82
82
|
tokens: this.tokens,
|
|
83
|
-
|
|
83
|
+
attributes: this.attributes,
|
|
84
84
|
}).parse());
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { SimDynamoDbValue } from "../../item/sim-dynamodb-value.js";
|
|
2
|
+
import type { SimDynamoDbExpressionAttributes } from "../sim-dynamodb-expression-attributes.js";
|
|
2
3
|
import type { SimDynamoDbExpressionPlaceholders } from "../sim-dynamodb-expression-placeholders.js";
|
|
3
4
|
import type { SimDynamoDbExpressionTokens } from "../sim-dynamodb-expression-tokens.js";
|
|
4
5
|
import { SimDynamoDbUpdate } from "./sim-dynamodb-update.js";
|
|
5
6
|
interface SimDynamoDbUpdateParserProperties {
|
|
6
7
|
readonly tokens: SimDynamoDbExpressionTokens;
|
|
7
|
-
readonly
|
|
8
|
+
readonly attributes: SimDynamoDbExpressionAttributes;
|
|
8
9
|
readonly values: SimDynamoDbExpressionPlaceholders<SimDynamoDbValue>;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
@@ -11,8 +11,11 @@ import type { SimIamStringComparison } from "../sim-iam-string-comparison.js";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class SimIamNegatedForAllValuesStringOperator implements SimIamConditionOperator {
|
|
13
13
|
private readonly comparison;
|
|
14
|
-
readonly matchesAbsentKey = true;
|
|
15
14
|
constructor(comparison: SimIamStringComparison);
|
|
15
|
+
/**
|
|
16
|
+
* Answer for a request carrying no value for the key.
|
|
17
|
+
*/
|
|
18
|
+
matchesAbsentKey(): boolean;
|
|
16
19
|
/**
|
|
17
20
|
* Check whether every request value differs from every policy value.
|
|
18
21
|
*/
|
|
@@ -9,10 +9,15 @@ import { simIamStringValues } from "../string/sim-iam-string-values.js";
|
|
|
9
9
|
*/
|
|
10
10
|
export class SimIamNegatedForAllValuesStringOperator {
|
|
11
11
|
comparison;
|
|
12
|
-
matchesAbsentKey = true;
|
|
13
12
|
constructor(comparison) {
|
|
14
13
|
this.comparison = comparison;
|
|
15
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Answer for a request carrying no value for the key.
|
|
17
|
+
*/
|
|
18
|
+
matchesAbsentKey() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
16
21
|
/**
|
|
17
22
|
* Check whether every request value differs from every policy value.
|
|
18
23
|
*/
|
|
@@ -12,8 +12,11 @@ import type { SimIamStringComparison } from "../sim-iam-string-comparison.js";
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class SimIamNegatedForAnyValueStringOperator implements SimIamConditionOperator {
|
|
14
14
|
private readonly comparison;
|
|
15
|
-
readonly matchesAbsentKey = false;
|
|
16
15
|
constructor(comparison: SimIamStringComparison);
|
|
16
|
+
/**
|
|
17
|
+
* Answer for a request carrying no value for the key.
|
|
18
|
+
*/
|
|
19
|
+
matchesAbsentKey(): boolean;
|
|
17
20
|
/**
|
|
18
21
|
* Check whether any request value differs from every policy value.
|
|
19
22
|
*/
|
|
@@ -10,10 +10,15 @@ import { simIamStringValues } from "../string/sim-iam-string-values.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export class SimIamNegatedForAnyValueStringOperator {
|
|
12
12
|
comparison;
|
|
13
|
-
matchesAbsentKey = false;
|
|
14
13
|
constructor(comparison) {
|
|
15
14
|
this.comparison = comparison;
|
|
16
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Answer for a request carrying no value for the key.
|
|
18
|
+
*/
|
|
19
|
+
matchesAbsentKey() {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
17
22
|
/**
|
|
18
23
|
* Check whether any request value differs from every policy value.
|
|
19
24
|
*/
|
|
@@ -11,8 +11,11 @@ import type { SimIamStringComparison } from "../sim-iam-string-comparison.js";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class SimIamNegatedScalarStringOperator implements SimIamConditionOperator {
|
|
13
13
|
private readonly comparison;
|
|
14
|
-
readonly matchesAbsentKey = true;
|
|
15
14
|
constructor(comparison: SimIamStringComparison);
|
|
15
|
+
/**
|
|
16
|
+
* Answer for a request carrying no value for the key.
|
|
17
|
+
*/
|
|
18
|
+
matchesAbsentKey(): boolean;
|
|
16
19
|
/**
|
|
17
20
|
* Check whether a request value differs from every policy value.
|
|
18
21
|
*/
|
package/dist/service/iam/authorize/match/condition/negated/sim-iam-negated-scalar-string-operator.js
CHANGED
|
@@ -9,10 +9,15 @@ import { simIamStringValues } from "../string/sim-iam-string-values.js";
|
|
|
9
9
|
*/
|
|
10
10
|
export class SimIamNegatedScalarStringOperator {
|
|
11
11
|
comparison;
|
|
12
|
-
matchesAbsentKey = true;
|
|
13
12
|
constructor(comparison) {
|
|
14
13
|
this.comparison = comparison;
|
|
15
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Answer for a request carrying no value for the key.
|
|
17
|
+
*/
|
|
18
|
+
matchesAbsentKey() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
16
21
|
/**
|
|
17
22
|
* Check whether a request value differs from every policy value.
|
|
18
23
|
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SimIamConditionValue } from "../../../../policy/sim-iam-policy.js";
|
|
2
|
+
import type { SimIamConditionOperator } from "../sim-iam-condition-operator.js";
|
|
3
|
+
/**
|
|
4
|
+
* IAM `Null` condition operator.
|
|
5
|
+
*
|
|
6
|
+
* `Null` checks whether the request carries a value for a context key, rather
|
|
7
|
+
* than comparing one. `"true"` matches where the key is absent and `"false"`
|
|
8
|
+
* where it is present. AWS names it and the `...IfExists` suffix as the two
|
|
9
|
+
* exceptions to the rule that an absent key fails a condition.
|
|
10
|
+
*
|
|
11
|
+
* It is what guards a `ForAllValues` `Allow`, which matches an absent key on
|
|
12
|
+
* its own. See `SimIamForAllValuesStringConditionOperator`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SimIamNull implements SimIamConditionOperator {
|
|
15
|
+
/**
|
|
16
|
+
* Answer for a request carrying no value for the key.
|
|
17
|
+
*/
|
|
18
|
+
matchesAbsentKey(expected: SimIamConditionValue): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Answer for a request carrying a value for the key.
|
|
21
|
+
*/
|
|
22
|
+
matches(actual: SimIamConditionValue, expected: SimIamConditionValue): boolean;
|
|
23
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the policy value of a `Null` condition.
|
|
3
|
+
*
|
|
4
|
+
* AWS documents `"true"` and `"false"` as strings, which is the form a policy
|
|
5
|
+
* document and the CDK both write. The condition value type also admits a JSON
|
|
6
|
+
* boolean, and a policy written that way means the same thing. Anything else
|
|
7
|
+
* has no meaning here and leaves the condition matching nothing.
|
|
8
|
+
*/
|
|
9
|
+
function expectsAbsentKey(expected) {
|
|
10
|
+
if (typeof expected === "boolean") {
|
|
11
|
+
return expected;
|
|
12
|
+
}
|
|
13
|
+
if (expected === "true") {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return expected === "false" ? false : undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Whether a request value counts as present for a `Null` check.
|
|
20
|
+
*
|
|
21
|
+
* AWS asks whether the key exists and its value is not null. A multi-valued key
|
|
22
|
+
* carrying no values resolves to a null dataset, and an empty string is the
|
|
23
|
+
* example AWS gives of one.
|
|
24
|
+
*/
|
|
25
|
+
function isPresent(actual) {
|
|
26
|
+
if (Array.isArray(actual)) {
|
|
27
|
+
return actual.length > 0;
|
|
28
|
+
}
|
|
29
|
+
return actual !== "";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* IAM `Null` condition operator.
|
|
33
|
+
*
|
|
34
|
+
* `Null` checks whether the request carries a value for a context key, rather
|
|
35
|
+
* than comparing one. `"true"` matches where the key is absent and `"false"`
|
|
36
|
+
* where it is present. AWS names it and the `...IfExists` suffix as the two
|
|
37
|
+
* exceptions to the rule that an absent key fails a condition.
|
|
38
|
+
*
|
|
39
|
+
* It is what guards a `ForAllValues` `Allow`, which matches an absent key on
|
|
40
|
+
* its own. See `SimIamForAllValuesStringConditionOperator`.
|
|
41
|
+
*/
|
|
42
|
+
export class SimIamNull {
|
|
43
|
+
/**
|
|
44
|
+
* Answer for a request carrying no value for the key.
|
|
45
|
+
*/
|
|
46
|
+
matchesAbsentKey(expected) {
|
|
47
|
+
return expectsAbsentKey(expected) === true;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Answer for a request carrying a value for the key.
|
|
51
|
+
*/
|
|
52
|
+
matches(actual, expected) {
|
|
53
|
+
const absentExpected = expectsAbsentKey(expected);
|
|
54
|
+
if (absentExpected === undefined) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return absentExpected !== isPresent(actual);
|
|
58
|
+
}
|
|
59
|
+
}
|
package/dist/service/iam/authorize/match/condition/numeric/less-than-equals/sim-iam-number-lte.d.ts
CHANGED
|
@@ -15,7 +15,10 @@ import type { SimIamConditionOperator } from "../../sim-iam-condition-operator.j
|
|
|
15
15
|
* are rejected rather than being converted through JavaScript coercion rules.
|
|
16
16
|
*/
|
|
17
17
|
export declare class SimIamNumericLessThanEquals implements SimIamConditionOperator {
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Answer for a request carrying no value for the key.
|
|
20
|
+
*/
|
|
21
|
+
matchesAbsentKey(): boolean;
|
|
19
22
|
/**
|
|
20
23
|
* Compare one request value with one or more policy limits.
|
|
21
24
|
*/
|
package/dist/service/iam/authorize/match/condition/numeric/less-than-equals/sim-iam-number-lte.js
CHANGED
|
@@ -13,7 +13,12 @@
|
|
|
13
13
|
* are rejected rather than being converted through JavaScript coercion rules.
|
|
14
14
|
*/
|
|
15
15
|
export class SimIamNumericLessThanEquals {
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Answer for a request carrying no value for the key.
|
|
18
|
+
*/
|
|
19
|
+
matchesAbsentKey() {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
17
22
|
/**
|
|
18
23
|
* Compare one request value with one or more policy limits.
|
|
19
24
|
*/
|
|
@@ -8,6 +8,7 @@ import { SimIamStringLike } from "./string/like/sim-iam-string-like.js";
|
|
|
8
8
|
import { SimIamNumericLessThanEquals } from "./numeric/less-than-equals/sim-iam-number-lte.js";
|
|
9
9
|
import { SimIamArnEquals } from "./arn/equals/sim-iam-arn-equals.js";
|
|
10
10
|
import { SimIamArnLike } from "./arn/like/sim-iam-arn-like.js";
|
|
11
|
+
import { SimIamNull } from "./null/sim-iam-null.js";
|
|
11
12
|
const operatorFactories = new Map([
|
|
12
13
|
["ArnEquals", () => new SimIamArnEquals()],
|
|
13
14
|
["ArnLike", () => new SimIamArnLike()],
|
|
@@ -17,6 +18,7 @@ const operatorFactories = new Map([
|
|
|
17
18
|
],
|
|
18
19
|
["StringEquals", () => new SimIamStringEquals()],
|
|
19
20
|
["StringLike", () => new SimIamStringLike()],
|
|
21
|
+
["Null", () => new SimIamNull()],
|
|
20
22
|
[
|
|
21
23
|
"ForAnyValue:StringEquals",
|
|
22
24
|
() => new SimIamForAnyValueStringEquals(),
|
|
@@ -19,8 +19,12 @@ export interface SimIamConditionOperator {
|
|
|
19
19
|
* true, because every value the request carries matches vacuously. AWS
|
|
20
20
|
* documents all three rules, and warns that the `ForAllValues` rule leaves
|
|
21
21
|
* an `Allow` overly permissive without a `Null` guard beside it.
|
|
22
|
+
*
|
|
23
|
+
* The policy value is passed because `Null` reads it. Every comparison
|
|
24
|
+
* operator answers the same way whatever the policy says, and takes no
|
|
25
|
+
* argument.
|
|
22
26
|
*/
|
|
23
|
-
|
|
27
|
+
matchesAbsentKey(expected: SimIamConditionValue): boolean;
|
|
24
28
|
/**
|
|
25
29
|
* Determine whether an actual request value satisfies the expected policy value.
|
|
26
30
|
*/
|
|
@@ -59,7 +59,7 @@ export class SimIamPolicyConditionMatcher {
|
|
|
59
59
|
entryMatches(operator, key, expected) {
|
|
60
60
|
const actual = this.conditionContext.get(this.normalizeContextKey(key));
|
|
61
61
|
if (actual === undefined) {
|
|
62
|
-
return operator.matchesAbsentKey;
|
|
62
|
+
return operator.matchesAbsentKey(expected);
|
|
63
63
|
}
|
|
64
64
|
return operator.matches(actual, expected);
|
|
65
65
|
}
|
|
@@ -8,7 +8,10 @@ import type { SimIamConditionOperator } from "../../sim-iam-condition-operator.j
|
|
|
8
8
|
* guard beside it to stay tight.
|
|
9
9
|
*/
|
|
10
10
|
export declare abstract class SimIamForAllValuesStringConditionOperator implements SimIamConditionOperator {
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Answer for a request carrying no value for the key.
|
|
13
|
+
*/
|
|
14
|
+
matchesAbsentKey(): boolean;
|
|
12
15
|
/**
|
|
13
16
|
* Check whether a given value matches the expected value.
|
|
14
17
|
*/
|
|
@@ -7,7 +7,12 @@ import { simIamStringValues } from "../sim-iam-string-values.js";
|
|
|
7
7
|
* guard beside it to stay tight.
|
|
8
8
|
*/
|
|
9
9
|
export class SimIamForAllValuesStringConditionOperator {
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Answer for a request carrying no value for the key.
|
|
12
|
+
*/
|
|
13
|
+
matchesAbsentKey() {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
11
16
|
/**
|
|
12
17
|
* Check whether a given value matches the expected value.
|
|
13
18
|
*/
|
|
@@ -4,7 +4,10 @@ import type { SimIamConditionOperator } from "../../sim-iam-condition-operator.j
|
|
|
4
4
|
* Base for `ForAnyValue` IAM string operators.
|
|
5
5
|
*/
|
|
6
6
|
export declare abstract class SimIamForAnyValueStringConditionOperator implements SimIamConditionOperator {
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Answer for a request carrying no value for the key.
|
|
9
|
+
*/
|
|
10
|
+
matchesAbsentKey(): boolean;
|
|
8
11
|
/**
|
|
9
12
|
* Check whether a given value matches the expected value.
|
|
10
13
|
*/
|
|
@@ -3,7 +3,12 @@ import { simIamStringValues } from "../sim-iam-string-values.js";
|
|
|
3
3
|
* Base for `ForAnyValue` IAM string operators.
|
|
4
4
|
*/
|
|
5
5
|
export class SimIamForAnyValueStringConditionOperator {
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Answer for a request carrying no value for the key.
|
|
8
|
+
*/
|
|
9
|
+
matchesAbsentKey() {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
7
12
|
/**
|
|
8
13
|
* Check whether a given value matches the expected value.
|
|
9
14
|
*/
|
|
@@ -7,7 +7,10 @@ import type { SimIamConditionOperator } from "../sim-iam-condition-operator.js";
|
|
|
7
7
|
* scalar or an array, with multiple policy values using OR semantics.
|
|
8
8
|
*/
|
|
9
9
|
export declare abstract class SimIamScalarStringConditionOperator implements SimIamConditionOperator {
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Answer for a request carrying no value for the key.
|
|
12
|
+
*/
|
|
13
|
+
matchesAbsentKey(): boolean;
|
|
11
14
|
/**
|
|
12
15
|
* Check whether a given value matches the expected value.
|
|
13
16
|
*/
|
|
@@ -6,7 +6,12 @@ import { simIamStringValues } from "./sim-iam-string-values.js";
|
|
|
6
6
|
* scalar or an array, with multiple policy values using OR semantics.
|
|
7
7
|
*/
|
|
8
8
|
export class SimIamScalarStringConditionOperator {
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Answer for a request carrying no value for the key.
|
|
11
|
+
*/
|
|
12
|
+
matchesAbsentKey() {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
10
15
|
/**
|
|
11
16
|
* Check whether a given value matches the expected value.
|
|
12
17
|
*/
|
|
@@ -3648,6 +3648,22 @@ The condition takes the `ForAllValues:` qualifier, as AWS requires for this key.
|
|
|
3648
3648
|
value the request reaches has to match. A batch or a write naming one item outside the allowed set
|
|
3649
3649
|
is refused whole, and nothing it asked for is applied.
|
|
3650
3650
|
|
|
3651
|
+
The same commands, along with `Scan`, supply the top-level attribute names they reach as
|
|
3652
|
+
`dynamodb:Attributes`. A name reaches the condition wherever the request writes one, in a
|
|
3653
|
+
`ProjectionExpression`, an `UpdateExpression`, a `ConditionExpression`, a `FilterExpression`, a
|
|
3654
|
+
`KeyConditionExpression`, and in the `Key` or `Item` a request names outright. A `#` placeholder is
|
|
3655
|
+
resolved first, so the policy is matched against the attribute rather than the alias. A nested path
|
|
3656
|
+
counts as the attribute it starts at, so `address.city` reaches `address`.
|
|
3657
|
+
|
|
3658
|
+
A policy conditioned on `dynamodb:Attributes` has to name every primary key and index key attribute
|
|
3659
|
+
of the table alongside the attributes it is restricting, as AWS requires. A request names its key,
|
|
3660
|
+
and a policy leaving the key attributes out refuses every request that reads or writes an item.
|
|
3661
|
+
|
|
3662
|
+
A request reaching no attribute at all leaves the key out of the condition context, which a
|
|
3663
|
+
`ForAllValues:` condition matches. A `Scan` carrying no expression is the case to watch. AWS asks
|
|
3664
|
+
for a `Null` check beside such a statement to close it, covered under
|
|
3665
|
+
[policy conditions](https://yulinsim.dev/services/iam/#policy-conditions).
|
|
3666
|
+
|
|
3651
3667
|
```typescript sim-dynamodb-leading-keys
|
|
3652
3668
|
import { CreateTableCommand, PutItemCommand } from "@aws-sdk/client-dynamodb";
|
|
3653
3669
|
import { CreateRoleCommand, PutRolePolicyCommand } from "@aws-sdk/client-iam";
|
|
@@ -3755,6 +3771,8 @@ is written.
|
|
|
3755
3771
|
- `dynamodb:LeadingKeys` on `GetItem`, `BatchGetItem`, `Query`, `PutItem`, `UpdateItem`,
|
|
3756
3772
|
`DeleteItem` and `BatchWriteItem`, carrying the partition key values the request reaches so a
|
|
3757
3773
|
`ForAllValues:` condition can scope a caller to particular items.
|
|
3774
|
+
- `dynamodb:Attributes` on those seven and on `Scan`, carrying the top-level attribute names the
|
|
3775
|
+
request reaches, read from every expression it carries and from its `Key` or `Item`.
|
|
3758
3776
|
- `DescribeTable`, answering with the full table description, by table name or ARN.
|
|
3759
3777
|
- `ListTables`, ordered by UTF-8 bytes and paged with `Limit` and `ExclusiveStartTableName`.
|
|
3760
3778
|
- `DeleteTable`, following the table status DynamoDB moves a deleted table through, and refusing a
|
|
@@ -3828,10 +3846,11 @@ Arn`, `Fn::GetAtt … StreamArn` and `Fn::GetAtt … TableId` answering. A CDK `
|
|
|
3828
3846
|
|
|
3829
3847
|
## Limitations
|
|
3830
3848
|
|
|
3831
|
-
- `dynamodb:LeadingKeys`
|
|
3832
|
-
`dynamodb:Select
|
|
3833
|
-
|
|
3834
|
-
|
|
3849
|
+
- `dynamodb:LeadingKeys` and `dynamodb:Attributes` are the DynamoDB condition keys supplied.
|
|
3850
|
+
`dynamodb:Select`, `dynamodb:ReturnValues`, `dynamodb:ReturnConsumedCapacity` and the numbered
|
|
3851
|
+
partition key families are absent from the condition context, and a statement conditioned on one
|
|
3852
|
+
of them matches no request. The transactional operations supply neither key, and are authorized by
|
|
3853
|
+
action and table alone.
|
|
3835
3854
|
- A partition key value reaches a policy condition as a string for a `S` key and as its digits for
|
|
3836
3855
|
an `N` key. A binary partition key has no documented form for the condition key. A request
|
|
3837
3856
|
carrying one leaves the value out.
|
|
@@ -236,7 +236,7 @@ repository that still says it is there.
|
|
|
236
236
|
## Policy conditions
|
|
237
237
|
|
|
238
238
|
Policy statements can carry `Condition` blocks. Sim IAM currently supports the `StringEquals`,
|
|
239
|
-
`StringLike`, `ArnLike`, `ArnEquals` and `
|
|
239
|
+
`StringLike`, `ArnLike`, `ArnEquals`, `NumericLessThanEquals` and `Null` operators, along with the
|
|
240
240
|
`ForAllValues:` and `ForAnyValue:` set variants of `StringEquals` and `StringLike`.
|
|
241
241
|
|
|
242
242
|
The negated operators `StringNotEquals`, `StringNotLike`, `ArnNotEquals` and `ArnNotLike` are
|
|
@@ -337,8 +337,20 @@ request value is there to satisfy it.
|
|
|
337
337
|
|
|
338
338
|
A `ForAllValues:` operator answers true for an absent key, which is also AWS behaviour. Every value
|
|
339
339
|
the request carries matches when it carries none. AWS warns that this leaves a `ForAllValues:`
|
|
340
|
-
`Allow` overly permissive, and asks for a `Null` check with a `false` value beside it.
|
|
341
|
-
|
|
340
|
+
`Allow` overly permissive, and asks for a `Null` check with a `false` value beside it. Write the
|
|
341
|
+
guard and sim IAM evaluates it.
|
|
342
|
+
|
|
343
|
+
`Null` asks whether the request carries a value for a context key rather than comparing one. `"true"`
|
|
344
|
+
matches where the key is absent and `"false"` where it is present. A key carrying an empty string or
|
|
345
|
+
an empty list of values counts as absent, which is the null dataset AWS describes. The two values
|
|
346
|
+
can also be written as JSON booleans. Any other policy value leaves the condition matching nothing.
|
|
347
|
+
|
|
348
|
+
```json
|
|
349
|
+
"Condition": {
|
|
350
|
+
"ForAllValues:StringLike": { "dynamodb:LeadingKeys": ["ORDER#*"] },
|
|
351
|
+
"Null": { "dynamodb:LeadingKeys": "false" }
|
|
352
|
+
}
|
|
353
|
+
```
|
|
342
354
|
|
|
343
355
|
### Statements left unevaluated
|
|
344
356
|
|
|
@@ -1689,6 +1701,8 @@ Sim IAM models the policy behaviour that multi-service tests most commonly need.
|
|
|
1689
1701
|
- Only the condition operators listed above are supported. A statement using any other operator
|
|
1690
1702
|
fails closed, matching no request. `decision.unevaluatedStatements` names those statements, and a
|
|
1691
1703
|
test can assert that a decision was reached over policies read in full
|
|
1704
|
+
- The `...IfExists` operator suffix is absent. AWS reads it as the sibling of `Null`, treating a
|
|
1705
|
+
condition on a key the request leaves out as true. A statement using it fails closed here
|
|
1692
1706
|
- A positive `ForAllValues:` condition fails to match an empty value set, where AWS matches one. An
|
|
1693
1707
|
absent context key matches, as it does on AWS. A service here leaves a key out where the request
|
|
1694
1708
|
carries no value for it, and the empty set is reached only by a caller passing one to `authorize`
|
package/package.json
CHANGED