@kensio/yulin 0.36.0 → 0.37.0

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.
Files changed (73) hide show
  1. package/dist/service/aws/factory/sim-aws-account-service-cache.d.ts.map +1 -1
  2. package/dist/service/aws/factory/sim-aws-account-service-cache.js +3 -0
  3. package/dist/service/aws/factory/sim-aws-account-service-cache.js.map +1 -1
  4. package/dist/service/iam/authorize/allow/sim-iam-allow-requirement.d.ts +60 -0
  5. package/dist/service/iam/authorize/allow/sim-iam-allow-requirement.d.ts.map +1 -0
  6. package/dist/service/iam/authorize/allow/sim-iam-allow-requirement.js +60 -0
  7. package/dist/service/iam/authorize/allow/sim-iam-allow-requirement.js.map +1 -0
  8. package/dist/service/iam/authorize/allow/sim-iam-allow-statements.d.ts +46 -0
  9. package/dist/service/iam/authorize/allow/sim-iam-allow-statements.d.ts.map +1 -0
  10. package/dist/service/iam/authorize/allow/sim-iam-allow-statements.js +67 -0
  11. package/dist/service/iam/authorize/allow/sim-iam-allow-statements.js.map +1 -0
  12. package/dist/service/iam/authorize/caller-account/sim-iam-caller-account-resolver.d.ts +37 -0
  13. package/dist/service/iam/authorize/caller-account/sim-iam-caller-account-resolver.d.ts.map +1 -0
  14. package/dist/service/iam/authorize/caller-account/sim-iam-caller-account-resolver.js +33 -0
  15. package/dist/service/iam/authorize/caller-account/sim-iam-caller-account-resolver.js.map +1 -0
  16. package/dist/service/iam/authorize/caller-account/sim-iam-caller-account.d.ts +21 -0
  17. package/dist/service/iam/authorize/caller-account/sim-iam-caller-account.d.ts.map +1 -0
  18. package/dist/service/iam/authorize/caller-account/sim-iam-caller-account.js +2 -0
  19. package/dist/service/iam/authorize/caller-account/sim-iam-caller-account.js.map +1 -0
  20. package/dist/service/iam/authorize/caller-account/sim-iam-cross-account-caller.d.ts +34 -0
  21. package/dist/service/iam/authorize/caller-account/sim-iam-cross-account-caller.d.ts.map +1 -0
  22. package/dist/service/iam/authorize/caller-account/sim-iam-cross-account-caller.js +22 -0
  23. package/dist/service/iam/authorize/caller-account/sim-iam-cross-account-caller.js.map +1 -0
  24. package/dist/service/iam/authorize/caller-account/sim-iam-same-account-caller.d.ts +18 -0
  25. package/dist/service/iam/authorize/caller-account/sim-iam-same-account-caller.d.ts.map +1 -0
  26. package/dist/service/iam/authorize/caller-account/sim-iam-same-account-caller.js +16 -0
  27. package/dist/service/iam/authorize/caller-account/sim-iam-same-account-caller.js.map +1 -0
  28. package/dist/service/iam/authorize/context/sim-iam-auth-z-caller-context-builder.d.ts +1 -2
  29. package/dist/service/iam/authorize/context/sim-iam-auth-z-caller-context-builder.d.ts.map +1 -1
  30. package/dist/service/iam/authorize/context/sim-iam-auth-z-context-builder.d.ts +39 -2
  31. package/dist/service/iam/authorize/context/sim-iam-auth-z-context-builder.d.ts.map +1 -1
  32. package/dist/service/iam/authorize/context/sim-iam-auth-z-context-builder.js +42 -8
  33. package/dist/service/iam/authorize/context/sim-iam-auth-z-context-builder.js.map +1 -1
  34. package/dist/service/iam/authorize/context/sim-iam-auth-z-context.d.ts +9 -0
  35. package/dist/service/iam/authorize/context/sim-iam-auth-z-context.d.ts.map +1 -1
  36. package/dist/service/iam/authorize/context/sim-iam-auth-z-context.factory.d.ts.map +1 -1
  37. package/dist/service/iam/authorize/context/sim-iam-auth-z-context.factory.js +2 -0
  38. package/dist/service/iam/authorize/context/sim-iam-auth-z-context.factory.js.map +1 -1
  39. package/dist/service/iam/authorize/identity/sim-iam-account-identity-policies.d.ts +14 -0
  40. package/dist/service/iam/authorize/identity/sim-iam-account-identity-policies.d.ts.map +1 -0
  41. package/dist/service/iam/authorize/identity/sim-iam-account-identity-policies.js +2 -0
  42. package/dist/service/iam/authorize/identity/sim-iam-account-identity-policies.js.map +1 -0
  43. package/dist/service/iam/authorize/sim-iam-account-auth-z.d.ts +24 -1
  44. package/dist/service/iam/authorize/sim-iam-account-auth-z.d.ts.map +1 -1
  45. package/dist/service/iam/authorize/sim-iam-account-auth-z.js +18 -4
  46. package/dist/service/iam/authorize/sim-iam-account-auth-z.js.map +1 -1
  47. package/dist/service/iam/authorize/sim-iam-authorizer.d.ts +11 -2
  48. package/dist/service/iam/authorize/sim-iam-authorizer.d.ts.map +1 -1
  49. package/dist/service/iam/authorize/sim-iam-authorizer.js +14 -1
  50. package/dist/service/iam/authorize/sim-iam-authorizer.js.map +1 -1
  51. package/dist/service/iam/authorize/sim-iam-decision.d.ts +17 -5
  52. package/dist/service/iam/authorize/sim-iam-decision.d.ts.map +1 -1
  53. package/dist/service/iam/authorize/sim-iam-decision.js +27 -13
  54. package/dist/service/iam/authorize/sim-iam-decision.js.map +1 -1
  55. package/dist/service/iam/command/sim-iam-command-handlers.d.ts +41 -0
  56. package/dist/service/iam/command/sim-iam-command-handlers.d.ts.map +1 -0
  57. package/dist/service/iam/command/sim-iam-command-handlers.js +42 -0
  58. package/dist/service/iam/command/sim-iam-command-handlers.js.map +1 -0
  59. package/dist/service/iam/registry/sim-iam-account-resolver.d.ts +8 -0
  60. package/dist/service/iam/registry/sim-iam-account-resolver.d.ts.map +1 -1
  61. package/dist/service/iam/registry/sim-iam-registry.d.ts +4 -0
  62. package/dist/service/iam/registry/sim-iam-registry.d.ts.map +1 -1
  63. package/dist/service/iam/registry/sim-iam-registry.js +7 -1
  64. package/dist/service/iam/registry/sim-iam-registry.js.map +1 -1
  65. package/dist/service/iam/sim-iam-account-parts.d.ts +58 -0
  66. package/dist/service/iam/sim-iam-account-parts.d.ts.map +1 -0
  67. package/dist/service/iam/sim-iam-account-parts.js +72 -0
  68. package/dist/service/iam/sim-iam-account-parts.js.map +1 -0
  69. package/dist/service/iam/sim-iam.d.ts +28 -21
  70. package/dist/service/iam/sim-iam.d.ts.map +1 -1
  71. package/dist/service/iam/sim-iam.js +42 -71
  72. package/dist/service/iam/sim-iam.js.map +1 -1
  73. package/package.json +1 -1
