arc-1 0.6.10 → 0.7.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.
- package/README.md +8 -7
- package/bin/arc1-cli.js +10 -0
- package/bin/arc1.js +1 -1
- package/dist/adt/cds-impact.d.ts +35 -0
- package/dist/adt/cds-impact.d.ts.map +1 -1
- package/dist/adt/cds-impact.js +71 -0
- package/dist/adt/cds-impact.js.map +1 -1
- package/dist/adt/client.d.ts +4 -1
- package/dist/adt/client.d.ts.map +1 -1
- package/dist/adt/client.js +18 -5
- package/dist/adt/client.js.map +1 -1
- package/dist/adt/crud.d.ts.map +1 -1
- package/dist/adt/crud.js +32 -5
- package/dist/adt/crud.js.map +1 -1
- package/dist/adt/devtools.d.ts +39 -3
- package/dist/adt/devtools.d.ts.map +1 -1
- package/dist/adt/devtools.js +237 -25
- package/dist/adt/devtools.js.map +1 -1
- package/dist/adt/diagnostics.d.ts +69 -7
- package/dist/adt/diagnostics.d.ts.map +1 -1
- package/dist/adt/diagnostics.js +694 -36
- package/dist/adt/diagnostics.js.map +1 -1
- package/dist/adt/errors.d.ts +14 -1
- package/dist/adt/errors.d.ts.map +1 -1
- package/dist/adt/errors.js +40 -9
- package/dist/adt/errors.js.map +1 -1
- package/dist/adt/http.d.ts.map +1 -1
- package/dist/adt/http.js +86 -1
- package/dist/adt/http.js.map +1 -1
- package/dist/adt/rap-handlers.d.ts +165 -0
- package/dist/adt/rap-handlers.d.ts.map +1 -0
- package/dist/adt/rap-handlers.js +835 -0
- package/dist/adt/rap-handlers.js.map +1 -0
- package/dist/adt/rap-preflight.d.ts +43 -0
- package/dist/adt/rap-preflight.d.ts.map +1 -0
- package/dist/adt/rap-preflight.js +405 -0
- package/dist/adt/rap-preflight.js.map +1 -0
- package/dist/adt/safety.d.ts +60 -36
- package/dist/adt/safety.d.ts.map +1 -1
- package/dist/adt/safety.js +202 -120
- package/dist/adt/safety.js.map +1 -1
- package/dist/adt/transport.d.ts +1 -1
- package/dist/adt/transport.js +2 -2
- package/dist/adt/transport.js.map +1 -1
- package/dist/adt/types.d.ts +88 -0
- package/dist/adt/types.d.ts.map +1 -1
- package/dist/adt/xml-parser.d.ts +13 -1
- package/dist/adt/xml-parser.d.ts.map +1 -1
- package/dist/adt/xml-parser.js +26 -15
- package/dist/adt/xml-parser.js.map +1 -1
- package/dist/authz/policy.d.ts +53 -0
- package/dist/authz/policy.d.ts.map +1 -0
- package/dist/authz/policy.js +199 -0
- package/dist/authz/policy.js.map +1 -0
- package/dist/cli-args.d.ts +14 -0
- package/dist/cli-args.d.ts.map +1 -0
- package/dist/cli-args.js +62 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli.d.ts +13 -7
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +252 -55
- package/dist/cli.js.map +1 -1
- package/dist/extract-sap-cookies.d.ts +24 -0
- package/dist/extract-sap-cookies.d.ts.map +1 -0
- package/dist/extract-sap-cookies.js +317 -0
- package/dist/extract-sap-cookies.js.map +1 -0
- package/dist/handlers/hyperfocused.d.ts +4 -3
- package/dist/handlers/hyperfocused.d.ts.map +1 -1
- package/dist/handlers/hyperfocused.js +25 -16
- package/dist/handlers/hyperfocused.js.map +1 -1
- package/dist/handlers/intent.d.ts +4 -12
- package/dist/handlers/intent.d.ts.map +1 -1
- package/dist/handlers/intent.js +1238 -114
- package/dist/handlers/intent.js.map +1 -1
- package/dist/handlers/schemas.d.ts +38 -10
- package/dist/handlers/schemas.d.ts.map +1 -1
- package/dist/handlers/schemas.js +69 -4
- package/dist/handlers/schemas.js.map +1 -1
- package/dist/handlers/tools.d.ts.map +1 -1
- package/dist/handlers/tools.js +251 -164
- package/dist/handlers/tools.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/server/audit.d.ts +26 -3
- package/dist/server/audit.d.ts.map +1 -1
- package/dist/server/audit.js.map +1 -1
- package/dist/server/config.d.ts +34 -19
- package/dist/server/config.d.ts.map +1 -1
- package/dist/server/config.js +320 -193
- package/dist/server/config.js.map +1 -1
- package/dist/server/deny-actions.d.ts +31 -0
- package/dist/server/deny-actions.d.ts.map +1 -0
- package/dist/server/deny-actions.js +156 -0
- package/dist/server/deny-actions.js.map +1 -0
- package/dist/server/effective-policy-log.d.ts +27 -0
- package/dist/server/effective-policy-log.d.ts.map +1 -0
- package/dist/server/effective-policy-log.js +103 -0
- package/dist/server/effective-policy-log.js.map +1 -0
- package/dist/server/http.d.ts.map +1 -1
- package/dist/server/http.js +15 -16
- package/dist/server/http.js.map +1 -1
- package/dist/server/server.d.ts +37 -3
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +231 -30
- package/dist/server/server.js.map +1 -1
- package/dist/server/types.d.ts +29 -13
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/types.js +10 -11
- package/dist/server/types.js.map +1 -1
- package/dist/server/xsuaa.d.ts +1 -2
- package/dist/server/xsuaa.d.ts.map +1 -1
- package/dist/server/xsuaa.js +13 -14
- package/dist/server/xsuaa.js.map +1 -1
- package/package.json +6 -3
package/dist/adt/safety.d.ts
CHANGED
|
@@ -4,18 +4,24 @@
|
|
|
4
4
|
* Gates all operations before they reach SAP. This is the first line of defense
|
|
5
5
|
* against unintended modifications — it runs before any HTTP call.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Design (post-authz-refactor-v2):
|
|
8
|
+
* - Safety flags are all POSITIVE opt-ins (`allow*=true` to enable a capability).
|
|
9
|
+
* Defaults are restrictive. No mix of negations and opt-ins.
|
|
10
|
+
* - Every mutation requires the matching server flag AND the user's scope
|
|
11
|
+
* (two-gate rule; scope check happens in the handler layer).
|
|
12
|
+
* - `allowWrites=false` is a TRUE no-mutation block — it stops object writes,
|
|
13
|
+
* transport writes, git writes, and activation (no loopholes).
|
|
14
|
+
* - Fine-grained per-action denials are expressed via `denyActions` (parsed
|
|
15
|
+
* from `SAP_DENY_ACTIONS`), not via op-code allow/block lists.
|
|
11
16
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
17
|
+
* Internal only: `OperationType` is the classification used by the safety
|
|
18
|
+
* engine. It is NOT admin-facing — the env vars `SAP_ALLOWED_OPS` /
|
|
19
|
+
* `SAP_DISALLOWED_OPS` were removed in v0.7. Admins configure via the `allow*`
|
|
20
|
+
* flags and `SAP_DENY_ACTIONS`.
|
|
14
21
|
*/
|
|
15
22
|
/**
|
|
16
|
-
* Operation type codes.
|
|
17
|
-
*
|
|
18
|
-
* Example: "RSQ" = allow Read, Search, Query only.
|
|
23
|
+
* Operation type codes (internal classification).
|
|
24
|
+
* NOT admin-facing — the code just uses these as a compact categorical label.
|
|
19
25
|
*/
|
|
20
26
|
export declare const OperationType: {
|
|
21
27
|
readonly Read: "R";
|
|
@@ -34,48 +40,66 @@ export declare const OperationType: {
|
|
|
34
40
|
};
|
|
35
41
|
export type OperationTypeCode = (typeof OperationType)[keyof typeof OperationType];
|
|
36
42
|
export interface SafetyConfig {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
allowWrites: boolean;
|
|
44
|
+
allowDataPreview: boolean;
|
|
45
|
+
allowFreeSQL: boolean;
|
|
46
|
+
allowTransportWrites: boolean;
|
|
47
|
+
allowGitWrites: boolean;
|
|
42
48
|
allowedPackages: string[];
|
|
43
|
-
dryRun: boolean;
|
|
44
|
-
enableGit: boolean;
|
|
45
|
-
enableTransports: boolean;
|
|
46
|
-
transportReadOnly: boolean;
|
|
47
49
|
allowedTransports: string[];
|
|
50
|
+
/** Resolved deny-action patterns from SAP_DENY_ACTIONS. Populated at config-parse time. */
|
|
51
|
+
denyActions: string[];
|
|
48
52
|
}
|
|
49
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Safe defaults — mirrors DEFAULT_CONFIG in src/server/types.ts.
|
|
55
|
+
* Use this when a test needs the real ship default without re-deriving it.
|
|
56
|
+
* If you change DEFAULT_CONFIG's safety fields, update this to match.
|
|
57
|
+
*/
|
|
50
58
|
export declare function defaultSafetyConfig(): SafetyConfig;
|
|
51
|
-
/** No restrictions — use with caution */
|
|
59
|
+
/** No restrictions — use with caution. */
|
|
52
60
|
export declare function unrestrictedSafetyConfig(): SafetyConfig;
|
|
53
|
-
/** Check if an operation type is allowed by the safety config */
|
|
61
|
+
/** Check if an operation type is allowed by the safety config. */
|
|
54
62
|
export declare function isOperationAllowed(config: SafetyConfig, op: OperationTypeCode): boolean;
|
|
55
|
-
/** Check operation and throw AdtSafetyError if blocked */
|
|
63
|
+
/** Check operation and throw AdtSafetyError if blocked. */
|
|
56
64
|
export declare function checkOperation(config: SafetyConfig, op: OperationTypeCode, opName: string): void;
|
|
57
|
-
/** Check if operations on a given package are allowed */
|
|
65
|
+
/** Check if operations on a given package are allowed (write-only check). */
|
|
58
66
|
export declare function isPackageAllowed(config: SafetyConfig, pkg: string): boolean;
|
|
59
|
-
/** Check package and throw AdtSafetyError if blocked */
|
|
67
|
+
/** Check package and throw AdtSafetyError if blocked. */
|
|
60
68
|
export declare function checkPackage(config: SafetyConfig, pkg: string): void;
|
|
61
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Check transport operation. Writes require `allowWrites && allowTransportWrites`.
|
|
71
|
+
* Reads are always allowed at this layer (scope check enforces user gating upstream).
|
|
72
|
+
*/
|
|
62
73
|
export declare function checkTransport(config: SafetyConfig, transport: string, opName: string, isWrite: boolean): void;
|
|
63
|
-
/** Check git operation and throw AdtSafetyError if blocked */
|
|
64
|
-
export declare function checkGit(config: SafetyConfig, operation: string): void;
|
|
65
74
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
75
|
+
* Check git operation. Writes require `allowWrites && allowGitWrites`.
|
|
76
|
+
* Reads are always allowed at this layer.
|
|
68
77
|
*/
|
|
69
|
-
export declare function
|
|
78
|
+
export declare function checkGit(config: SafetyConfig, operation: string, isWrite?: boolean): void;
|
|
70
79
|
/**
|
|
71
|
-
* Derive a per-user safety config by merging server
|
|
72
|
-
*
|
|
73
|
-
* what the server config allows.
|
|
80
|
+
* Derive a per-user effective safety config by merging the server ceiling with
|
|
81
|
+
* the user's JWT scopes. Scopes can only RESTRICT further, never loosen.
|
|
74
82
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
83
|
+
* Uses the scope expansion rules from src/authz/policy.ts (admin implies all,
|
|
84
|
+
* write implies read, sql implies data). Callers should pass the already-expanded
|
|
85
|
+
* scope list for speed; this function re-expands as a safety net.
|
|
77
86
|
*/
|
|
78
87
|
export declare function deriveUserSafety(serverConfig: SafetyConfig, scopes: string[]): SafetyConfig;
|
|
79
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Derive a per-user effective safety by intersecting a partial SafetyConfig
|
|
90
|
+
* (from an API-key profile) with the server ceiling. Tight side wins field-by-field.
|
|
91
|
+
*
|
|
92
|
+
* Semantics:
|
|
93
|
+
* - Boolean fields: result is `server && profile` (both must be true for capability on).
|
|
94
|
+
* - `allowedPackages`:
|
|
95
|
+
* * If either side is `[]` (no restriction), use the other.
|
|
96
|
+
* * Else intersection by prefix semantics — profile entries covered by the
|
|
97
|
+
* server ceiling survive. If none survive, the effective list denies all
|
|
98
|
+
* packages/transports (true intersection).
|
|
99
|
+
* - `allowedTransports`: same as allowedPackages.
|
|
100
|
+
* - `denyActions`: union (both the server and profile denies apply).
|
|
101
|
+
*/
|
|
102
|
+
export declare function deriveUserSafetyFromProfile(serverConfig: SafetyConfig, profileSafety: Partial<SafetyConfig>): SafetyConfig;
|
|
103
|
+
/** Human-readable description of the safety configuration. */
|
|
80
104
|
export declare function describeSafety(config: SafetyConfig): string;
|
|
81
105
|
//# sourceMappingURL=safety.d.ts.map
|
package/dist/adt/safety.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../src/adt/safety.ts"],"names":[],"mappings":"AA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M,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAsB9G;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,UAAO,GAAG,IAAI,CAYtF;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,CA6B3F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,GACnC,YAAY,CAuCd;AAED,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAY3D"}
|
package/dist/adt/safety.js
CHANGED
|
@@ -4,19 +4,25 @@
|
|
|
4
4
|
* Gates all operations before they reach SAP. This is the first line of defense
|
|
5
5
|
* against unintended modifications — it runs before any HTTP call.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Design (post-authz-refactor-v2):
|
|
8
|
+
* - Safety flags are all POSITIVE opt-ins (`allow*=true` to enable a capability).
|
|
9
|
+
* Defaults are restrictive. No mix of negations and opt-ins.
|
|
10
|
+
* - Every mutation requires the matching server flag AND the user's scope
|
|
11
|
+
* (two-gate rule; scope check happens in the handler layer).
|
|
12
|
+
* - `allowWrites=false` is a TRUE no-mutation block — it stops object writes,
|
|
13
|
+
* transport writes, git writes, and activation (no loopholes).
|
|
14
|
+
* - Fine-grained per-action denials are expressed via `denyActions` (parsed
|
|
15
|
+
* from `SAP_DENY_ACTIONS`), not via op-code allow/block lists.
|
|
11
16
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
17
|
+
* Internal only: `OperationType` is the classification used by the safety
|
|
18
|
+
* engine. It is NOT admin-facing — the env vars `SAP_ALLOWED_OPS` /
|
|
19
|
+
* `SAP_DISALLOWED_OPS` were removed in v0.7. Admins configure via the `allow*`
|
|
20
|
+
* flags and `SAP_DENY_ACTIONS`.
|
|
14
21
|
*/
|
|
15
22
|
import { AdtSafetyError } from './errors.js';
|
|
16
23
|
/**
|
|
17
|
-
* Operation type codes.
|
|
18
|
-
*
|
|
19
|
-
* Example: "RSQ" = allow Read, Search, Query only.
|
|
24
|
+
* Operation type codes (internal classification).
|
|
25
|
+
* NOT admin-facing — the code just uses these as a compact categorical label.
|
|
20
26
|
*/
|
|
21
27
|
export const OperationType = {
|
|
22
28
|
Read: 'R',
|
|
@@ -33,73 +39,85 @@ export const OperationType = {
|
|
|
33
39
|
Workflow: 'W',
|
|
34
40
|
Transport: 'X',
|
|
35
41
|
};
|
|
36
|
-
/**
|
|
37
|
-
const
|
|
38
|
-
|
|
42
|
+
/** Mutating operation types — blocked when `allowWrites=false`. */
|
|
43
|
+
const MUTATING_OPS = 'CDUAWX';
|
|
44
|
+
const DENY_ALL_LIST_ENTRY = '__ARC1_DENY_ALL__';
|
|
45
|
+
function listDeniesAll(list) {
|
|
46
|
+
return list.includes(DENY_ALL_LIST_ENTRY);
|
|
47
|
+
}
|
|
48
|
+
function displayAllowList(list) {
|
|
49
|
+
return listDeniesAll(list) ? '[]' : `[${list.join(',')}]`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Safe defaults — mirrors DEFAULT_CONFIG in src/server/types.ts.
|
|
53
|
+
* Use this when a test needs the real ship default without re-deriving it.
|
|
54
|
+
* If you change DEFAULT_CONFIG's safety fields, update this to match.
|
|
55
|
+
*/
|
|
39
56
|
export function defaultSafetyConfig() {
|
|
40
57
|
return {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
allowedPackages: [],
|
|
47
|
-
dryRun: false,
|
|
48
|
-
enableGit: false,
|
|
49
|
-
enableTransports: false,
|
|
50
|
-
transportReadOnly: false,
|
|
58
|
+
allowWrites: false,
|
|
59
|
+
allowDataPreview: false,
|
|
60
|
+
allowFreeSQL: false,
|
|
61
|
+
allowTransportWrites: false,
|
|
62
|
+
allowGitWrites: false,
|
|
63
|
+
allowedPackages: ['$TMP'],
|
|
51
64
|
allowedTransports: [],
|
|
65
|
+
denyActions: [],
|
|
52
66
|
};
|
|
53
67
|
}
|
|
54
|
-
/** No restrictions — use with caution */
|
|
68
|
+
/** No restrictions — use with caution. */
|
|
55
69
|
export function unrestrictedSafetyConfig() {
|
|
56
70
|
return {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
allowWrites: true,
|
|
72
|
+
allowDataPreview: true,
|
|
73
|
+
allowFreeSQL: true,
|
|
74
|
+
allowTransportWrites: true,
|
|
75
|
+
allowGitWrites: true,
|
|
62
76
|
allowedPackages: [],
|
|
63
|
-
dryRun: false,
|
|
64
|
-
enableGit: true,
|
|
65
|
-
enableTransports: false,
|
|
66
|
-
transportReadOnly: false,
|
|
67
77
|
allowedTransports: [],
|
|
78
|
+
denyActions: [],
|
|
68
79
|
};
|
|
69
80
|
}
|
|
70
|
-
/** Check if an operation type is allowed by the safety config */
|
|
81
|
+
/** Check if an operation type is allowed by the safety config. */
|
|
71
82
|
export function isOperationAllowed(config, op) {
|
|
72
|
-
//
|
|
73
|
-
if (config.
|
|
74
|
-
return true;
|
|
75
|
-
// ReadOnly blocks all write operations
|
|
76
|
-
if (config.readOnly && WRITE_OPS.includes(op))
|
|
77
|
-
return false;
|
|
78
|
-
// BlockFreeSQL specifically blocks free SQL queries
|
|
79
|
-
if (config.blockFreeSQL && op === OperationType.FreeSQL)
|
|
80
|
-
return false;
|
|
81
|
-
// BlockData blocks named table preview queries
|
|
82
|
-
if (config.blockData && op === OperationType.Query)
|
|
83
|
+
// Mutating ops (Create/Update/Delete/Activate/Workflow/Transport) require allowWrites
|
|
84
|
+
if (MUTATING_OPS.includes(op) && !config.allowWrites)
|
|
83
85
|
return false;
|
|
84
|
-
// Transport
|
|
85
|
-
if (op === OperationType.Transport && !config.
|
|
86
|
+
// Transport mutation has an additional gate
|
|
87
|
+
if (op === OperationType.Transport && !config.allowTransportWrites)
|
|
86
88
|
return false;
|
|
87
|
-
//
|
|
88
|
-
if (config.
|
|
89
|
+
// Table preview
|
|
90
|
+
if (op === OperationType.Query && !config.allowDataPreview)
|
|
89
91
|
return false;
|
|
90
|
-
//
|
|
91
|
-
if (
|
|
92
|
+
// Free SQL
|
|
93
|
+
if (op === OperationType.FreeSQL && !config.allowFreeSQL)
|
|
92
94
|
return false;
|
|
95
|
+
// All other ops (Read/Search/Intelligence/Test/Lock) are always allowed at this layer.
|
|
96
|
+
// User-gating happens at the scope layer (ACTION_POLICY + hasRequiredScope).
|
|
93
97
|
return true;
|
|
94
98
|
}
|
|
95
|
-
/** Check operation and throw AdtSafetyError if blocked */
|
|
99
|
+
/** Check operation and throw AdtSafetyError if blocked. */
|
|
96
100
|
export function checkOperation(config, op, opName) {
|
|
97
101
|
if (!isOperationAllowed(config, op)) {
|
|
98
|
-
throw new AdtSafetyError(`Operation '${opName}' (type ${op}) is blocked by safety configuration`);
|
|
102
|
+
throw new AdtSafetyError(`Operation '${opName}' (type ${op}) is blocked by safety configuration (${explainOperationBlock(config, op)})`);
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
|
-
/**
|
|
105
|
+
/** Returns a human-readable reason why an operation is blocked. Assumes the op IS blocked. */
|
|
106
|
+
function explainOperationBlock(config, op) {
|
|
107
|
+
if (MUTATING_OPS.includes(op) && !config.allowWrites)
|
|
108
|
+
return 'reason: allowWrites=false blocks mutations (C/D/U/A/W/X)';
|
|
109
|
+
if (op === OperationType.Transport && !config.allowTransportWrites)
|
|
110
|
+
return 'reason: allowTransportWrites=false';
|
|
111
|
+
if (op === OperationType.Query && !config.allowDataPreview)
|
|
112
|
+
return 'reason: allowDataPreview=false';
|
|
113
|
+
if (op === OperationType.FreeSQL && !config.allowFreeSQL)
|
|
114
|
+
return 'reason: allowFreeSQL=false';
|
|
115
|
+
return 'reason: unknown';
|
|
116
|
+
}
|
|
117
|
+
/** Check if operations on a given package are allowed (write-only check). */
|
|
102
118
|
export function isPackageAllowed(config, pkg) {
|
|
119
|
+
if (listDeniesAll(config.allowedPackages))
|
|
120
|
+
return false;
|
|
103
121
|
if (config.allowedPackages.length === 0)
|
|
104
122
|
return true;
|
|
105
123
|
const upperPkg = pkg.toUpperCase();
|
|
@@ -117,14 +135,16 @@ export function isPackageAllowed(config, pkg) {
|
|
|
117
135
|
}
|
|
118
136
|
return false;
|
|
119
137
|
}
|
|
120
|
-
/** Check package and throw AdtSafetyError if blocked */
|
|
138
|
+
/** Check package and throw AdtSafetyError if blocked. */
|
|
121
139
|
export function checkPackage(config, pkg) {
|
|
122
140
|
if (!isPackageAllowed(config, pkg)) {
|
|
123
|
-
throw new AdtSafetyError(`Operations on package '${pkg}' are blocked by safety configuration (allowed: ${
|
|
141
|
+
throw new AdtSafetyError(`Operations on package '${pkg}' are blocked by safety configuration (allowed: ${displayAllowList(config.allowedPackages)})`);
|
|
124
142
|
}
|
|
125
143
|
}
|
|
126
|
-
/** Check if a transport is in the whitelist
|
|
144
|
+
/** Check if a transport is in the whitelist. */
|
|
127
145
|
function isTransportInWhitelist(config, transport) {
|
|
146
|
+
if (listDeniesAll(config.allowedTransports))
|
|
147
|
+
return false;
|
|
128
148
|
if (config.allowedTransports.length === 0)
|
|
129
149
|
return true;
|
|
130
150
|
const upperTransport = transport.toUpperCase();
|
|
@@ -140,96 +160,158 @@ function isTransportInWhitelist(config, transport) {
|
|
|
140
160
|
}
|
|
141
161
|
return false;
|
|
142
162
|
}
|
|
143
|
-
/**
|
|
163
|
+
/**
|
|
164
|
+
* Check transport operation. Writes require `allowWrites && allowTransportWrites`.
|
|
165
|
+
* Reads are always allowed at this layer (scope check enforces user gating upstream).
|
|
166
|
+
*/
|
|
144
167
|
export function checkTransport(config, transport, opName, isWrite) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
168
|
+
if (isWrite) {
|
|
169
|
+
if (!config.allowWrites) {
|
|
170
|
+
throw new AdtSafetyError(`Transport write '${opName}' is blocked: allowWrites=false. Set SAP_ALLOW_WRITES=true to enable writes.`);
|
|
171
|
+
}
|
|
172
|
+
if (!config.allowTransportWrites) {
|
|
173
|
+
throw new AdtSafetyError(`Transport write '${opName}' is blocked: allowTransportWrites=false. Set SAP_ALLOW_TRANSPORT_WRITES=true to enable transport mutations.`);
|
|
174
|
+
}
|
|
152
175
|
}
|
|
153
|
-
//
|
|
176
|
+
// Transport whitelist applies to both read and write
|
|
154
177
|
if (transport && transport !== '*' && config.allowedTransports.length > 0) {
|
|
155
178
|
if (!isTransportInWhitelist(config, transport)) {
|
|
156
|
-
throw new AdtSafetyError(`Operation '${opName}' on transport '${transport}' is blocked by safety configuration (allowed: ${
|
|
179
|
+
throw new AdtSafetyError(`Operation '${opName}' on transport '${transport}' is blocked by safety configuration (allowed: ${displayAllowList(config.allowedTransports)})`);
|
|
157
180
|
}
|
|
158
181
|
}
|
|
159
182
|
}
|
|
160
|
-
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Check git operation. Writes require `allowWrites && allowGitWrites`.
|
|
185
|
+
* Reads are always allowed at this layer.
|
|
186
|
+
*/
|
|
187
|
+
export function checkGit(config, operation, isWrite = true) {
|
|
188
|
+
if (!isWrite)
|
|
189
|
+
return;
|
|
190
|
+
if (!config.allowWrites) {
|
|
191
|
+
throw new AdtSafetyError(`Git write '${operation}' is blocked: allowWrites=false. Set SAP_ALLOW_WRITES=true to enable writes.`);
|
|
192
|
+
}
|
|
193
|
+
if (!config.allowGitWrites) {
|
|
194
|
+
throw new AdtSafetyError(`Git write '${operation}' is blocked: allowGitWrites=false. Set SAP_ALLOW_GIT_WRITES=true to enable git mutations.`);
|
|
164
195
|
}
|
|
165
196
|
}
|
|
166
197
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
198
|
+
* Derive a per-user effective safety config by merging the server ceiling with
|
|
199
|
+
* the user's JWT scopes. Scopes can only RESTRICT further, never loosen.
|
|
200
|
+
*
|
|
201
|
+
* Uses the scope expansion rules from src/authz/policy.ts (admin implies all,
|
|
202
|
+
* write implies read, sql implies data). Callers should pass the already-expanded
|
|
203
|
+
* scope list for speed; this function re-expands as a safety net.
|
|
169
204
|
*/
|
|
170
|
-
export function
|
|
205
|
+
export function deriveUserSafety(serverConfig, scopes) {
|
|
206
|
+
// Inline the expansion to avoid the circular import with src/authz/policy.ts.
|
|
207
|
+
// Keep in sync with expandScopes() there.
|
|
171
208
|
const expanded = new Set(scopes);
|
|
209
|
+
if (expanded.has('admin')) {
|
|
210
|
+
expanded.add('read');
|
|
211
|
+
expanded.add('write');
|
|
212
|
+
expanded.add('data');
|
|
213
|
+
expanded.add('sql');
|
|
214
|
+
expanded.add('transports');
|
|
215
|
+
expanded.add('git');
|
|
216
|
+
}
|
|
172
217
|
if (expanded.has('write'))
|
|
173
218
|
expanded.add('read');
|
|
174
219
|
if (expanded.has('sql'))
|
|
175
220
|
expanded.add('data');
|
|
176
|
-
|
|
221
|
+
const effective = {
|
|
222
|
+
...serverConfig,
|
|
223
|
+
allowedPackages: [...serverConfig.allowedPackages],
|
|
224
|
+
allowedTransports: [...serverConfig.allowedTransports],
|
|
225
|
+
denyActions: [...serverConfig.denyActions],
|
|
226
|
+
};
|
|
227
|
+
if (!expanded.has('write'))
|
|
228
|
+
effective.allowWrites = false;
|
|
229
|
+
if (!expanded.has('data'))
|
|
230
|
+
effective.allowDataPreview = false;
|
|
231
|
+
if (!expanded.has('sql'))
|
|
232
|
+
effective.allowFreeSQL = false;
|
|
233
|
+
if (!expanded.has('transports'))
|
|
234
|
+
effective.allowTransportWrites = false;
|
|
235
|
+
if (!expanded.has('git'))
|
|
236
|
+
effective.allowGitWrites = false;
|
|
237
|
+
return effective;
|
|
177
238
|
}
|
|
178
239
|
/**
|
|
179
|
-
* Derive a per-user safety
|
|
180
|
-
*
|
|
181
|
-
* what the server config allows.
|
|
240
|
+
* Derive a per-user effective safety by intersecting a partial SafetyConfig
|
|
241
|
+
* (from an API-key profile) with the server ceiling. Tight side wins field-by-field.
|
|
182
242
|
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
243
|
+
* Semantics:
|
|
244
|
+
* - Boolean fields: result is `server && profile` (both must be true for capability on).
|
|
245
|
+
* - `allowedPackages`:
|
|
246
|
+
* * If either side is `[]` (no restriction), use the other.
|
|
247
|
+
* * Else intersection by prefix semantics — profile entries covered by the
|
|
248
|
+
* server ceiling survive. If none survive, the effective list denies all
|
|
249
|
+
* packages/transports (true intersection).
|
|
250
|
+
* - `allowedTransports`: same as allowedPackages.
|
|
251
|
+
* - `denyActions`: union (both the server and profile denies apply).
|
|
185
252
|
*/
|
|
186
|
-
export function
|
|
253
|
+
export function deriveUserSafetyFromProfile(serverConfig, profileSafety) {
|
|
254
|
+
const and = (a, b) => (b === undefined ? a : a && b);
|
|
255
|
+
const intersectList = (server, profile) => {
|
|
256
|
+
if (!profile)
|
|
257
|
+
return [...server];
|
|
258
|
+
if (server.length === 0 && profile.length === 0)
|
|
259
|
+
return [];
|
|
260
|
+
if (server.length === 0)
|
|
261
|
+
return [...profile];
|
|
262
|
+
if (profile.length === 0)
|
|
263
|
+
return [...server];
|
|
264
|
+
// Profile narrows server: keep profile entries that are covered by server.
|
|
265
|
+
// "Covered by" means: there exists a server entry equal to the profile entry, or a
|
|
266
|
+
// server wildcard that matches it.
|
|
267
|
+
const covers = (serverPat, profilePat) => {
|
|
268
|
+
const s = serverPat.toUpperCase();
|
|
269
|
+
const p = profilePat.toUpperCase();
|
|
270
|
+
if (s === p)
|
|
271
|
+
return true;
|
|
272
|
+
if (s.endsWith('*')) {
|
|
273
|
+
const prefix = s.slice(0, -1);
|
|
274
|
+
if (p.startsWith(prefix))
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
return false;
|
|
278
|
+
};
|
|
279
|
+
const narrowed = profile.filter((p) => server.some((s) => covers(s, p)));
|
|
280
|
+
// True intersection: disjoint constraints mean no package/transport is allowed.
|
|
281
|
+
// We cannot return [] here because [] means "unrestricted" in SafetyConfig.
|
|
282
|
+
return narrowed.length > 0 ? narrowed : [DENY_ALL_LIST_ENTRY];
|
|
283
|
+
};
|
|
187
284
|
const effective = {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
285
|
+
allowWrites: and(serverConfig.allowWrites, profileSafety.allowWrites),
|
|
286
|
+
allowDataPreview: and(serverConfig.allowDataPreview, profileSafety.allowDataPreview),
|
|
287
|
+
allowFreeSQL: and(serverConfig.allowFreeSQL, profileSafety.allowFreeSQL),
|
|
288
|
+
allowTransportWrites: and(serverConfig.allowTransportWrites, profileSafety.allowTransportWrites),
|
|
289
|
+
allowGitWrites: and(serverConfig.allowGitWrites, profileSafety.allowGitWrites),
|
|
290
|
+
allowedPackages: intersectList(serverConfig.allowedPackages, profileSafety.allowedPackages),
|
|
291
|
+
allowedTransports: intersectList(serverConfig.allowedTransports, profileSafety.allowedTransports),
|
|
292
|
+
denyActions: [...new Set([...serverConfig.denyActions, ...(profileSafety.denyActions ?? [])])],
|
|
191
293
|
};
|
|
192
|
-
const expanded = expandImpliedScopes(scopes);
|
|
193
|
-
// No write scope → force read-only and disable transports
|
|
194
|
-
if (!expanded.includes('write')) {
|
|
195
|
-
effective.readOnly = true;
|
|
196
|
-
effective.enableGit = false;
|
|
197
|
-
effective.enableTransports = false;
|
|
198
|
-
}
|
|
199
|
-
// No data scope (and no sql, which implies data) → block table preview
|
|
200
|
-
if (!expanded.includes('data')) {
|
|
201
|
-
effective.blockData = true;
|
|
202
|
-
}
|
|
203
|
-
// No sql scope → block free SQL
|
|
204
|
-
if (!expanded.includes('sql')) {
|
|
205
|
-
effective.blockFreeSQL = true;
|
|
206
|
-
}
|
|
207
294
|
return effective;
|
|
208
295
|
}
|
|
209
|
-
/** Human-readable description of the safety configuration */
|
|
296
|
+
/** Human-readable description of the safety configuration. */
|
|
210
297
|
export function describeSafety(config) {
|
|
211
298
|
const parts = [];
|
|
212
|
-
if (config.
|
|
213
|
-
parts.push('
|
|
214
|
-
if (config.
|
|
215
|
-
parts.push('
|
|
216
|
-
if (config.
|
|
217
|
-
parts.push('
|
|
218
|
-
if (config.
|
|
219
|
-
parts.push('
|
|
220
|
-
if (config.
|
|
221
|
-
parts.push(
|
|
222
|
-
if (config.disallowedOps)
|
|
223
|
-
parts.push(`DisallowedOps=${config.disallowedOps}`);
|
|
299
|
+
if (config.allowWrites)
|
|
300
|
+
parts.push('WRITES');
|
|
301
|
+
if (config.allowDataPreview)
|
|
302
|
+
parts.push('DATA-PREVIEW');
|
|
303
|
+
if (config.allowFreeSQL)
|
|
304
|
+
parts.push('FREE-SQL');
|
|
305
|
+
if (config.allowTransportWrites)
|
|
306
|
+
parts.push('TRANSPORT-WRITES');
|
|
307
|
+
if (config.allowGitWrites)
|
|
308
|
+
parts.push('GIT-WRITES');
|
|
224
309
|
if (config.allowedPackages.length > 0)
|
|
225
|
-
parts.push(`
|
|
226
|
-
if (config.
|
|
227
|
-
parts.push(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
parts.push(`AllowedTransports=[${config.allowedTransports.join(',')}]`);
|
|
232
|
-
}
|
|
233
|
-
return parts.length === 0 ? 'UNRESTRICTED' : parts.join(', ');
|
|
310
|
+
parts.push(`Packages=${displayAllowList(config.allowedPackages)}`);
|
|
311
|
+
if (config.allowedTransports.length > 0)
|
|
312
|
+
parts.push(`Transports=${displayAllowList(config.allowedTransports)}`);
|
|
313
|
+
if (config.denyActions.length > 0)
|
|
314
|
+
parts.push(`DenyActions=${config.denyActions.length}`);
|
|
315
|
+
return parts.length === 0 ? 'READ-ONLY' : parts.join(', ');
|
|
234
316
|
}
|
|
235
317
|
//# sourceMappingURL=safety.js.map
|
package/dist/adt/safety.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safety.js","sourceRoot":"","sources":["../../src/adt/safety.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"safety.js","sourceRoot":"","sources":["../../src/adt/safety.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,GAAG;IACb,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,YAAY,EAAE,GAAG;IACjB,QAAQ,EAAE,GAAG;IACb,SAAS,EAAE,GAAG;CACN,CAAC;AAIX,mEAAmE;AACnE,MAAM,YAAY,GAAG,QAAQ,CAAC;AAC9B,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAEhD,SAAS,aAAa,CAAC,IAAc;IACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAc;IACtC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAC5D,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,WAAW,EAAE,KAAK;QAClB,gBAAgB,EAAE,KAAK;QACvB,YAAY,EAAE,KAAK;QACnB,oBAAoB,EAAE,KAAK;QAC3B,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,CAAC,MAAM,CA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,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACxD,IAAI,MAAM,CAAC,YAAY;QAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAChD,IAAI,MAAM,CAAC,oBAAoB;QAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAChE,IAAI,MAAM,CAAC,cAAc;QAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACpD,IAAI,MAAM,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,YAAY,gBAAgB,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC1G,IAAI,MAAM,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,gBAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAChH,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,eAAe,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1F,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7D,CAAC"}
|
package/dist/adt/transport.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CTS Transport management for SAP ADT.
|
|
3
3
|
*
|
|
4
|
-
* Transport
|
|
4
|
+
* Transport mutations require explicit opt-in via allowWrites + allowTransportWrites.
|
|
5
5
|
* Safety checks are applied at every entry point.
|
|
6
6
|
*/
|
|
7
7
|
import type { AdtHttpClient } from './http.js';
|
package/dist/adt/transport.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CTS Transport management for SAP ADT.
|
|
3
3
|
*
|
|
4
|
-
* Transport
|
|
4
|
+
* Transport mutations require explicit opt-in via allowWrites + allowTransportWrites.
|
|
5
5
|
* Safety checks are applied at every entry point.
|
|
6
6
|
*/
|
|
7
7
|
import { AdtApiError } from './errors.js';
|
|
@@ -144,7 +144,7 @@ async function reassignSingle(http, transportId, newOwner) {
|
|
|
144
144
|
* @param operation - `I` for insert/create, empty string for modify (default: `I`)
|
|
145
145
|
*/
|
|
146
146
|
export async function getTransportInfo(http, safety, objectUrl, devclass, operation = 'I') {
|
|
147
|
-
// Transport info is a read operation — doesn't require
|
|
147
|
+
// Transport info is a read operation — doesn't require allowTransportWrites.
|
|
148
148
|
checkOperation(safety, OperationType.Read, 'TransportInfo');
|
|
149
149
|
const body = `<?xml version="1.0" encoding="UTF-8"?>
|
|
150
150
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|