@cloud-copilot/iam-simulate 0.1.1 → 0.1.3
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/cjs/index.d.ts +4 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/simulation_engine/simulation.d.ts +13 -0
- package/dist/cjs/simulation_engine/simulation.d.ts.map +1 -0
- package/dist/cjs/simulation_engine/simulation.js +3 -0
- package/dist/cjs/simulation_engine/simulation.js.map +1 -0
- package/dist/cjs/simulation_engine/simulationEngine.d.ts +2 -16
- package/dist/cjs/simulation_engine/simulationEngine.d.ts.map +1 -1
- package/dist/cjs/simulation_engine/simulationEngine.js.map +1 -1
- package/dist/cjs/simulation_engine/simulationOptions.d.ts +4 -0
- package/dist/cjs/simulation_engine/simulationOptions.d.ts.map +1 -0
- package/dist/cjs/simulation_engine/simulationOptions.js +3 -0
- package/dist/cjs/simulation_engine/simulationOptions.js.map +1 -0
- package/dist/cjs/simulation_engine/unsafeSimulationEngine.d.ts +13 -0
- package/dist/cjs/simulation_engine/unsafeSimulationEngine.d.ts.map +1 -0
- package/dist/cjs/simulation_engine/unsafeSimulationEngine.js +29 -0
- package/dist/cjs/simulation_engine/unsafeSimulationEngine.js.map +1 -0
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/simulation_engine/simulation.d.ts +13 -0
- package/dist/esm/simulation_engine/simulation.d.ts.map +1 -0
- package/dist/esm/simulation_engine/simulation.js +2 -0
- package/dist/esm/simulation_engine/simulation.js.map +1 -0
- package/dist/esm/simulation_engine/simulationEngine.d.ts +2 -16
- package/dist/esm/simulation_engine/simulationEngine.d.ts.map +1 -1
- package/dist/esm/simulation_engine/simulationEngine.js.map +1 -1
- package/dist/esm/simulation_engine/simulationOptions.d.ts +4 -0
- package/dist/esm/simulation_engine/simulationOptions.d.ts.map +1 -0
- package/dist/esm/simulation_engine/simulationOptions.js +2 -0
- package/dist/esm/simulation_engine/simulationOptions.js.map +1 -0
- package/dist/esm/simulation_engine/unsafeSimulationEngine.d.ts +13 -0
- package/dist/esm/simulation_engine/unsafeSimulationEngine.d.ts.map +1 -0
- package/dist/esm/simulation_engine/unsafeSimulationEngine.js +26 -0
- package/dist/esm/simulation_engine/unsafeSimulationEngine.js.map +1 -0
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { authorize, type AuthorizationRequest } from './core_engine/coreSimulatorEngine.js';
|
|
2
1
|
export { type EvaluationResult } from './evaluate.js';
|
|
3
|
-
export {
|
|
2
|
+
export { type Simulation } from './simulation_engine/simulation.js';
|
|
3
|
+
export { runSimulation } from './simulation_engine/simulationEngine.js';
|
|
4
|
+
export { type SimulationOptions } from './simulation_engine/simulationOptions.js';
|
|
5
|
+
export { runUnsafeSimulation } from './simulation_engine/unsafeSimulationEngine.js';
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.runUnsafeSimulation = exports.runSimulation = void 0;
|
|
4
|
+
var simulationEngine_js_1 = require("./simulation_engine/simulationEngine.js");
|
|
5
|
+
Object.defineProperty(exports, "runSimulation", { enumerable: true, get: function () { return simulationEngine_js_1.runSimulation; } });
|
|
6
|
+
var unsafeSimulationEngine_js_1 = require("./simulation_engine/unsafeSimulationEngine.js");
|
|
7
|
+
Object.defineProperty(exports, "runUnsafeSimulation", { enumerable: true, get: function () { return unsafeSimulationEngine_js_1.runUnsafeSimulation; } });
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAEA,+EAAwE;AAA/D,oHAAA,aAAa,OAAA;AAEtB,2FAAoF;AAA3E,gIAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Simulation {
|
|
2
|
+
request: {
|
|
3
|
+
principal: string;
|
|
4
|
+
action: string;
|
|
5
|
+
resource: {
|
|
6
|
+
resource: string;
|
|
7
|
+
accountId: string;
|
|
8
|
+
};
|
|
9
|
+
contextVariables: Record<string, string | string[]>;
|
|
10
|
+
};
|
|
11
|
+
identityPolicies: Record<string, any>[];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=simulation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulation.d.ts","sourceRoot":"","sources":["../../../src/simulation_engine/simulation.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE;YACR,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAA;SAClB,CAAA;QACD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;KACrD,CAAA;IAED,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;CACzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulation.js","sourceRoot":"","sources":["../../../src/simulation_engine/simulation.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import { ValidationError } from "@cloud-copilot/iam-policy";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
interface Simulation {
|
|
6
|
-
request: {
|
|
7
|
-
principal: string;
|
|
8
|
-
action: string;
|
|
9
|
-
resource: {
|
|
10
|
-
resource: string;
|
|
11
|
-
accountId: string;
|
|
12
|
-
};
|
|
13
|
-
contextVariables: Record<string, any>;
|
|
14
|
-
};
|
|
15
|
-
identityPolicies: Record<string, any>[];
|
|
16
|
-
}
|
|
2
|
+
import { Simulation } from "./simulation.js";
|
|
3
|
+
import { SimulationOptions } from "./simulationOptions.js";
|
|
17
4
|
export interface SimulationErrors {
|
|
18
5
|
identityPolicyErrors?: Record<string, ValidationError[]>;
|
|
19
6
|
message: string;
|
|
@@ -21,5 +8,4 @@ export interface SimulationErrors {
|
|
|
21
8
|
export interface SimulationResult {
|
|
22
9
|
}
|
|
23
10
|
export declare function runSimulation(simulation: Simulation, simulationOptions: SimulationOptions): Promise<SimulationResult>;
|
|
24
|
-
export {};
|
|
25
11
|
//# sourceMappingURL=simulationEngine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulationEngine.d.ts","sourceRoot":"","sources":["../../../src/simulation_engine/simulationEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,eAAe,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"simulationEngine.d.ts","sourceRoot":"","sources":["../../../src/simulation_engine/simulationEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IACzD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;CAEhC;AAED,wBAAsB,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAmC3H"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulationEngine.js","sourceRoot":"","sources":["../../../src/simulation_engine/simulationEngine.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"simulationEngine.js","sourceRoot":"","sources":["../../../src/simulation_engine/simulationEngine.ts"],"names":[],"mappings":";;AAcA,sCAmCC;AAjDD,sDAA4E;AAC5E,0DAAkF;AAa3E,KAAK,UAAU,aAAa,CAAC,UAAsB,EAAE,iBAAoC;IAC9F,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAW,EAAE,EAAE;QAChG,GAAG,CAAC,GAAG,CAAC,IAAI,IAAA,iCAAoB,EAAC,UAAU,CAAC,gBAAgB,CAAC,GAAU,CAAC,CAAC,CAAC;QAC1E,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAuC,CAAC,CAAC;IAE5C,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC;IACrE,IAAG,UAAU,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO;YACL,oBAAoB;SACrB,CAAA;IACH,CAAC;IAED,IAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO;YACL,OAAO,EAAE,gBAAgB;SAC1B,CAAA;IACH,CAAC;IAED,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/D,MAAM,YAAY,GAAG,MAAM,IAAA,2BAAgB,EAAC,OAAO,CAAC,CAAC;IACrD,IAAG,CAAC,YAAY,EAAE,CAAC;QACjB,OAAO;YACL,OAAO,EAAE,iBAAiB;SAC3B,CAAA;IACH,CAAC;IACD,MAAM,WAAW,GAAG,MAAM,IAAA,0BAAe,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3D,IAAG,CAAC,WAAW,EAAE,CAAC;QAChB,OAAO;YACL,OAAO,EAAE,gBAAgB;SAC1B,CAAA;IACH,CAAC;IAED,2BAA2B;IAC3B,OAAO,EAAsB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulationOptions.d.ts","sourceRoot":"","sources":["../../../src/simulation_engine/simulationOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,qBAAqB,EAAE,OAAO,CAAA;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulationOptions.js","sourceRoot":"","sources":["../../../src/simulation_engine/simulationOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type EvaluationResult } from "../evaluate.js";
|
|
2
|
+
import { Simulation } from "./simulation.js";
|
|
3
|
+
import { SimulationOptions } from "./simulationOptions.js";
|
|
4
|
+
/**
|
|
5
|
+
* Runs a simulation without input validation or context error verification.
|
|
6
|
+
* Use this if you know what you're doing.
|
|
7
|
+
*
|
|
8
|
+
* @param simulation The simulation to run.
|
|
9
|
+
* @param simulationOptions Options for the simulation.
|
|
10
|
+
* @returns The result of the simulation.
|
|
11
|
+
*/
|
|
12
|
+
export declare function runUnsafeSimulation(simulation: Simulation, simulationOptions: SimulationOptions): EvaluationResult;
|
|
13
|
+
//# sourceMappingURL=unsafeSimulationEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsafeSimulationEngine.d.ts","sourceRoot":"","sources":["../../../src/simulation_engine/unsafeSimulationEngine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,gBAAgB,CAalH"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runUnsafeSimulation = runUnsafeSimulation;
|
|
4
|
+
const iam_policy_1 = require("@cloud-copilot/iam-policy");
|
|
5
|
+
const coreSimulatorEngine_js_1 = require("../core_engine/coreSimulatorEngine.js");
|
|
6
|
+
const request_js_1 = require("../request/request.js");
|
|
7
|
+
const requestContext_js_1 = require("../requestContext.js");
|
|
8
|
+
/**
|
|
9
|
+
* Runs a simulation without input validation or context error verification.
|
|
10
|
+
* Use this if you know what you're doing.
|
|
11
|
+
*
|
|
12
|
+
* @param simulation The simulation to run.
|
|
13
|
+
* @param simulationOptions Options for the simulation.
|
|
14
|
+
* @returns The result of the simulation.
|
|
15
|
+
*/
|
|
16
|
+
function runUnsafeSimulation(simulation, simulationOptions) {
|
|
17
|
+
// Implementation goes here
|
|
18
|
+
const identityPolicies = Object.values(simulation.identityPolicies).map(p => (0, iam_policy_1.loadPolicy)(p));
|
|
19
|
+
const requestContext = new requestContext_js_1.RequestContextImpl(simulation.request.contextVariables);
|
|
20
|
+
const request = new request_js_1.AwsRequestImpl(simulation.request.principal, {
|
|
21
|
+
resource: simulation.request.resource.resource,
|
|
22
|
+
accountId: simulation.request.resource.accountId,
|
|
23
|
+
}, simulation.request.action, requestContext);
|
|
24
|
+
return (0, coreSimulatorEngine_js_1.authorize)({
|
|
25
|
+
request,
|
|
26
|
+
identityPolicies
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=unsafeSimulationEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsafeSimulationEngine.js","sourceRoot":"","sources":["../../../src/simulation_engine/unsafeSimulationEngine.ts"],"names":[],"mappings":";;AAgBA,kDAaC;AA7BD,0DAAuD;AACvD,kFAAkE;AAElE,sDAAuD;AACvD,4DAA0D;AAI1D;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,UAAsB,EAAE,iBAAoC;IAC5F,2BAA2B;IAC7B,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,uBAAU,EAAC,CAAC,CAAC,CAAC,CAAC;IAC5F,MAAM,cAAc,GAAG,IAAI,sCAAkB,CAAC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAClF,MAAM,OAAO,GAAG,IAAI,2BAAc,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE;QAC/D,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ;QAC9C,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS;KACjD,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAE9C,OAAO,IAAA,kCAAS,EAAC;QACf,OAAO;QACP,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { authorize, type AuthorizationRequest } from './core_engine/coreSimulatorEngine.js';
|
|
2
1
|
export { type EvaluationResult } from './evaluate.js';
|
|
3
|
-
export {
|
|
2
|
+
export { type Simulation } from './simulation_engine/simulation.js';
|
|
3
|
+
export { runSimulation } from './simulation_engine/simulationEngine.js';
|
|
4
|
+
export { type SimulationOptions } from './simulation_engine/simulationOptions.js';
|
|
5
|
+
export { runUnsafeSimulation } from './simulation_engine/unsafeSimulationEngine.js';
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { runSimulation } from './simulation_engine/simulationEngine.js';
|
|
2
|
+
export { runUnsafeSimulation } from './simulation_engine/unsafeSimulationEngine.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Simulation {
|
|
2
|
+
request: {
|
|
3
|
+
principal: string;
|
|
4
|
+
action: string;
|
|
5
|
+
resource: {
|
|
6
|
+
resource: string;
|
|
7
|
+
accountId: string;
|
|
8
|
+
};
|
|
9
|
+
contextVariables: Record<string, string | string[]>;
|
|
10
|
+
};
|
|
11
|
+
identityPolicies: Record<string, any>[];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=simulation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulation.d.ts","sourceRoot":"","sources":["../../../src/simulation_engine/simulation.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE;YACR,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAA;SAClB,CAAA;QACD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;KACrD,CAAA;IAED,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;CACzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulation.js","sourceRoot":"","sources":["../../../src/simulation_engine/simulation.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import { ValidationError } from "@cloud-copilot/iam-policy";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
interface Simulation {
|
|
6
|
-
request: {
|
|
7
|
-
principal: string;
|
|
8
|
-
action: string;
|
|
9
|
-
resource: {
|
|
10
|
-
resource: string;
|
|
11
|
-
accountId: string;
|
|
12
|
-
};
|
|
13
|
-
contextVariables: Record<string, any>;
|
|
14
|
-
};
|
|
15
|
-
identityPolicies: Record<string, any>[];
|
|
16
|
-
}
|
|
2
|
+
import { Simulation } from "./simulation.js";
|
|
3
|
+
import { SimulationOptions } from "./simulationOptions.js";
|
|
17
4
|
export interface SimulationErrors {
|
|
18
5
|
identityPolicyErrors?: Record<string, ValidationError[]>;
|
|
19
6
|
message: string;
|
|
@@ -21,5 +8,4 @@ export interface SimulationErrors {
|
|
|
21
8
|
export interface SimulationResult {
|
|
22
9
|
}
|
|
23
10
|
export declare function runSimulation(simulation: Simulation, simulationOptions: SimulationOptions): Promise<SimulationResult>;
|
|
24
|
-
export {};
|
|
25
11
|
//# sourceMappingURL=simulationEngine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulationEngine.d.ts","sourceRoot":"","sources":["../../../src/simulation_engine/simulationEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,eAAe,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"simulationEngine.d.ts","sourceRoot":"","sources":["../../../src/simulation_engine/simulationEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IACzD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;CAEhC;AAED,wBAAsB,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAmC3H"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulationEngine.js","sourceRoot":"","sources":["../../../src/simulation_engine/simulationEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAmB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"simulationEngine.js","sourceRoot":"","sources":["../../../src/simulation_engine/simulationEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAmB,MAAM,2BAA2B,CAAC;AAalF,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAAsB,EAAE,iBAAoC;IAC9F,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAW,EAAE,EAAE;QAChG,GAAG,CAAC,GAAG,CAAC,IAAI,oBAAoB,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAAU,CAAC,CAAC,CAAC;QAC1E,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAuC,CAAC,CAAC;IAE5C,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC;IACrE,IAAG,UAAU,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO;YACL,oBAAoB;SACrB,CAAA;IACH,CAAC;IAED,IAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO;YACL,OAAO,EAAE,gBAAgB;SAC1B,CAAA;IACH,CAAC;IAED,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/D,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACrD,IAAG,CAAC,YAAY,EAAE,CAAC;QACjB,OAAO;YACL,OAAO,EAAE,iBAAiB;SAC3B,CAAA;IACH,CAAC;IACD,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3D,IAAG,CAAC,WAAW,EAAE,CAAC;QAChB,OAAO;YACL,OAAO,EAAE,gBAAgB;SAC1B,CAAA;IACH,CAAC;IAED,2BAA2B;IAC3B,OAAO,EAAsB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulationOptions.d.ts","sourceRoot":"","sources":["../../../src/simulation_engine/simulationOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,qBAAqB,EAAE,OAAO,CAAA;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulationOptions.js","sourceRoot":"","sources":["../../../src/simulation_engine/simulationOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type EvaluationResult } from "../evaluate.js";
|
|
2
|
+
import { Simulation } from "./simulation.js";
|
|
3
|
+
import { SimulationOptions } from "./simulationOptions.js";
|
|
4
|
+
/**
|
|
5
|
+
* Runs a simulation without input validation or context error verification.
|
|
6
|
+
* Use this if you know what you're doing.
|
|
7
|
+
*
|
|
8
|
+
* @param simulation The simulation to run.
|
|
9
|
+
* @param simulationOptions Options for the simulation.
|
|
10
|
+
* @returns The result of the simulation.
|
|
11
|
+
*/
|
|
12
|
+
export declare function runUnsafeSimulation(simulation: Simulation, simulationOptions: SimulationOptions): EvaluationResult;
|
|
13
|
+
//# sourceMappingURL=unsafeSimulationEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsafeSimulationEngine.d.ts","sourceRoot":"","sources":["../../../src/simulation_engine/unsafeSimulationEngine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,gBAAgB,CAalH"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { loadPolicy } from "@cloud-copilot/iam-policy";
|
|
2
|
+
import { authorize } from "../core_engine/coreSimulatorEngine.js";
|
|
3
|
+
import { AwsRequestImpl } from "../request/request.js";
|
|
4
|
+
import { RequestContextImpl } from "../requestContext.js";
|
|
5
|
+
/**
|
|
6
|
+
* Runs a simulation without input validation or context error verification.
|
|
7
|
+
* Use this if you know what you're doing.
|
|
8
|
+
*
|
|
9
|
+
* @param simulation The simulation to run.
|
|
10
|
+
* @param simulationOptions Options for the simulation.
|
|
11
|
+
* @returns The result of the simulation.
|
|
12
|
+
*/
|
|
13
|
+
export function runUnsafeSimulation(simulation, simulationOptions) {
|
|
14
|
+
// Implementation goes here
|
|
15
|
+
const identityPolicies = Object.values(simulation.identityPolicies).map(p => loadPolicy(p));
|
|
16
|
+
const requestContext = new RequestContextImpl(simulation.request.contextVariables);
|
|
17
|
+
const request = new AwsRequestImpl(simulation.request.principal, {
|
|
18
|
+
resource: simulation.request.resource.resource,
|
|
19
|
+
accountId: simulation.request.resource.accountId,
|
|
20
|
+
}, simulation.request.action, requestContext);
|
|
21
|
+
return authorize({
|
|
22
|
+
request,
|
|
23
|
+
identityPolicies
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=unsafeSimulationEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsafeSimulationEngine.js","sourceRoot":"","sources":["../../../src/simulation_engine/unsafeSimulationEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI1D;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAsB,EAAE,iBAAoC;IAC5F,2BAA2B;IAC7B,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5F,MAAM,cAAc,GAAG,IAAI,kBAAkB,CAAC,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAClF,MAAM,OAAO,GAAG,IAAI,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE;QAC/D,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ;QAC9C,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS;KACjD,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAE9C,OAAO,SAAS,CAAC;QACf,OAAO;QACP,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC"}
|