@@ -1,5 +1,7 @@
1
+ import { makeSimAwsAccountRootPrincipal } from "../../../aws/caller/sim-aws-account-root-principal.js";
2
+ import { SimIamCallerAccountResolver } from "../caller-account/sim-iam-caller-account-resolver.js";
1
3
  import { SimIamAuthZIdentityPolicyCoordinator } from "./identity-policy-source/sim-iam-auth-z-id-pol-coordinator.js";
2
- import { SimIamAuthZCallerContextBuilder } from "./sim-iam-auth-z-caller-context-builder.js";
4
+ import { SimIamAuthZCallerContextBuilder, } from "./sim-iam-auth-z-caller-context-builder.js";
3
5
  /**
4
6
  * Builds the authorization context consumed by SimIamAuthorizer.
5
7
  *
@@ -12,6 +14,11 @@ import { SimIamAuthZCallerContextBuilder } from "./sim-iam-auth-z-caller-context
12
14
  * finding a principal role, reading inline policies from the role, resolving
13
15
  * attached managed policy ARNs, and parsing stored policy documents.
14
16
  *
17
+ * Whose identity policies are in scope depends on which Account owns the
18
+ * caller, which SimIamCallerAccountResolver decides. A caller from another
19
+ * Account brings that Account's identity policies with it, along with the rule
20
+ * that both sides must then allow the request.
21
+ *
15
22
  * Resource policies are supplied by the service that owns the target resource.
16
23
  * They are passed through the authorization input rather than loaded from the
17
24
  * IAM role or managed-policy stores.
@@ -24,12 +31,17 @@ import { SimIamAuthZCallerContextBuilder } from "./sim-iam-auth-z-caller-context
24
31
  export class SimIamAuthZContextBuilder {
25
32
  callerContextBuilder;
26
33
  identityPolicyCoordinator;
27
- constructor(policies, roles, users, defaultCallerPrincipal, credentialIdentityResolver) {
28
- this.callerContextBuilder = new SimIamAuthZCallerContextBuilder(defaultCallerPrincipal, credentialIdentityResolver);
34
+ callerAccountResolver;
35
+ constructor(properties) {
36
+ this.callerContextBuilder = new SimIamAuthZCallerContextBuilder(makeSimAwsAccountRootPrincipal(properties.accountId), properties.credentialIdentityResolver);
29
37
  this.identityPolicyCoordinator = new SimIamAuthZIdentityPolicyCoordinator({
30
- policies,
31
- roles,
32
- users,
38
+ policies: properties.policies,
39
+ roles: properties.roles,
40
+ users: properties.users,
41
+ });
42
+ this.callerAccountResolver = new SimIamCallerAccountResolver({
43
+ accountId: properties.accountId,
44
+ iamResolver: properties.iamResolver,
33
45
  });
34
46
  }
35
47
  /**
@@ -37,18 +49,40 @@ export class SimIamAuthZContextBuilder {
37
49
  */
38
50
  build(input) {
39
51
  const callerContext = this.callerContextBuilder.build(input.caller);
52
+ const callerAccount = this.callerAccountResolver.resolve(callerContext.caller);
40
53
  return {
41
54
  identityPolicies: [
42
- ...this.identityPolicyCoordinator.build(callerContext.caller.identityPolicyArn),
43
- ...callerContext.rootPolicySources,
55
+ ...this.ownIdentityPolicySources(callerContext),
56
+ ...callerAccount.identityPolicies,
44
57
  ],
45
58
  resourcePolicies: this.resourcePolicySources(input),
59
+ allowRequirement: callerAccount.allowRequirement,
46
60
  action: input.action,
47
61
  resource: input.resource,
48
62
  conditionContext: this.conditionContext(input, callerContext.caller),
49
63
  caller: callerContext.caller,
50
64
  };
51
65
  }
