fix: 只读/调试模式允许读取传输请求与版本(enableTransports 只控制只读传输工具族,写仍由 allowedPackages/allowTransportableEdits 拦截)

This commit is contained in:
QQ597901027
2026-10-21 10:32:46 +08:00
parent bde2d48557
commit f7efe7f15d
5 changed files with 26 additions and 16 deletions
+4 -2
View File
@@ -82,10 +82,12 @@ profile 的 `package.json`:
| 模式 | 策略 | 说明 | | 模式 | 策略 | 说明 |
|---|---|---| |---|---|---|
| 只读 | `allowedPackages` 哨兵值、`enableTransports=false`、`allowTransportableEdits=false`、`allowExecution=false`、`allowDebugger=false` | 安全基线 | | 只读 | `allowedPackages` 哨兵值、`allowTransportableEdits=false`、`allowExecution=false`、`allowDebugger=false`;`enableTransports=true`(**仅用于读**传输请求/版本) | 安全基线:可搜索/读源码/读传输请求与版本/数据预览,写与激活全部拒绝 |
| 调试 | 只读 + `allowExecution=true` + `allowDebugger=true` | 断点/单步/变量/栈 | | 调试 | 只读 + `allowExecution=true` + `allowDebugger=true` | 额外允许执行触发断点、断点/单步/变量/栈;写与传输修改仍关闭 |
| 更改 | `allowTransportableEdits=true`、`enableTransports=true`、`allowExecution=true`、`allowDebugger=true`、白名单 | 写前 diff、传输请求纪律 | | 更改 | `allowTransportableEdits=true`、`enableTransports=true`、`allowExecution=true`、`allowDebugger=true`、白名单 | 写前 diff、传输请求纪律 |
> 说明:abap-adt 的 `enableTransports` 会把整个 transport 工具族(`adt_transports`、`adt_object_versions`、`adt_cochange`)一起关掉——这些在 0.12.2 里**都是只读工具**,所以只读/调试模式保持 `enableTransports=true`,真正拦写的是 `allowedPackages` 哨兵值 + `allowTransportableEdits=false`。
- 模式切换**只在设置页**,会话里不提供开关(安全); - 模式切换**只在设置页**,会话里不提供开关(安全);
- 只读/调试下白名单不生效但会保留,切回更改时复用; - 只读/调试下白名单不生效但会保留,切回更改时复用;
- 白名单存在 `<workspace>/.dsh-abap-adt/ui-settings.json`(本插件私有,abap-adt 不会读取)。 - 白名单存在 `<workspace>/.dsh-abap-adt/ui-settings.json`(本插件私有,abap-adt 不会读取)。
+4 -4
View File
@@ -38,8 +38,8 @@ window.__ModuleLoader__.load({
modeTitle: '运行模式(本工作区)', modeTitle: '运行模式(本工作区)',
modes: { 'read-only': '只读', debug: '调试', change: '更改' }, modes: { 'read-only': '只读', debug: '调试', change: '更改' },
modeHints: { modeHints: {
'read-only': '只读:写/激活/删除/传输/执行/调试全部关闭,只做调查与补丁建议。', 'read-only': '只读:写/激活/删除/执行/调试关闭;可搜索、读源码、读传输请求与版本、数据预览。',
debug: '调试:允许执行以触发断点,可用 adt_debug 设断点/单步/看变量;写与传输仍关闭。', debug: '调试:在只读基础上允许执行以触发断点,可用 adt_debug;写与传输修改仍关闭。',
change: '更改:按白名单可写(含传输,每次写需给请求号),允许执行与调试器;写前先给用户看 diff。', change: '更改:按白名单可写(含传输,每次写需给请求号),允许执行与调试器;写前先给用户看 diff。',
}, },
modeSwitched: '运行模式已切换', modeSwitched: '运行模式已切换',
@@ -101,8 +101,8 @@ window.__ModuleLoader__.load({
modeTitle: 'Run mode (this workspace)', modeTitle: 'Run mode (this workspace)',
modes: { 'read-only': 'Read-only', debug: 'Debug', change: 'Change' }, modes: { 'read-only': 'Read-only', debug: 'Debug', change: 'Change' },
modeHints: { modeHints: {
'read-only': 'Read-only: writes, activation, deletion, transports, execution and the debugger are off; investigate and propose patches only.', 'read-only': 'Read-only: writes, activation, deletion, execution and the debugger are off; search, read source, READ transport requests/versions and preview data.',
debug: 'Debug: execution is allowed to trigger breakpoints; adt_debug is available; writes and transports stay off.', debug: 'Debug: read-only plus execution to trigger breakpoints and adt_debug; writes and transport changes stay off.',
change: 'Change: whitelisted packages are writable (transports need the request number on every write), execution and the debugger are allowed; show a diff before writing.', change: 'Change: whitelisted packages are writable (transports need the request number on every write), execution and the debugger are allowed; show a diff before writing.',
}, },
modeSwitched: 'Run mode switched', modeSwitched: 'Run mode switched',
+7 -5
View File
@@ -167,21 +167,23 @@
name: '@deepseek-ai/dsh-plugin-manager/tools' name: '@deepseek-ai/dsh-plugin-manager/tools'
disabled: true disabled: true
# ============ ABAP 工具与安全基线(Read-Only baseline)============ # ============ ABAP 工具与安全基线(Read-Only baseline)============
# 预设只带「安全基线」:写/激活/删除/传输/执行/调试全部关闭。 # 预设只带「安全基线」:写/激活/删除/执行/调试关闭;传输只允许“读”
# (adt_transports / adt_object_versions 是只读工具,enableTransports 只控制
# 传输工具族与传输号校验,真正拦写的是 allowedPackages 哨兵值)。
# 运行模式由工作区文件 <workspace>/.dsh-abap-adt/destinations.yaml 的 policy # 运行模式由工作区文件 <workspace>/.dsh-abap-adt/destinations.yaml 的 policy
# 覆盖(该工作区内的目的地按工作区策略执行): # 覆盖(该工作区内的目的地按工作区策略执行):
# 只读 = 继承本基线;调试 = allowExecution + allowDebugger; # 只读 = 继承本基线(可读传输请求/版本);调试 = + allowExecution + allowDebugger;
# 更改 = allowTransportableEdits + enableTransports + allowedPackages Z*,$TMP。 # 更改 = allowTransportableEdits + allowedPackages 白名单 + allowDebugger。
# 切换入口:设置 → ABAP ADT → 运行模式(写回工作区文件,立即生效)。 # 切换入口:设置 → ABAP ADT → 运行模式(写回工作区文件,立即生效)。
- id: abap-adt - id: abap-adt
name: '@nefevcore/abap-adt-dsh-plugin' name: '@nefevcore/abap-adt-dsh-plugin'
config: config:
demo: true demo: true
defaultDestination: demo defaultDestination: demo
enableTransports: false enableTransports: true
allowTransportableEdits: false allowTransportableEdits: false
allowedPackages: "__READ_ONLY_NO_PACKAGE__" allowedPackages: "__READ_ONLY_NO_PACKAGE__"
allowedTransports: "__READ_ONLY_NO_TRANSPORT__" allowedTransports: "*"
allowExecution: false allowExecution: false
allowBatchWrites: false allowBatchWrites: false
allowDebugger: false allowDebugger: false
+10 -4
View File
@@ -65,8 +65,12 @@ const ROUTE_PREFIX = '/abap-adt'
*/ */
const MODE_POLICIES = { const MODE_POLICIES = {
'read-only': { 'read-only': {
enableTransports: false, // Transport READS stay available in read-only mode: `enableTransports`
allowedTransports: '__READ_ONLY_NO_TRANSPORT__', // gates the transport tool family (adt_transports / adt_object_versions —
// both read-only tools); writes are blocked by the package sentinel below
// plus allowTransportableEdits=false.
enableTransports: true,
allowedTransports: '*',
allowTransportableEdits: false, allowTransportableEdits: false,
allowedPackages: '__READ_ONLY_NO_PACKAGE__', allowedPackages: '__READ_ONLY_NO_PACKAGE__',
allowExecution: false, allowExecution: false,
@@ -75,8 +79,10 @@ const MODE_POLICIES = {
allowDebugVariables: false, allowDebugVariables: false,
}, },
debug: { debug: {
enableTransports: false, // Same transport-read exception as read-only; the debugger/execution are
allowedTransports: '__READ_ONLY_NO_TRANSPORT__', // what this mode adds.
enableTransports: true,
allowedTransports: '*',
allowTransportableEdits: false, allowTransportableEdits: false,
allowedPackages: '__READ_ONLY_NO_PACKAGE__', allowedPackages: '__READ_ONLY_NO_PACKAGE__',
allowExecution: true, allowExecution: true,
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dsh-abap-workbench", "name": "dsh-abap-workbench",
"version": "0.1.0", "version": "0.1.1",
"private": false, "private": false,
"description": "SAP ABAP 工作台:一个 DSH bundle,内含 ABAP 预设(只读/调试/更改,按工作区策略切换)、可视化配置页(目的地、连接测试、运行模式、可写白名单)和会话状态徽章。依赖 @nefevcore/abap-adt-dsh-plugin 提供 adt_* 工具。", "description": "SAP ABAP 工作台:一个 DSH bundle,内含 ABAP 预设(只读/调试/更改,按工作区策略切换)、可视化配置页(目的地、连接测试、运行模式、可写白名单)和会话状态徽章。依赖 @nefevcore/abap-adt-dsh-plugin 提供 adt_* 工具。",
"type": "module", "type": "module",