@rehearsal-db/core 0.1.0-beta.12 → 0.1.0-beta.13
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/CHANGELOG.md +40 -0
- package/COMPATIBILITY.md +6 -0
- package/README.md +2 -2
- package/docs/commands.md +15 -11
- package/docs/getting-started.md +4 -3
- package/docs/production-source.md +138 -16
- package/docs/sanitization.md +73 -7
- package/docs/security-model.md +8 -0
- package/docs/standalone-workflow.md +24 -9
- package/docs/troubleshooting.md +12 -5
- package/docs/tutorial.md +2 -1
- package/package.json +2 -2
- package/src/baseline/artifact.mjs +27 -4
- package/src/baseline/privacy_engine.mjs +220 -9
- package/src/cli/arguments.mjs +3 -0
- package/src/cli/guided.mjs +8 -6
- package/src/cli/rehearsal.mjs +20 -2
- package/src/cli/renderers.mjs +17 -4
- package/src/cli/runtime_commands.mjs +92 -9
- package/src/cli/source_commands.mjs +26 -5
- package/src/project/setup.mjs +5 -23
- package/src/runtime/plan.mjs +7 -3
- package/src/runtime/restore.mjs +13 -5
- package/src/shared/diagnostics.mjs +7 -0
- package/src/shared/node_runtime.mjs +31 -0
- package/src/source/access.mjs +224 -49
- package/src/source/asset_transfer.mjs +35 -5
- package/src/source/baseline.mjs +42 -6
- package/src/source/external_reader.mjs +255 -0
- package/src/source/postgresql_access.mjs +143 -42
- package/src/source/privacy_paths.mjs +38 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Coordinate private source prefixes with reviewed privacy path mappings. */
|
|
2
|
+
|
|
3
|
+
import { validateExecutablePrivacyPolicy } from "../baseline/privacy_engine.mjs";
|
|
4
|
+
import { validateSourceAccessPolicy } from "./access.mjs";
|
|
5
|
+
|
|
6
|
+
export const resolvePrivacyMappedAssets = ({
|
|
7
|
+
sourcePolicy,
|
|
8
|
+
privacyPolicy,
|
|
9
|
+
environment = process.env,
|
|
10
|
+
}) => {
|
|
11
|
+
const source = validateSourceAccessPolicy(sourcePolicy);
|
|
12
|
+
const privacy = validateExecutablePrivacyPolicy(privacyPolicy);
|
|
13
|
+
|
|
14
|
+
return Object.freeze(
|
|
15
|
+
source.assets.map((asset) => {
|
|
16
|
+
if (!asset.pathMapping) return asset;
|
|
17
|
+
const mapping = privacy.pathMappings[asset.pathMapping];
|
|
18
|
+
if (!mapping) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Storage asset references unknown privacy path mapping ${asset.pathMapping}.`,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
const binding = privacy.bindings[mapping.binding];
|
|
24
|
+
if (binding.environmentVariable !== asset.prefixEnvironmentVariable) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`Storage asset ${asset.bucket} must use the environment variable reviewed by privacy path mapping ${asset.pathMapping}.`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
const prefix = environment[asset.prefixEnvironmentVariable];
|
|
30
|
+
if (typeof prefix !== "string" || !prefix) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
`Storage asset ${asset.bucket} requires ${asset.prefixEnvironmentVariable}.`,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return Object.freeze({ ...asset, prefix });
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
};
|