66
+ /**
67
+ * Identity policy sources this Account applies to one of its own principals.
68
+ *
69
+ * This is the identity side of a request within one Account, and is also what
70
+ * another Account's IAM asks for when it is deciding a cross-Account request
71
+ * against a principal belonging to this one.
72
+ */
73
+ identityPolicySourcesFor(principal) {
74
+ return this.ownIdentityPolicySources(this.callerContextBuilder.build(principal));
75
+ }
76
+ /**
77
+ * Combine stored identity policies with any implied by the caller itself,
78
+ * such as the unrestricted access held by this Account's root principal.
79
+ */
80
+ ownIdentityPolicySources(callerContext) {
81
+ return [
82
+ ...this.identityPolicyCoordinator.build(callerContext.caller.identityPolicyArn),
83
+ ...callerContext.rootPolicySources,
84
+ ];
85
+ }
52
86
  /**
53
87
  * Combine service-provided condition values with global values that IAM can
54
88
  * derive from the resolved caller. AWS:PrincipalArn identifies the IAM
@@ -1 +1 @@
1
- {"version":3,"file":"sim-iam-auth-z-context-builder.js","sourceRoot":"","sources":["../../../../../src/service/iam/authorize/context/sim-iam-auth-z-context-builder.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oCAAoC,EAAE,MAAM,+DAA+D,CAAC;AACrH,OAAO,EAAE,+BAA+B,EAAE,MAAM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AG,KAAK,CAAC,gBAAgB;YACzB,kBAAkB,EAAE,YAAY;SACjC,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACK,qBAAqB,CAC3B,KAA+B;QAE/B,OAAO,CAAC,KAAK,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACrD,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,UAAU;YAC3C,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
1
+ {"version":3,"file":"sim-iam-auth-z-context-builder.js","sourceRoot":"","sources":["../../../../../src/service/iam/authorize/context/sim-iam-auth-z-context-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,uDAAuD,CAAC;AAMvG,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAanG,OAAO,EAAE,oCAAoC,EAAE,MAAM,+DAA+D,CAAC;AACrH,OAAO,EACL,+BAA+B,GAEhC,MAAM,4CAA4C,CAAC;AAwEpD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,yBAAyB;IACnB,oBAAoB,CAAkC;IACtD,yBAAyB,CAAuC;IAChE,qBAAqB,CAA8B;IAEpE,YAAY,UAA+C;QACzD,IAAI,CAAC,oBAAoB,GAAG,IAAI,+BAA+B,CAC7D,8BAA8B,CAAC,UAAU,CAAC,SAAS,CAAC,EACpD,UAAU,CAAC,0BAA0B,CACtC,CAAC;QACF,IAAI,CAAC,yBAAyB,GAAG,IAAI,oCAAoC,CAAC;YACxE,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,KAAK,EAAE,UAAU,CAAC,KAAK;SACxB,CAAC,CAAC;QAC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E5B,MAAM,YAAY,GAAG,MAAM,CAAC,iBAAiB,IAAI,MAAM,CAAC,GAAG,CAAC;QAE5D,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAC,gBAAgB,IAAI,EAAE,CAAC;QACtC,CAAC;QAED,OAAO;YACL,GAAG,KAAK,CAAC,gBAAgB;YACzB,kBAAkB,EAAE,YAAY;SACjC,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACK,qBAAqB,CAC3B,KAA+B;QAE/B,OAAO,CAAC,KAAK,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACrD,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,UAAU;YAC3C,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
@@ -1,6 +1,7 @@
1
1
  import type { SimArn } from "../../../aws/arn.js";
2
2
  import type { SimIamConditionValue, SimIamPolicyDocument } from "../../policy/sim-iam-policy.js";
3
3
  import type { SimAwsResolvedCaller } from "../../../aws/caller/sim-aws-caller-resolver.js";
4
+ import type { SimIamAllowRequirement } from "../allow/sim-iam-allow-requirement.js";
4
5
  export type SimIamAuthZPolicySourceType = "identity-inline" | "identity-managed" | "resource" | "trust" | "permissions-boundary" | "session";
5
6
  export interface SimIamAuthZPolicySource {
6
7
  readonly sourceType: SimIamAuthZPolicySourceType;
@@ -28,6 +29,14 @@ export interface SimIamAuthZContext {
28
29
  * Resource policies are not gathered from IAM's managed policy store.
29
30
  */
30
31
  readonly resourcePolicies: readonly SimIamAuthZPolicySource[];
32
+ /**
33
+ * How an Allow from each policy side combines into the final decision.
34
+ *
35
+ * Within one Account either side is enough. A cross-Account request needs
36
+ * both, because each Account only speaks for its own principals and
37
+ * resources.
38
+ */
39
+ readonly allowRequirement: SimIamAllowRequirement;
31
40
  readonly action: string;
32
41
  readonly resource: string;
33
42
  readonly conditionContext: Readonly<Record<string, SimIamConditionValue>>;
@@ -1 +1 @@
1
- {"version":3,"file":"sim-iam-auth-z-context.d.ts","sourceRoot":"","sources":["../../../../../src/service/iam/authorize/context/sim-iam-auth-z-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAE3F,MAAM,MAAM,2BAA2B,GACnC,iBAAiB,GACjB,kBAAkB,GAClB,UAAU,GACV,OAAO,GACP,sBAAsB,GACtB,SAAS,CAAC;AAEd,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,IAAI,CAChD,uBAAuB,EACvB,YAAY,CACb,GAAG;IACF,QAAQ,CAAC,UAAU,EAAE,OAAO,CAC1B,2BAA2B,EAC3B,UAAU,GAAG,OAAO,CACrB,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAE9D;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAE9D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAE1E;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;CACvC"}
1
+ {"version":3,"file":"sim-iam-auth-z-context.d.ts","sourceRoot":"","sources":["../../../../../src/service/iam/authorize/context/sim-iam-auth-z-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAEpF,MAAM,MAAM,2BAA2B,GACnC,iBAAiB,GACjB,kBAAkB,GAClB,UAAU,GACV,OAAO,GACP,sBAAsB,GACtB,SAAS,CAAC;AAEd,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,IAAI,CAChD,uBAAuB,EACvB,YAAY,CACb,GAAG;IACF,QAAQ,CAAC,UAAU,EAAE,OAAO,CAC1B,2BAA2B,EAC3B,UAAU,GAAG,OAAO,CACrB,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAE9D;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAE9D;;;;;;OAMG;IACH,QAAQ,CAAC,gBAAgB,EAAE,sBAAsB,CAAC;IAElD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAE1E;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;CACvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sim-iam-auth-z-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/service/iam/authorize/context/sim-iam-auth-z-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EACV,kBAAkB,EAClB,+BAA+B,EAChC,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,yBAAyB,mCAkBpC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sCAAsC,gDAW/C,CAAC"}
1
+ {"version":3,"file":"sim-iam-auth-z-context.factory.d.ts","sourceRoot":"","sources":["../../../../../src/service/iam/authorize/context/sim-iam-auth-z-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EACV,kBAAkB,EAClB,+BAA+B,EAChC,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,yBAAyB,mCAmBpC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sCAAsC,gDAW/C,CAAC"}
@@ -1,10 +1,12 @@
1
1
  import { StaticFactory } from "@kensio/part-factory";
2
+ import { SimIamEitherSideAllowRequirement } from "../allow/sim-iam-allow-requirement.js";
2
3
  /**
3
4
  * Generates simulated IAM authorization contexts for tests.
4
5
  */
5
6
  export const simIamAuthZContextFactory = new StaticFactory({
6
7
  identityPolicies: [],
7
8
  resourcePolicies: [],
9
+ allowRequirement: new SimIamEitherSideAllowRequirement(),
8
10
  action: "s3:GetObject",
9
11
  resource: "arn:aws:s3:::test-bucket/test-key",
10
12
  conditionContext: {},
@@ -1 +1 @@
1
- {"version":3,"file":"sim-iam-auth-z-context.factory.js","sourceRoot":"","sources":["../../../../../src/service/iam/authorize/context/sim-iam-auth-z-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAMrD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,aAAa,CAAqB;IAC7E,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,MAAM,EAAE,cAAc;IACtB,QAAQ,EAAE,mCAAmC;IAC7C,gBAAgB,EAAE,EAAE;IACpB,MAAM,EAAE;QACN,uBAAuB,EAAE;YACvB,IAAI,EAAE,KAAK;YACX,GAAG,EAAE,yCAAyC;SAC/C;QACD,SAAS,EAAE;YACT,IAAI,EAAE,KAAK;YACX,GAAG,EAAE,yCAAyC;SAC/C;QACD,GAAG,EAAE,yCAAyC;QAC9C,SAAS,EAAE,cAAc;KAC1B;CACF,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,sCAAsC,GACjD,IAAI,aAAa,CAAkC;IACjD,UAAU,EAAE,UAAU;IACtB,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE;YACT,MAAM,EAAE,OAAO;YACf,MAAM,EAAE,cAAc;YACtB,QAAQ,EAAE,mCAAmC;SAC9C;KACF;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"sim-iam-auth-z-context.factory.js","sourceRoot":"","sources":["../../../../../src/service/iam/authorize/context/sim-iam-auth-z-context.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAMzF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,aAAa,CAAqB;IAC7E,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,EAAE;IACpB,gBAAgB,EAAE,IAAI,gCAAgC,EAAE;IACxD,MAAM,EAAE,cAAc;IACtB,QAAQ,EAAE,mCAAmC;IAC7C,gBAAgB,EAAE,EAAE;IACpB,MAAM,EAAE;QACN,uBAAuB,EAAE;YACvB,IAAI,EAAE,KAAK;YACX,GAAG,EAAE,yCAAyC;SAC/C;QACD,SAAS,EAAE;YACT,IAAI,EAAE,KAAK;YACX,GAAG,EAAE,yCAAyC;SAC/C;QACD,GAAG,EAAE,yCAAyC;QAC9C,SAAS,EAAE,cAAc;KAC1B;CACF,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,sCAAsC,GACjD,IAAI,aAAa,CAAkC;IACjD,UAAU,EAAE,UAAU;IACtB,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE;YACT,MAAM,EAAE,OAAO;YACf,MAAM,EAAE,cAAc;YACtB,QAAQ,EAAE,mCAAmC;SAC9C;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { SimAwsPrincipal } from "../../../aws/caller/sim-aws-caller.js";
2
+ import type { SimIamAuthZPolicySource } from "../context/sim-iam-auth-z-context.js";
3
+ /**
4
+ * Identity-based policy discovery for principals belonging to one Account.
5
+ *
6
+ * This is the capability one Account's IAM needs from another Account's IAM to
7
+ * decide a cross-Account request: the policies the caller's own Account applies
8
+ * to its own principal. SimIam implements it, so a resource-owning Account can
9
+ * ask the caller's Account without depending on the whole service facade.
10
+ */
11
+ export interface SimIamAccountIdentityPolicies {
12
+ identityPolicySourcesFor(principal: SimAwsPrincipal): readonly SimIamAuthZPolicySource[];
13
+ }
14
+ //# sourceMappingURL=sim-iam-account-identity-policies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-iam-account-identity-policies.d.ts","sourceRoot":"","sources":["../../../../../src/service/iam/authorize/identity/sim-iam-account-identity-policies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAEpF;;;;;;;GAOG;AACH,MAAM,WAAW,6BAA6B;IAC5C,wBAAwB,CACtB,SAAS,EAAE,eAAe,GACzB,SAAS,uBAAuB,EAAE,CAAC;CACvC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sim-iam-account-identity-policies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-iam-account-identity-policies.js","sourceRoot":"","sources":["../../../../../src/service/iam/authorize/identity/sim-iam-account-identity-policies.ts"],"names":[],"mappings":""}
@@ -1,10 +1,14 @@
1
1
  import type { SimAwsAccountId } from "../../aws/sim-aws-account.js";
2
2
  import type { SimArn } from "../../aws/arn.js";
3
3
  import type { SimAwsCredentialIdentityResolver } from "../../aws/caller/sim-aws-caller-resolver.js";
4
+ import type { SimAwsPrincipal } from "../../aws/caller/sim-aws-caller.js";
4
5
  import type { SimIamManagedPolicy } from "../policy/sim-iam-policy.js";
5
6
  import type { SimIamRole, SimIamRoleName } from "../role/sim-iam-role.js";
6
7
  import type { SimIamUser, SimIamUsername } from "../user/sim-iam-user.js";
8
+ import type { SimIamAccountResolver } from "../registry/sim-iam-account-resolver.js";
7
9
  import type { SimIamAuthorizationInput } from "./context/sim-iam-auth-z-context-builder.js";
10
+ import type { SimIamAuthZPolicySource } from "./context/sim-iam-auth-z-context.js";
11
+ import type { SimIamAccountIdentityPolicies } from "./identity/sim-iam-account-identity-policies.js";
8
12
  import type { SimIamPolicyDecision } from "./sim-iam-decision.js";
9
13
  interface SimIamAccountAuthZProperties {
10
14
  readonly accountId: SimAwsAccountId;
@@ -12,6 +16,14 @@ interface SimIamAccountAuthZProperties {
12
16
  readonly roles: Map<SimIamRoleName, SimIamRole>;
13
17
  readonly users: Map<SimIamUsername, SimIamUser>;
14
18
  readonly credentialIdentityResolver: SimAwsCredentialIdentityResolver;
19
+ /**
20
+ * Resolves other Accounts' IAM in the same simulation.
21
+ *
22
+ * A cross-Account request is decided in both Accounts, so the caller's own
23
+ * Account has to be reachable for its identity policies to count. A
24
+ * standalone SimIam has no simulation around it and so no resolver.
25
+ */
26
+ readonly iamResolver?: SimIamAccountResolver | undefined;
15
27
  }
16
28
  /**
17
29
  * Evaluates IAM authorization attempts against one simulated Account's IAM
@@ -21,7 +33,7 @@ interface SimIamAccountAuthZProperties {
21
33
  * the owning sim Account. An explicit anonymous caller suppresses that
22
34
  * fallback and is evaluated without identity policies.
23
35
  */
24
- export declare class SimIamAccountAuthZ {
36
+ export declare class SimIamAccountAuthZ implements SimIamAccountIdentityPolicies {
25
37
  private readonly properties;
26
38
  constructor(properties: SimIamAccountAuthZProperties);
27
39
  /**
@@ -29,6 +41,17 @@ export declare class SimIamAccountAuthZ {
29
41
  * request caller.
30
42
  */
31
43
  authorize(input: SimIamAuthorizationInput): SimIamPolicyDecision;
44
+ /**
45
+ * Identity policies this Account applies to one of its own principals.
46
+ */
47
+ identityPolicySourcesFor(principal: SimAwsPrincipal): readonly SimIamAuthZPolicySource[];
48
+ /**
49
+ * Make an authorizer over this Account's current IAM state.
50
+ *
51
+ * The state maps are shared by reference, so a fresh authorizer sees every
52
+ * Role, User, and Policy created since the last request.
53
+ */
54
+ private authorizer;
32
55
  }
33
56
  export {};
34
57
  //# sourceMappingURL=sim-iam-account-auth-z.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-iam-account-auth-z.d.ts","sourceRoot":"","sources":["../../../../src/service/iam/authorize/sim-iam-account-auth-z.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AACpG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,UAAU,4BAA4B;IACpC,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACpD,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IAChD,QAAQ,CAAC,0BAA0B,EAAE,gCAAgC,CAAC;CACvE;AAED;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAE1D,YAAY,UAAU,EAAE,4BAA4B,EAEnD;IAED;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,wBAAwB,GAAG,oBAAoB,CAW/D;CACF"}
1
+ {"version":3,"file":"sim-iam-account-auth-z.d.ts","sourceRoot":"","sources":["../../../../src/service/iam/authorize/sim-iam-account-auth-z.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,K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IACH,SAAS,CAAC,KAAK,EAAE,wBAAwB,GAAG,oBAAoB,CAE/D;IAED;;OAEG;IACH,wBAAwB,CACtB,SAAS,EAAE,eAAe,GACzB,SAAS,uBAAuB,EAAE,CAEpC;IAED;;;;;OAKG;IACH,OAAO,CAAC,UAAU;CAUnB"}
@@ -1,4 +1,3 @@
1
- import { makeSimAwsAccountRootPrincipal } from "../../aws/caller/sim-aws-account-root-principal.js";
2
1
  import { SimIamAuthorizer } from "./sim-iam-authorizer.js";
3
2
  /**
4
3
  * Evaluates IAM authorization attempts against one simulated Account's IAM
@@ -18,14 +17,29 @@ export class SimIamAccountAuthZ {
18
17
  * request caller.
19
18
  */
20
19
  authorize(input) {
21
- const simIamAuthorizer = new SimIamAuthorizer({
20
+ return this.authorizer().authorize(input);
21
+ }
22
+ /**
23
+ * Identity policies this Account applies to one of its own principals.
24
+ */
25
+ identityPolicySourcesFor(principal) {
26
+ return this.authorizer().identityPolicySourcesFor(principal);
27
+ }
28
+ /**
29
+ * Make an authorizer over this Account's current IAM state.
30
+ *
31
+ * The state maps are shared by reference, so a fresh authorizer sees every
32
+ * Role, User, and Policy created since the last request.
33
+ */
34
+ authorizer() {
35
+ return new SimIamAuthorizer({
36
+ accountId: this.properties.accountId,
22
37
  policies: this.properties.policies,
23
38
  roles: this.properties.roles,
24
39
  users: this.properties.users,
25
- defaultCallerPrincipal: makeSimAwsAccountRootPrincipal(this.properties.accountId),
26
40
  credentialIdentityResolver: this.properties.credentialIdentityResolver,
41
+ iamResolver: this.properties.iamResolver,
27
42
  });
28
- return simIamAuthorizer.authorize(input);
29
43
  }
30
44
  }
31
45
  //# sourceMappingURL=sim-iam-account-auth-z.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-iam-account-auth-z.js","sourceRoot":"","sources":["../../../../src/service/iam/authorize/sim-iam-account-auth-z.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AAOpG,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAY3D;;;;;;;GAOG;AACH,MAAM,OAAO,kBAAkB;IACZ,UAAU,CAA+B;IAE1D,YAAY,UAAwC;QAClD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,KAA+B;QACvC,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAAC;YAC5C,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ;YAClC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YAC5B,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YAC5B,sBAAsB,EAAE,8BAA8B,CACpD,IAAI,CAAC,UAAU,CAAC,SAAS,CAC1B;YACD,0BAA0B,EAAE,IAAI,CAAC,UAAU,CAAC,0BAA0B;SACvE,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;CACF"}
1
+ {"version":3,"file":"sim-iam-account-auth-z.js","sourceRoot":"","sources":["../../../../src/service/iam/authorize/sim-iam-account-auth-z.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAuB3D;;;;;;;GAOG;AACH,MAAM,OAAO,kBAAkB;IACZ,UAAU,CAA+B;IAE1D,YAAY,UAAwC;QAClD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,KAA+B;QACvC,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,wBAAwB,CACtB,SAA0B;QAE1B,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;OAKG;IACK,UAAU;QAChB,OAAO,IAAI,gBAAgB,CAAC;YAC1B,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS;YACpC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ;YAClC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YAC5B,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YAC5B,0BAA0B,EAAE,IAAI,CAAC,UAAU,CAAC,0BAA0B;YACtE,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW;SACzC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -6,12 +6,17 @@ import { SimIamPolicyDecision } from "./sim-iam-decision.js";
6
6
  import type { SimAwsPrincipal } from "../../aws/caller/sim-aws-caller.js";
7
7
  import type { SimIamUser, SimIamUsername } from "../user/sim-iam-user.js";
8
8
  import type { SimAwsCredentialIdentityResolver } from "../../aws/caller/sim-aws-caller-resolver.js";
9
+ import type { SimAwsAccountId } from "../../aws/sim-aws-account.js";
10
+ import type { SimIamAccountResolver } from "../registry/sim-iam-account-resolver.js";
11
+ import type { SimIamAuthZPolicySource } from "./context/sim-iam-auth-z-context.js";
12
+ import type { SimIamAccountIdentityPolicies } from "./identity/sim-iam-account-identity-policies.js";
9
13
  interface SimIamAuthorizerProperties {
14
+ readonly accountId: SimAwsAccountId;
10
15
  readonly policies: ReadonlyMap<SimArn, SimIamPolicy>;
11
16
  readonly roles: ReadonlyMap<SimIamRoleName, SimIamRole>;
12
17
  readonly users: ReadonlyMap<SimIamUsername, SimIamUser>;
13
- readonly defaultCallerPrincipal: SimAwsPrincipal;
14
18
  readonly credentialIdentityResolver: SimAwsCredentialIdentityResolver;
19
+ readonly iamResolver?: SimIamAccountResolver | undefined;
15
20
  }
16
21
  /**
17
22
  * Facade for simulated IAM authorization decisions.
@@ -21,13 +26,17 @@ interface SimIamAuthorizerProperties {
21
26
  * each SimIamPolicyDecision instance keeps the state and diagnostics for one
22
27
  * evaluated authorization attempt.
23
28
  */
24
- export declare class SimIamAuthorizer {
29
+ export declare class SimIamAuthorizer implements SimIamAccountIdentityPolicies {
25
30
  private readonly contextBuilder;
26
31
  constructor(properties: SimIamAuthorizerProperties);
27
32
  /**
28
33
  * Evaluate an IAM authorization request.
29
34
  */
30
35
  authorize(input: SimIamAuthorizationInput): SimIamPolicyDecision;
36
+ /**
37
+ * Identity policies this Account applies to one of its own principals.
38
+ */
39
+ identityPolicySourcesFor(principal: SimAwsPrincipal): readonly SimIamAuthZPolicySource[];
31
40
  }
32
41
  export {};
33
42
  //# sourceMappingURL=sim-iam-authorizer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-iam-authorizer.d.ts","sourceRoot":"","sources":["../../../../src/service/iam/authorize/sim-iam-authorizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AAEpG,UAAU,0BAA0B;IAClC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACrD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IACxD,QAAQ,CAAC,sBAAsB,EAAE,eAAe,CAAC;I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,KAAK,EAAE,WAAW,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IACxD,QAAQ,CAAC,0BAA0B,EAAE,gCAAgC,CAAC;IACtE,QAAQ,CAAC,WAAW,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;CAC1D;AAED;;;;;;;GAOG;AACH,qBAAa,gBAAiB,YAAW,6BAA6B;IACpE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAE3D,YAAY,UAAU,EAAE,0BAA0B,EASjD;IAED;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,wBAAwB,GAAG,oBAAoB,CAE/D;IAED;;OAEG;IACH,wBAAwB,CACtB,SAAS,EAAE,eAAe,GACzB,SAAS,uBAAuB,EAAE,CAEpC;CACF"}
@@ -11,7 +11,14 @@ import { SimIamPolicyDecision } from "./sim-iam-decision.js";
11
11
  export class SimIamAuthorizer {
12
12
  contextBuilder;
13
13
  constructor(properties) {
14
- this.contextBuilder = new SimIamAuthZContextBuilder(properties.policies, properties.roles, properties.users, properties.defaultCallerPrincipal, properties.credentialIdentityResolver);
14
+ this.contextBuilder = new SimIamAuthZContextBuilder({
15
+ accountId: properties.accountId,
16
+ policies: properties.policies,
17
+ roles: properties.roles,
18
+ users: properties.users,
19
+ credentialIdentityResolver: properties.credentialIdentityResolver,
20
+ iamResolver: properties.iamResolver,
21
+ });
15
22
  }
16
23
  /**
17
24
  * Evaluate an IAM authorization request.
@@ -19,5 +26,11 @@ export class SimIamAuthorizer {
19
26
  authorize(input) {
20
27
  return new SimIamPolicyDecision(this.contextBuilder.build(input));
21
28
  }
29
+ /**
30
+ * Identity policies this Account applies to one of its own principals.
31
+ */
32
+ identityPolicySourcesFor(principal) {
33
+ return this.contextBuilder.identityPolicySourcesFor(principal);
34
+ }
22
35
  }
23
36
  //# sourceMappingURL=sim-iam-authorizer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-iam-authorizer.js","sourceRoot":"","sources":["../../../../src/service/iam/authorize/sim-iam-authorizer.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,yBAAyB,GAE1B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAa7D;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IACV,cAAc,CAA4B;IAE3D,YAAY,UAAsC;QAChD,IAAI,CAAC,cAAc,GAAG,IAAI,yBAAyB,CACjD,UAAU,CAAC,QAAQ,EACnB,UAAU,CAAC,KAAK,EAChB,UAAU,CAAC,KAAK,EAChB,UAAU,CAAC,sBAAsB,EACjC,UAAU,CAAC,0BAA0B,CACtC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,KAA+B;QACvC,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,CAAC;CACF"}
1
+ {"version":3,"file":"sim-iam-authorizer.js","sourceRoot":"","sources":["../../../../src/service/iam/authorize/sim-iam-authorizer.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,yBAAyB,GAE1B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAkB7D;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IACV,cAAc,CAA4B;IAE3D,YAAY,UAAsC;QAChD,IAAI,CAAC,cAAc,GAAG,IAAI,yBAAyB,CAAC;YAClD,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,0BAA0B,EAAE,UAAU,CAAC,0BAA0B;YACjE,WAAW,EAAE,UAAU,CAAC,WAAW;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,KAA+B;QACvC,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACH,wBAAwB,CACtB,SAA0B;QAE1B,OAAO,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC;CACF"}
@@ -16,10 +16,11 @@ export type SimIamPolicyDecisionValue = (typeof SimIamPolicyDecisionValue)[keyof
16
16
  * evaluate permissions boundaries, evaluate SCPs, or enforce service command
17
17
  * access.
18
18
  *
19
- * The simulator currently models the common IAM authorization union:
19
+ * The simulator currently models the common IAM authorization rules:
20
20
  *
21
21
  * - an explicit Deny in any evaluated policy wins;
22
- * - an Allow in an identity policy or resource policy allows the request;
22
+ * - the Allows found must satisfy the request's allow requirement, which is
23
+ * either side within one Account and both sides across Accounts;
23
24
  * - otherwise the request is implicitly denied.
24
25
  *
25
26
  * Resource policies are expected to be supplied by the service that owns the
@@ -30,8 +31,7 @@ export declare class SimIamPolicyDecision {
30
31
  private readonly policyDocumentParser;
31
32
  private readonly statementMatcher;
32
33
  private readonly explicitDenyStatementRecords;
33
- private readonly allowStatementRecords;
34
- private readonly trustAllowStatementRecords;
34
+ private readonly allows;
35
35
  constructor(request: SimIamAuthZContext, policyDocumentParser?: SimIamPolicyDocumentParser);
36
36
  /**
37
37
  * Resolved caller against which this authorization decision was evaluated.
@@ -71,9 +71,21 @@ export declare class SimIamPolicyDecision {
71
71
  */
72
72
  get explicitDenyStatements(): readonly SimIamPolicyDocumentStatement[];
73
73
  /**
74
- * Matching Allow statements.
74
+ * Matching Allow statements, from both policy sides.
75
+ *
76
+ * A statement appearing here did match the request. It does not follow that
77
+ * the request was allowed: a cross-Account request needs a matching Allow
78
+ * from each side.
75
79
  */
76
80
  get allowStatements(): readonly SimIamPolicyDocumentStatement[];
81
+ /**
82
+ * Matching Allow statements from identity-based policies.
83
+ */
84
+ get identityAllowStatements(): readonly SimIamPolicyDocumentStatement[];
85
+ /**
86
+ * Matching Allow statements from resource-based policies.
87
+ */
88
+ get resourceAllowStatements(): readonly SimIamPolicyDocumentStatement[];
77
89
  /**
78
90
  * Matching Allow statements originating from trust policies.
79
91
  */
@@ -1 +1 @@
1
- {"version":3,"file":"sim-iam-decision.d.ts","sourceRoot":"","sources":["../../../../src/service/iam/authorize/sim-iam-decision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAExF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAExF,eAAO,MAAM,yBAAyB;aACpC,YAAY,EAAE,cAAc;aAC5B,KAAK,EAAE,OAAO;aACd,YAAY,EAAE,cAAc;CACpB,CAAC;AAEX,MAAM,MAAM,yBAAyB,GACnC,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,OAAO,yBAAyB,CAAC,CAAC;AAE7E;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA6B;IAClE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA+B;IAChE,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CACxC;IACL,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAuC;IAC7E,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CACtC;IAEL,YACE,OAAO,EAAE,kBAAkB,EAC3B,oBAAoB,GAAE,0BAA6D,EAOpF;IAED;;;;;OAKG;IACH,IAAI,MAAM,IAAI,oBAAoB,CAEjC;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,yBAAyB,CAUrC;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED;;;;OAIG;IACH,IAAI,sBAAsB,IAAI,OAAO,CAEpC;IAED;;OAEG;IACH,IAAI,sBAAsB,IAAI,SAAS,6BAA6B,EAAE,CAErE;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,SAAS,6BAA6B,EAAE,CAE9D;IAED;;OAEG;IACH,IAAI,oBAAoB,IAAI,SAAS,6BAA6B,EAAE,CAEnE;IAED,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,cAAc;CAoBvB"}
1
+ {"version":3,"file":"sim-iam-decision.d.ts","sourceRoot":"","sources":["../../../../src/service/iam/authorize/sim-iam-decision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAExF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAGxF,eAAO,MAAM,yBAAyB;aACpC,YAAY,EAAE,cAAc;aAC5B,KAAK,EAAE,OAAO;aACd,YAAY,EAAE,cAAc;CACpB,CAAC;AAEX,MAAM,MAAM,yBAAyB,GACnC,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,OAAO,yBAAyB,CAAC,CAAC;AAE7E;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA6B;IAClE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA+B;IAChE,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CACxC;IACL,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;IAEtD,YACE,OAAO,EAAE,kBAAkB,EAC3B,oBAAoB,GAAE,0BAA6D,EAOpF;IAED;;;;;OAKG;IACH,IAAI,MAAM,IAAI,oBAAoB,CAEjC;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,yBAAyB,CAUrC;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED;;;;OAIG;IACH,IAAI,sBAAsB,IAAI,OAAO,CAEpC;IAED;;OAEG;IACH,IAAI,sBAAsB,IAAI,SAAS,6BAA6B,EAAE,CAErE;IAED;;;;;;OAMG;IACH,IAAI,eAAe,IAAI,SAAS,6BAA6B,EAAE,CAE9D;IAED;;OAEG;IACH,IAAI,uBAAuB,IAAI,SAAS,6BAA6B,EAAE,CAEtE;IAED;;OAEG;IACH,IAAI,uBAAuB,IAAI,SAAS,6BAA6B,EAAE,CAEtE;IAED;;OAEG;IACH,IAAI,oBAAoB,IAAI,SAAS,6BAA6B,EAAE,CAEnE;IAED,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,cAAc;CAgBvB"}
@@ -1,5 +1,6 @@
1
1
  import { SimIamPolicyDocumentParser } from "../policy/parse/sim-iam-document-parser.js";
2
2
  import { SimIamPolicyStatementMatcher } from "./match/sim-iam-policy-statement-matcher.js";
3
+ import { SimIamAllowStatements } from "./allow/sim-iam-allow-statements.js";
3
4
  export const SimIamPolicyDecisionValue = {
4
5
  ExplicitDeny: "ExplicitDeny",
5
6
  Allow: "Allow",
@@ -13,10 +14,11 @@ export const SimIamPolicyDecisionValue = {
13
14
  * evaluate permissions boundaries, evaluate SCPs, or enforce service command
14
15
  * access.
15
16
  *
16
- * The simulator currently models the common IAM authorization union:
17
+ * The simulator currently models the common IAM authorization rules:
17
18
  *
18
19
  * - an explicit Deny in any evaluated policy wins;
19
- * - an Allow in an identity policy or resource policy allows the request;
20
+ * - the Allows found must satisfy the request's allow requirement, which is
21
+ * either side within one Account and both sides across Accounts;
20
22
  * - otherwise the request is implicitly denied.
21
23
  *
22
24
  * Resource policies are expected to be supplied by the service that owns the
@@ -27,8 +29,7 @@ export class SimIamPolicyDecision {
27
29
  policyDocumentParser;
28
30
  statementMatcher;
29
31
  explicitDenyStatementRecords = [];
30
- allowStatementRecords = [];
31
- trustAllowStatementRecords = [];
32
+ allows = new SimIamAllowStatements();
32
33
  constructor(request, policyDocumentParser = new SimIamPolicyDocumentParser()) {
33
34
  this.request = request;
34
35
  this.policyDocumentParser = policyDocumentParser;
@@ -51,7 +52,7 @@ export class SimIamPolicyDecision {
51
52
  if (this.explicitDenyStatementRecords.length > 0) {
52
53
  return SimIamPolicyDecisionValue.ExplicitDeny;
53
54
  }
54
- if (this.allowStatementRecords.length > 0) {
55
+ if (this.request.allowRequirement.isSatisfiedBy(this.allows.sides)) {
55
56
  return SimIamPolicyDecisionValue.Allow;
56
57
  }
57
58
  return SimIamPolicyDecisionValue.ImplicitDeny;
@@ -86,7 +87,7 @@ export class SimIamPolicyDecision {
86
87
  * An identity-policy Allow cannot substitute for the target role's trust.
87
88
  */
88
89
  get isAllowedByTrustPolicy() {
89
- return this.trustAllowStatementRecords.length > 0;
90
+ return this.allows.trust.length > 0;
90
91
  }
91
92
  /**
92
93
  * Matching explicit Deny statements.
@@ -95,16 +96,32 @@ export class SimIamPolicyDecision {
95
96
  return this.explicitDenyStatementRecords;
96
97
  }
97
98
  /**
98
- * Matching Allow statements.
99
+ * Matching Allow statements, from both policy sides.
100
+ *
101
+ * A statement appearing here did match the request. It does not follow that
102
+ * the request was allowed: a cross-Account request needs a matching Allow
103
+ * from each side.
99
104
  */
100
105
  get allowStatements() {
101
- return this.allowStatementRecords;
106
+ return this.allows.all;
107
+ }
108
+ /**
109
+ * Matching Allow statements from identity-based policies.
110
+ */
111
+ get identityAllowStatements() {
112
+ return this.allows.identity;
113
+ }
114
+ /**
115
+ * Matching Allow statements from resource-based policies.
116
+ */
117
+ get resourceAllowStatements() {
118
+ return this.allows.resource;
102
119
  }
103
120
  /**
104
121
  * Matching Allow statements originating from trust policies.
105
122
  */
106
123
  get trustAllowStatements() {
107
- return this.trustAllowStatementRecords;
124
+ return this.allows.trust;
108
125
  }
109
126
  evaluate() {
110
127
  for (const policy of [
@@ -124,10 +141,7 @@ export class SimIamPolicyDecision {
124
141
  this.explicitDenyStatementRecords.push(statement.source);
125
142
  continue;
126
143
  }
127
- this.allowStatementRecords.push(statement.source);
128
- if (policy.sourceType === "trust") {
129
- this.trustAllowStatementRecords.push(statement.source);
130
- }
144
+ this.allows.record(policy, statement.source);
131
145
  }
132
146
  }
133
147
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sim-iam-decision.js","sourceRoot":"","sources":["../../../../src/service/iam/authorize/sim-iam-decision.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAG3F,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,YAAY,EAAE,cAAc;IAC5B,KAAK,EAAE,OAAO;IACd,YAAY,EAAE,cAAc;CACpB,CAAC;AAKX;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,oBAAoB;IACd,OAAO,CAAqB;IAC5B,oBAAoB,CAA6B;IACjD,gBAAgB,CAA+B;IAC/C,4BAA4B,GAC3C,EAAE,CAAC;IACY,qBAAqB,GAAoC,EAAE,CAAC;IAC5D,0BAA0B,GACzC,EAAE,CAAC;IAEL,YACE,OAA2B,EAC3B,oBAAoB,GAA+B,IAAI,0BAA0B,EAAE;QAEnF,IAAI,CAAC,OAAO,GAAG,OAAO,CAA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AAC,qBAAqB,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,IAAI,oBAAoB;QACtB,OAAO,IAAI,CAAC,0BAA0B,CAAC;IACzC,CAAC;IAEO,QAAQ;QACd,KAAK,MAAM,MAAM,IAAI;YACnB,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB;YAChC,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB;SACjC,EAAE,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,MAA+B;QACpD,MAAM,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEtE,KAAK,MAAM,SAAS,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;YAChD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;gBACtD,SAAS;YACX,CAAC;YAED,IAAI,SAAS,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAChC,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;gBACzD,SAAS;YACX,CAAC;YAED,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAElD,IAAI,MAAM,CAAC,UAAU,KAAK,OAAO,EAAE,CAAC;gBAClC,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"sim-iam-decision.js","sourceRoot":"","sources":["../../../../src/service/iam/authorize/sim-iam-decision.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAE3F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,UAAU,EAAE,CAAC;YAChD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;gBACtD,SAAS;YACX,CAAC;YAED,IAAI,SAAS,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAChC,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;gBACzD,SAAS;YACX,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,41 @@
1
+ import type { BackgroundScheduler } from "../../../util/background/background.js";
2
+ import type { SimArn } from "../../aws/arn.js";
3
+ import type { SimAwsAccountId } from "../../aws/sim-aws-account.js";
4
+ import type { SimIamInterServiceAuthZ } from "../authorize/sim-iam-inter-service-auth-z.js";
5
+ import type { SimIamCredentialRegistry } from "../credential/sim-iam-credential-registry.js";
6
+ import type { SimIamUserCredentialGenerator } from "../credential/user/sim-iam-user-credential-generator.js";
7
+ import type { SimIamManagedPolicy } from "../policy/sim-iam-policy.js";
8
+ import type { SimIamRole, SimIamRoleName } from "../role/sim-iam-role.js";
9
+ import type { SimIamUser, SimIamUsername } from "../user/sim-iam-user.js";
10
+ import { SimIamPolicyCommandHandlers } from "./policy/sim-iam-policy-command-handlers.js";
11
+ import { SimIamRoleCommandHandlers } from "./role/sim-iam-role-command-handlers.js";
12
+ import { SimIamUserCommandHandlers } from "./user/sim-iam-user-command-handlers.js";
13
+ interface SimIamCommandHandlersProperties {
14
+ readonly accountId: SimAwsAccountId;
15
+ readonly policies: Map<SimArn, SimIamManagedPolicy>;
16
+ readonly roles: Map<SimIamRoleName, SimIamRole>;
17
+ readonly users: Map<SimIamUsername, SimIamUser>;
18
+ readonly credentialRegistry: SimIamCredentialRegistry;
19
+ readonly userCredentialGenerator: SimIamUserCredentialGenerator;
20
+ readonly background: BackgroundScheduler;
21
+ /**
22
+ * IAM itself, which authorizes its own control-plane commands.
23
+ */
24
+ readonly iam: SimIamInterServiceAuthZ;
25
+ }
26
+ /**
27
+ * The command handlers of one simulated IAM Account, grouped by resource.
28
+ *
29
+ * Every group authorizes against the same IAM and mutates the same Account
30
+ * state, so they are wired together here rather than one at a time in the
31
+ * service facade. That keeps SimIam what it should be: state maps plus
32
+ * delegation.
33
+ */
34
+ export declare class SimIamCommandHandlers {
35
+ readonly roles: SimIamRoleCommandHandlers;
36
+ readonly users: SimIamUserCommandHandlers;
37
+ readonly policies: SimIamPolicyCommandHandlers;
38
+ constructor(properties: SimIamCommandHandlersProperties);
39
+ }
40
+ export {};
41
+ //# sourceMappingURL=sim-iam-command-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-iam-command-handlers.d.ts","sourceRoot":"","sources":["../../../../src/service/iam/command/sim-iam-command-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,yDAAyD,CAAC;AAC7G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAC1F,OAAO,EAAE,yBAAyB,E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