@synopackageland/cli 0.8.0 → 0.9.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/CHANGELOG.md +124 -0
- package/README.md +26 -4
- package/dist/add.js +4 -17
- package/dist/authorization-sdk.d.ts +0 -1
- package/dist/authorization-sdk.js +0 -1
- package/dist/build-spk/gateway.js +2 -2
- package/dist/build-spk/notices.js +12 -8
- package/dist/capability-overlays.d.ts +15 -0
- package/dist/capability-overlays.js +18 -0
- package/dist/cli-version.d.ts +2 -0
- package/dist/cli-version.js +3 -0
- package/dist/cli.js +3 -1
- package/dist/error-registry.js +12 -4
- package/dist/info.js +2 -1
- package/dist/init.js +52 -58
- package/dist/reproducible.js +1 -1
- package/dist/runtime/delegate-contract.d.ts +15 -0
- package/dist/runtime/delegate-contract.js +2 -0
- package/dist/runtime/executor-build.d.ts +15 -1
- package/dist/runtime/executor-build.js +42 -11
- package/dist/runtime/executor-digests.json +13 -0
- package/dist/runtime/executor-inspect.d.ts +1 -0
- package/dist/runtime/executor-inspect.js +5 -2
- package/dist/runtime/executor-policy.d.ts +3 -1
- package/dist/runtime/executor-policy.js +7 -2
- package/dist/runtime/executor-source.d.ts +21 -0
- package/dist/runtime/executor-source.js +35 -0
- package/dist/runtime/executor-tasks.d.ts +5 -2
- package/dist/runtime/executor-tasks.js +6 -4
- package/dist/runtime/sdk-source.d.ts +31 -0
- package/dist/runtime/sdk-source.js +92 -0
- package/dist/standalone/api-permissions.d.ts +4 -1
- package/dist/standalone/api-permissions.js +10 -18
- package/dist/standalone/build.d.ts +1 -0
- package/dist/standalone/build.js +11 -4
- package/dist/standalone/daemon.js +2 -2
- package/dist/standalone/dsm-window.js +2 -2
- package/dist/standalone/manifest.d.ts +5 -2
- package/dist/standalone/manifest.js +9 -3
- package/dist/standalone/root-window.d.ts +1 -1
- package/dist/standalone/root-window.js +0 -1
- package/dist/standalone/sdk-check.d.ts +9 -0
- package/dist/standalone/sdk-check.js +43 -0
- package/dist/standalone/spk.js +1 -1
- package/dist/template-paths.d.ts +7 -2
- package/dist/template-paths.js +18 -6
- package/package.json +13 -3
- package/dist/templates/_executor/README.md +0 -318
- package/dist/templates/_executor/anchor.go +0 -156
- package/dist/templates/_executor/anchor_test.go +0 -161
- package/dist/templates/_executor/apppriv_review_test.go +0 -28
- package/dist/templates/_executor/auth_presence_review_test.go +0 -38
- package/dist/templates/_executor/cancel_contract_test.go +0 -236
- package/dist/templates/_executor/cmd/lifecycle/main.go +0 -42
- package/dist/templates/_executor/cookie_review_test.go +0 -27
- package/dist/templates/_executor/copy.go +0 -64
- package/dist/templates/_executor/copy_test.go +0 -88
- package/dist/templates/_executor/digest_review_test.go +0 -120
- package/dist/templates/_executor/directories.go +0 -40
- package/dist/templates/_executor/dsm.go +0 -369
- package/dist/templates/_executor/dsm_test.go +0 -290
- package/dist/templates/_executor/executor.go +0 -735
- package/dist/templates/_executor/executor_test.go +0 -314
- package/dist/templates/_executor/go.mod +0 -5
- package/dist/templates/_executor/identity.go +0 -74
- package/dist/templates/_executor/identity_kernel_linux_test.go +0 -60
- package/dist/templates/_executor/identity_linux.go +0 -82
- package/dist/templates/_executor/identity_security_test.go +0 -43
- package/dist/templates/_executor/internal/lifecycle/lifecycle.go +0 -95
- package/dist/templates/_executor/internal/lifecycle/lifecycle_test.go +0 -232
- package/dist/templates/_executor/internal/taskscript/boot.sh +0 -31
- package/dist/templates/_executor/internal/taskscript/cmd/main.go +0 -19
- package/dist/templates/_executor/internal/taskscript/control.sh +0 -31
- package/dist/templates/_executor/internal/taskscript/tasks.go +0 -44
- package/dist/templates/_executor/json_review_test.go +0 -40
- package/dist/templates/_executor/lifecycle_test.go +0 -97
- package/dist/templates/_executor/link_linux.go +0 -28
- package/dist/templates/_executor/long_running_test.go +0 -530
- package/dist/templates/_executor/main.go +0 -576
- package/dist/templates/_executor/managed.go +0 -117
- package/dist/templates/_executor/managed_test.go +0 -137
- package/dist/templates/_executor/move_linux.go +0 -490
- package/dist/templates/_executor/move_linux_test.go +0 -460
- package/dist/templates/_executor/move_validation.go +0 -46
- package/dist/templates/_executor/move_validation_test.go +0 -187
- package/dist/templates/_executor/operations.go +0 -926
- package/dist/templates/_executor/path_test.go +0 -35
- package/dist/templates/_executor/pid.go +0 -37
- package/dist/templates/_executor/pid_test.go +0 -113
- package/dist/templates/_executor/platform_linux.go +0 -187
- package/dist/templates/_executor/platform_linux_test.go +0 -191
- package/dist/templates/_executor/platform_other.go +0 -76
- package/dist/templates/_executor/process.go +0 -142
- package/dist/templates/_executor/purge_log.go +0 -18
- package/dist/templates/_executor/records.go +0 -242
- package/dist/templates/_executor/scope_cancel_contract_test.go +0 -91
- package/dist/templates/_executor/scope_client.go +0 -37
- package/dist/templates/_executor/scope_contract.go +0 -12
- package/dist/templates/_executor/selected_scope.go +0 -146
- package/dist/templates/_executor/selected_scope_test.go +0 -186
- package/dist/templates/_executor/socket_linux_test.go +0 -46
- package/dist/templates/_executor/status_disabled_test.go +0 -33
- package/dist/templates/_executor/store.go +0 -91
- package/dist/templates/_executor/supervise.go +0 -109
- package/dist/templates/_executor/supervise_test.go +0 -130
- package/dist/templates/_executor/task_race_review_test.go +0 -47
- package/dist/templates/_executor/tasks.go +0 -320
- package/dist/templates/_executor/tasks_dsm71_test.go +0 -114
- package/dist/templates/_executor/tasks_review_test.go +0 -43
- package/dist/templates/_executor/tasks_test.go +0 -223
- package/dist/templates/_executor/testdata/evidence/cleanup.json +0 -24
- package/dist/templates/_executor/testdata/evidence/final-smoke.jsonl +0 -9
- package/dist/templates/_executor/testdata/evidence/kernel-acl.json +0 -6
- package/dist/templates/_executor/testdata/evidence/linux-tests.log +0 -123
- package/dist/templates/_executor/testdata/evidence/live.jsonl +0 -23
- package/dist/templates/_executor/testdata/evidence/storage.json +0 -90
- package/dist/templates/_executor/testdata/evidence/validation.json +0 -55
- package/dist/templates/_executor/testdata/live_probe.py +0 -98
- package/dist/templates/_executor/upgrade_watch_test.go +0 -244
- package/dist/templates/_executor/watch.go +0 -164
- package/dist/templates/_executor/watch_test.go +0 -291
- package/dist/templates/_executor/write_review_linux_test.go +0 -87
- package/dist/templates/_shared/AGENTS.md +0 -146
- package/dist/templates/_shared/CLAUDE.md +0 -1
- package/dist/templates/_shared/third-party-notices.mjs +0 -51
- package/dist/templates/binary/LICENSES/GO-LICENSE +0 -27
- package/dist/templates/binary/LICENSES/GO-PATENTS +0 -22
- package/dist/templates/binary/dsm-package.yaml +0 -46
- package/dist/templates/binary/example/main.go +0 -16
- package/dist/templates/binary/gitignore +0 -2
- package/dist/templates/binary/i18n/messages/de.json +0 -4
- package/dist/templates/binary/i18n/messages/en.json +0 -4
- package/dist/templates/binary/i18n/messages/es.json +0 -4
- package/dist/templates/binary/i18n/messages/fr.json +0 -4
- package/dist/templates/binary/i18n/messages/it.json +0 -4
- package/dist/templates/binary/i18n/messages/ja.json +0 -4
- package/dist/templates/binary/i18n/messages/ko.json +0 -4
- package/dist/templates/binary/i18n/messages/zh-CN.json +0 -4
- package/dist/templates/binary/i18n/messages/zh-TW.json +0 -4
- package/dist/templates/binary/ui/app.css +0 -4
- package/dist/templates/binary/ui/app.js +0 -32
- package/dist/templates/compose/compose.yaml +0 -8
- package/dist/templates/compose/synology-app.yaml +0 -16
- package/dist/templates/native-authorization/AuthorizationGate.vue +0 -91
- package/dist/templates/native-authorization/i18n/de.json +0 -37
- package/dist/templates/native-authorization/i18n/en.json +0 -37
- package/dist/templates/native-authorization/i18n/es.json +0 -37
- package/dist/templates/native-authorization/i18n/fr.json +0 -37
- package/dist/templates/native-authorization/i18n/index.ts +0 -15
- package/dist/templates/native-authorization/i18n/it.json +0 -37
- package/dist/templates/native-authorization/i18n/ja.json +0 -37
- package/dist/templates/native-authorization/i18n/ko.json +0 -37
- package/dist/templates/native-authorization/i18n/zh-CN.json +0 -37
- package/dist/templates/native-authorization/i18n/zh-TW.json +0 -37
- package/dist/templates/native-go/README.md +0 -459
- package/dist/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +0 -61
- package/dist/templates/native-go/backend/cmd/app/main.go +0 -95
- package/dist/templates/native-go/backend/cmd/background-worker/main.go +0 -38
- package/dist/templates/native-go/backend/go.mod +0 -9
- package/dist/templates/native-go/backend/go.sum +0 -4
- package/dist/templates/native-go/backend/internal/api/cgi_framing_test.go +0 -32
- package/dist/templates/native-go/backend/internal/api/cookie_review_test.go +0 -28
- package/dist/templates/native-go/backend/internal/api/deadline_test.go +0 -114
- package/dist/templates/native-go/backend/internal/api/dsm-session.go +0 -54
- package/dist/templates/native-go/backend/internal/api/dsm-session_test.go +0 -51
- package/dist/templates/native-go/backend/internal/api/entry_test.go +0 -47
- package/dist/templates/native-go/backend/internal/api/errors.go +0 -47
- package/dist/templates/native-go/backend/internal/api/permissions.go +0 -161
- package/dist/templates/native-go/backend/internal/api/permissions.json +0 -5
- package/dist/templates/native-go/backend/internal/api/permissions_test.go +0 -113
- package/dist/templates/native-go/backend/internal/api/policy_fixture_test.go +0 -8
- package/dist/templates/native-go/backend/internal/api/registry.go +0 -142
- package/dist/templates/native-go/backend/internal/api/registry_test.go +0 -344
- package/dist/templates/native-go/backend/internal/api/resource_limits_test.go +0 -87
- package/dist/templates/native-go/backend/internal/api/sdk-permissions.json +0 -59
- package/dist/templates/native-go/backend/internal/api/sdk_policy_test.go +0 -31
- package/dist/templates/native-go/backend/internal/api/server.go +0 -305
- package/dist/templates/native-go/backend/internal/api/testdata/permissions-cases.json +0 -172
- package/dist/templates/native-go/backend/internal/app/background.go +0 -249
- package/dist/templates/native-go/backend/internal/app/background_none.go +0 -8
- package/dist/templates/native-go/backend/internal/app/background_owner.go +0 -38
- package/dist/templates/native-go/backend/internal/app/background_owner_test.go +0 -163
- package/dist/templates/native-go/backend/internal/app/background_schedule.go +0 -69
- package/dist/templates/native-go/backend/internal/app/background_schedule_test.go +0 -62
- package/dist/templates/native-go/backend/internal/app/background_test.go +0 -320
- package/dist/templates/native-go/backend/internal/app/delegate_config.go +0 -57
- package/dist/templates/native-go/backend/internal/app/delegate_config_test.go +0 -28
- package/dist/templates/native-go/backend/internal/app/delegate_none.go +0 -5
- package/dist/templates/native-go/backend/internal/app/identity.go +0 -20
- package/dist/templates/native-go/backend/internal/app/identity_test.go +0 -15
- package/dist/templates/native-go/backend/internal/app/migrations.go +0 -41
- package/dist/templates/native-go/backend/internal/app/migrations_test.go +0 -41
- package/dist/templates/native-go/backend/internal/app/portal.go +0 -30
- package/dist/templates/native-go/backend/internal/app/portal_test.go +0 -55
- package/dist/templates/native-go/backend/internal/app/root_none.go +0 -9
- package/dist/templates/native-go/backend/internal/app/routes.go +0 -137
- package/dist/templates/native-go/backend/internal/app/routes_test.go +0 -165
- package/dist/templates/native-go/backend/internal/app/session_files.go +0 -9
- package/dist/templates/native-go/backend/internal/app/session_files_test.go +0 -14
- package/dist/templates/native-go/backend/internal/app/shared_folder.go +0 -144
- package/dist/templates/native-go/backend/internal/app/shared_folder_test.go +0 -158
- package/dist/templates/native-go/backend/internal/background/access.go +0 -57
- package/dist/templates/native-go/backend/internal/background/lock_test.go +0 -131
- package/dist/templates/native-go/backend/internal/background/owner_test.go +0 -118
- package/dist/templates/native-go/backend/internal/background/runner.go +0 -185
- package/dist/templates/native-go/backend/internal/background/runner_test.go +0 -209
- package/dist/templates/native-go/backend/internal/background/schedule.go +0 -336
- package/dist/templates/native-go/backend/internal/background/schedule_test.go +0 -368
- package/dist/templates/native-go/backend/internal/background/store.go +0 -825
- package/dist/templates/native-go/backend/internal/background/store_test.go +0 -365
- package/dist/templates/native-go/backend/internal/datamigrate/migrate.go +0 -191
- package/dist/templates/native-go/backend/internal/datamigrate/migrate_test.go +0 -177
- package/dist/templates/native-go/backend/internal/dsm/admin.go +0 -76
- package/dist/templates/native-go/backend/internal/dsm/admin_linux.go +0 -110
- package/dist/templates/native-go/backend/internal/dsm/admin_linux_test.go +0 -105
- package/dist/templates/native-go/backend/internal/dsm/admin_other.go +0 -15
- package/dist/templates/native-go/backend/internal/dsm/admin_test.go +0 -67
- package/dist/templates/native-go/backend/internal/dsm/apppriv.go +0 -30
- package/dist/templates/native-go/backend/internal/dsm/auth.go +0 -94
- package/dist/templates/native-go/backend/internal/dsm/auth_test.go +0 -159
- package/dist/templates/native-go/backend/internal/dsm/bridge_file.go +0 -75
- package/dist/templates/native-go/backend/internal/dsm/bridge_file_test.go +0 -57
- package/dist/templates/native-go/backend/internal/dsm/entry.go +0 -177
- package/dist/templates/native-go/backend/internal/dsm/entry_test.go +0 -315
- package/dist/templates/native-go/backend/internal/dsm/native/admin-aarch64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/admin-armv7.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/admin-x86_64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/admin_check.c +0 -28
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv-aarch64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv-armv7.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv-x86_64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv_check.c +0 -33
- package/dist/templates/native-go/backend/internal/dsm/native/build.sh +0 -18
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/GLIBC-NOTICES.txt +0 -400
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/LGPL-2.1.txt +0 -501
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/SOURCE.txt +0 -5
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/ZIG-MIT.txt +0 -21
- package/dist/templates/native-go/backend/internal/dsm/native/provenance.json +0 -18
- package/dist/templates/native-go/backend/internal/filestation/browse_test.go +0 -67
- package/dist/templates/native-go/backend/internal/filestation/check_permission.go +0 -71
- package/dist/templates/native-go/backend/internal/filestation/check_permission_test.go +0 -77
- package/dist/templates/native-go/backend/internal/filestation/client.go +0 -337
- package/dist/templates/native-go/backend/internal/filestation/client_test.go +0 -155
- package/dist/templates/native-go/backend/internal/filestation/doc.go +0 -4
- package/dist/templates/native-go/backend/internal/filestation/download_dsm71_test.go +0 -82
- package/dist/templates/native-go/backend/internal/filestation/http.go +0 -70
- package/dist/templates/native-go/backend/internal/filestation/http_test.go +0 -188
- package/dist/templates/native-go/backend/internal/filestation/operations_test.go +0 -206
- package/dist/templates/native-go/backend/internal/filestation/read_file_test.go +0 -89
- package/dist/templates/native-go/backend/internal/filestation/sdk_policy_test.go +0 -39
- package/dist/templates/native-go/backend/internal/filestation/service.go +0 -254
- package/dist/templates/native-go/backend/internal/filestation/service_test.go +0 -74
- package/dist/templates/native-go/backend/internal/filestation/upload_stream.go +0 -76
- package/dist/templates/native-go/backend/internal/filestation/upload_stream_test.go +0 -77
- package/dist/templates/native-go/backend/internal/filestation/write.go +0 -32
- package/dist/templates/native-go/backend/internal/filestation/write_test.go +0 -124
- package/dist/templates/native-go/backend/internal/identity/README.md +0 -59
- package/dist/templates/native-go/backend/internal/identity/dsm.go +0 -115
- package/dist/templates/native-go/backend/internal/identity/http.go +0 -291
- package/dist/templates/native-go/backend/internal/identity/identity_test.go +0 -530
- package/dist/templates/native-go/backend/internal/identity/service.go +0 -159
- package/dist/templates/native-go/backend/internal/identity/store.go +0 -109
- package/dist/templates/native-go/backend/internal/jsonlimits/limits.go +0 -48
- package/dist/templates/native-go/backend/internal/jsonlimits/limits_test.go +0 -52
- package/dist/templates/native-go/backend/internal/portal/portal.go +0 -138
- package/dist/templates/native-go/backend/internal/portal/portal_test.go +0 -89
- package/dist/templates/native-go/dsm-package.yaml +0 -71
- package/dist/templates/native-go/gitignore +0 -1
- package/dist/templates/native-go/i18n/glossary.json +0 -663
- package/dist/templates/native-go/i18n/messages/de.json +0 -29
- package/dist/templates/native-go/i18n/messages/en.json +0 -29
- package/dist/templates/native-go/i18n/messages/es.json +0 -29
- package/dist/templates/native-go/i18n/messages/fr.json +0 -29
- package/dist/templates/native-go/i18n/messages/it.json +0 -29
- package/dist/templates/native-go/i18n/messages/ja.json +0 -29
- package/dist/templates/native-go/i18n/messages/ko.json +0 -29
- package/dist/templates/native-go/i18n/messages/zh-CN.json +0 -29
- package/dist/templates/native-go/i18n/messages/zh-TW.json +0 -29
- package/dist/templates/native-go/ui/app.css +0 -45
- package/dist/templates/native-go/ui/app.js +0 -111
- package/dist/templates/native-go-delegate/DELEGATE.md +0 -263
- package/dist/templates/native-go-delegate/backend/cmd/background-worker/main.go +0 -48
- package/dist/templates/native-go-delegate/backend/internal/app/delegate.go +0 -25
- package/dist/templates/native-go-delegate/backend/internal/app/delegate_on.go +0 -5
- package/dist/templates/native-go-delegate/backend/internal/app/delegate_routes_test.go +0 -31
- package/dist/templates/native-go-delegate/backend/internal/background/delegate_review_test.go +0 -174
- package/dist/templates/native-go-delegate/backend/internal/background/delegated.go +0 -277
- package/dist/templates/native-go-delegate/backend/internal/background/delegated_moves.go +0 -270
- package/dist/templates/native-go-delegate/backend/internal/background/delegated_test.go +0 -34
- package/dist/templates/native-go-delegate/backend/internal/delegate/admission_recovery_test.go +0 -410
- package/dist/templates/native-go-delegate/backend/internal/delegate/busy_review_test.go +0 -15
- package/dist/templates/native-go-delegate/backend/internal/delegate/cancel_contract_test.go +0 -95
- package/dist/templates/native-go-delegate/backend/internal/delegate/client.go +0 -151
- package/dist/templates/native-go-delegate/backend/internal/delegate/client_test.go +0 -214
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination.go +0 -110
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination_state.go +0 -117
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination_state_test.go +0 -60
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination_test.go +0 -116
- package/dist/templates/native-go-delegate/backend/internal/delegate/example.go +0 -81
- package/dist/templates/native-go-delegate/backend/internal/delegate/example_test.go +0 -91
- package/dist/templates/native-go-delegate/backend/internal/delegate/executor_contract_test.go +0 -511
- package/dist/templates/native-go-delegate/backend/internal/delegate/files.go +0 -132
- package/dist/templates/native-go-delegate/backend/internal/delegate/long_running_routes.go +0 -92
- package/dist/templates/native-go-delegate/backend/internal/delegate/long_running_routes_test.go +0 -99
- package/dist/templates/native-go-delegate/backend/internal/delegate/move.go +0 -348
- package/dist/templates/native-go-delegate/backend/internal/delegate/move_test.go +0 -351
- package/dist/templates/native-go-delegate/backend/internal/delegate/operations_list.go +0 -65
- package/dist/templates/native-go-delegate/backend/internal/delegate/operations_list_test.go +0 -114
- package/dist/templates/native-go-delegate/backend/internal/delegate/retry.go +0 -106
- package/dist/templates/native-go-delegate/backend/internal/delegate/retry_test.go +0 -143
- package/dist/templates/native-go-delegate/backend/internal/delegate/service.go +0 -364
- package/dist/templates/native-go-delegate/backend/internal/delegate/service_test.go +0 -318
- package/dist/templates/native-go-delegate/backend/internal/delegate/staging.go +0 -121
- package/dist/templates/native-go-delegate/backend/internal/delegate/status_disabled_test.go +0 -51
- package/dist/templates/native-go-delegate/backend/internal/delegate/testdata/executor_contract.txt +0 -112
- package/dist/templates/native-go-delegate/backend/internal/delegate/transient_contract_test.go +0 -137
- package/dist/templates/native-go-delegate/backend/internal/delegate/wait_cancel_test.go +0 -101
- package/dist/templates/native-go-delegate/backend/internal/delegate/worker.go +0 -225
- package/dist/templates/native-go-delegate/backend/internal/filestation/files.go +0 -43
- package/dist/templates/native-go-delegate/backend/internal/filestation/files_test.go +0 -59
- package/dist/templates/native-go-delegate/frontend/src/CapabilityPanels.vue +0 -37
- package/dist/templates/native-go-delegate/frontend/src/delegate/BackgroundSavePanel.vue +0 -113
- package/dist/templates/native-go-delegate/frontend/src/delegate/DelegatePanel.vue +0 -70
- package/dist/templates/native-go-delegate/frontend/src/delegate/copy.ts +0 -8
- package/dist/templates/native-go-delegate/frontend/src/delegate/i18n/waiting.json +0 -11
- package/dist/templates/native-go-delegate/frontend/test/background-save.test.ts +0 -121
- package/dist/templates/native-go-delegate/frontend/test/delegate.test.ts +0 -145
- package/dist/templates/native-go-delegate/frontend/test/scope-settings.test.ts +0 -49
- package/dist/templates/native-go-delegate/test-frontend.sh +0 -12
- package/dist/templates/native-go-delegate/test.sh +0 -18
- package/dist/templates/native-go-jobs/BACKGROUND.md +0 -108
- package/dist/templates/native-go-jobs/backend/internal/app/background_on.go +0 -7
- package/dist/templates/native-go-jobs/backend/internal/app/background_routes_test.go +0 -90
- package/dist/templates/native-go-jobs/frontend/src/background/BackgroundPanel.vue +0 -170
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/de.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/en.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/es.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/fr.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/it.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/ja.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/ko.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/zh-CN.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/zh-TW.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n.ts +0 -19
- package/dist/templates/native-go-jobs/frontend/src/background/picker-provider.ts +0 -12
- package/dist/templates/native-go-jobs/frontend/src/background/request-key.ts +0 -5
- package/dist/templates/native-go-jobs/frontend/test/background.test.ts +0 -205
- package/dist/templates/native-go-root-ops/backend/internal/app/executor.go +0 -140
- package/dist/templates/native-go-root-ops/backend/internal/app/executor_test.go +0 -117
- package/dist/templates/native-go-root-ops/root/whoami.sh +0 -3
- package/dist/templates/native-go-vue/README.md +0 -47
- package/dist/templates/native-go-vue/frontend/DESIGN.md +0 -61
- package/dist/templates/native-go-vue/frontend/package-lock.json +0 -2530
- package/dist/templates/native-go-vue/frontend/package.json +0 -6
- package/dist/templates/native-go-vue/frontend/src/App.vue +0 -96
- package/dist/templates/native-go-vue/frontend/src/CapabilityPanels.vue +0 -6
- package/dist/templates/native-go-vue/frontend/src/context.ts +0 -78
- package/dist/templates/native-go-vue/frontend/src/delegate/ExecutorSettings.vue +0 -70
- package/dist/templates/native-go-vue/frontend/src/delegate/catalogs.ts +0 -11
- package/dist/templates/native-go-vue/frontend/src/delegate/copy.test.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/delegate/copy.ts +0 -4
- package/dist/templates/native-go-vue/frontend/src/delegate/executor-settings.test.ts +0 -23
- package/dist/templates/native-go-vue/frontend/src/delegate/executor-setup.ts +0 -24
- package/dist/templates/native-go-vue/frontend/src/delegate/facade.test.ts +0 -100
- package/dist/templates/native-go-vue/frontend/src/delegate/facade.ts +0 -85
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/de.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/en.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/es.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/fr.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/it.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/ja.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/ko.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/de.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/en.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/es.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/fr.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/it.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/ja.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/ko.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-CN.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-TW.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/zh-CN.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/zh-TW.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/long-running.ts +0 -57
- package/dist/templates/native-go-vue/frontend/src/delegate/save-copy.test.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/delegate/save-copy.ts +0 -24
- package/dist/templates/native-go-vue/frontend/src/delegate/scoped-picker.test.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/delegate/scoped-picker.ts +0 -21
- package/dist/templates/native-go-vue/frontend/src/files/FileBrowser.vue +0 -131
- package/dist/templates/native-go-vue/frontend/src/files/FilesPage.vue +0 -35
- package/dist/templates/native-go-vue/frontend/src/files/files.test.ts +0 -100
- package/dist/templates/native-go-vue/frontend/src/files/provider.test.ts +0 -48
- package/dist/templates/native-go-vue/frontend/src/files/transfers.test.ts +0 -27
- package/dist/templates/native-go-vue/frontend/src/files/transfers.ts +0 -25
- package/dist/templates/native-go-vue/frontend/src/i18n/de.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/en.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/es.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/fr.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/it.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/ja.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/ko.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/zh-CN.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/zh-TW.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n.ts +0 -13
- package/dist/templates/native-go-vue/frontend/src/identity/DESIGN.md +0 -46
- package/dist/templates/native-go-vue/frontend/src/identity/LoginPage.vue +0 -78
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/de.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/en.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/es.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/fr.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/it.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/ja.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/ko.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/zh-CN.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/zh-TW.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n.ts +0 -14
- package/dist/templates/native-go-vue/frontend/src/identity/login.test.ts +0 -32
- package/dist/templates/native-go-vue/frontend/src/identity/session.test.ts +0 -33
- package/dist/templates/native-go-vue/frontend/src/identity/session.ts +0 -74
- package/dist/templates/native-go-vue/frontend/src/main.ts +0 -32
- package/dist/templates/native-go-vue/frontend/src/nas/NasPicker.vue +0 -42
- package/dist/templates/native-go-vue/frontend/src/nas/contract.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/nas/destination.test.ts +0 -48
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/de.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/en.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/es.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/fr.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/it.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/ja.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/ko.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/zh-CN.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/zh-TW.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n.ts +0 -2
- package/dist/templates/native-go-vue/frontend/src/nas/locale.ts +0 -24
- package/dist/templates/native-go-vue/frontend/src/nas/provider.ts +0 -50
- package/dist/templates/native-go-vue/frontend/src/nas/use-request.ts +0 -18
- package/dist/templates/native-go-vue/frontend/src/portal/PortalSettings.vue +0 -39
- package/dist/templates/native-go-vue/frontend/src/shell/AppShell.vue +0 -48
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/de.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/en.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/es.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/fr.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/it.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ja.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ko.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n.ts +0 -17
- package/dist/templates/native-go-vue/frontend/src/shell/pages.ts +0 -15
- package/dist/templates/native-go-vue/frontend/src/style.css +0 -27
- package/dist/templates/native-go-vue/frontend/test/apps.test.ts +0 -57
- package/dist/templates/native-go-vue/frontend/test/native-controls.test.ts +0 -27
- package/dist/templates/native-go-vue/frontend/test/portal-settings.test.ts +0 -71
- package/dist/templates/native-go-vue/frontend/test/shell-i18n.test.ts +0 -50
- package/dist/templates/native-go-vue/frontend/test/shell-ui.test.ts +0 -20
- package/dist/templates/native-go-vue/frontend/test/shell.test.ts +0 -30
- package/dist/templates/native-go-vue/frontend/tsconfig.json +0 -1
- package/dist/templates/native-go-vue/frontend/vite.config.ts +0 -10
- package/dist/templates/native-go-vue/gitignore +0 -2
- package/templates/_daemon/fixture_linux_test.go +0 -15
- package/templates/_daemon/fixture_other_test.go +0 -7
- package/templates/_daemon/go.mod +0 -5
- package/templates/_daemon/main.go +0 -611
- package/templates/_daemon/main_test.go +0 -315
- package/templates/_daemon/process_linux.go +0 -55
- package/templates/_daemon/process_linux_test.go +0 -161
- package/templates/_daemon/process_other.go +0 -14
- package/templates/_daemon/testdata/child.go +0 -44
- package/templates/_executor/README.md +0 -318
- package/templates/_executor/anchor.go +0 -156
- package/templates/_executor/anchor_test.go +0 -161
- package/templates/_executor/apppriv_review_test.go +0 -28
- package/templates/_executor/auth_presence_review_test.go +0 -38
- package/templates/_executor/cancel_contract_test.go +0 -236
- package/templates/_executor/cmd/lifecycle/main.go +0 -42
- package/templates/_executor/cookie_review_test.go +0 -27
- package/templates/_executor/copy.go +0 -64
- package/templates/_executor/copy_test.go +0 -88
- package/templates/_executor/digest_review_test.go +0 -120
- package/templates/_executor/directories.go +0 -40
- package/templates/_executor/dsm.go +0 -369
- package/templates/_executor/dsm_test.go +0 -290
- package/templates/_executor/executor.go +0 -735
- package/templates/_executor/executor_test.go +0 -314
- package/templates/_executor/go.mod +0 -5
- package/templates/_executor/identity.go +0 -74
- package/templates/_executor/identity_kernel_linux_test.go +0 -60
- package/templates/_executor/identity_linux.go +0 -82
- package/templates/_executor/identity_security_test.go +0 -43
- package/templates/_executor/internal/lifecycle/lifecycle.go +0 -95
- package/templates/_executor/internal/lifecycle/lifecycle_test.go +0 -232
- package/templates/_executor/internal/taskscript/boot.sh +0 -31
- package/templates/_executor/internal/taskscript/cmd/main.go +0 -19
- package/templates/_executor/internal/taskscript/control.sh +0 -31
- package/templates/_executor/internal/taskscript/tasks.go +0 -44
- package/templates/_executor/json_review_test.go +0 -40
- package/templates/_executor/lifecycle_test.go +0 -97
- package/templates/_executor/link_linux.go +0 -28
- package/templates/_executor/long_running_test.go +0 -530
- package/templates/_executor/main.go +0 -576
- package/templates/_executor/managed.go +0 -117
- package/templates/_executor/managed_test.go +0 -137
- package/templates/_executor/move_linux.go +0 -490
- package/templates/_executor/move_linux_test.go +0 -460
- package/templates/_executor/move_validation.go +0 -46
- package/templates/_executor/move_validation_test.go +0 -187
- package/templates/_executor/operations.go +0 -926
- package/templates/_executor/path_test.go +0 -35
- package/templates/_executor/pid.go +0 -37
- package/templates/_executor/pid_test.go +0 -113
- package/templates/_executor/platform_linux.go +0 -187
- package/templates/_executor/platform_linux_test.go +0 -191
- package/templates/_executor/platform_other.go +0 -76
- package/templates/_executor/process.go +0 -142
- package/templates/_executor/purge_log.go +0 -18
- package/templates/_executor/records.go +0 -242
- package/templates/_executor/scope_cancel_contract_test.go +0 -91
- package/templates/_executor/scope_client.go +0 -37
- package/templates/_executor/scope_contract.go +0 -12
- package/templates/_executor/selected_scope.go +0 -146
- package/templates/_executor/selected_scope_test.go +0 -186
- package/templates/_executor/socket_linux_test.go +0 -46
- package/templates/_executor/status_disabled_test.go +0 -33
- package/templates/_executor/store.go +0 -91
- package/templates/_executor/supervise.go +0 -109
- package/templates/_executor/supervise_test.go +0 -130
- package/templates/_executor/task_race_review_test.go +0 -47
- package/templates/_executor/tasks.go +0 -320
- package/templates/_executor/tasks_dsm71_test.go +0 -114
- package/templates/_executor/tasks_review_test.go +0 -43
- package/templates/_executor/tasks_test.go +0 -223
- package/templates/_executor/testdata/evidence/cleanup.json +0 -24
- package/templates/_executor/testdata/evidence/final-smoke.jsonl +0 -9
- package/templates/_executor/testdata/evidence/kernel-acl.json +0 -6
- package/templates/_executor/testdata/evidence/linux-tests.log +0 -123
- package/templates/_executor/testdata/evidence/live.jsonl +0 -23
- package/templates/_executor/testdata/evidence/storage.json +0 -90
- package/templates/_executor/testdata/evidence/validation.json +0 -55
- package/templates/_executor/testdata/live_probe.py +0 -98
- package/templates/_executor/upgrade_watch_test.go +0 -244
- package/templates/_executor/watch.go +0 -164
- package/templates/_executor/watch_test.go +0 -291
- package/templates/_executor/write_review_linux_test.go +0 -87
- package/templates/_gateway/auth.go +0 -101
- package/templates/_gateway/auth_test.go +0 -216
- package/templates/_gateway/cgi.go +0 -133
- package/templates/_gateway/cgi_test.go +0 -156
- package/templates/_gateway/csrf.go +0 -73
- package/templates/_gateway/csrf_test.go +0 -155
- package/templates/_gateway/directory.go +0 -108
- package/templates/_gateway/directory_test.go +0 -202
- package/templates/_gateway/gateway.go +0 -412
- package/templates/_gateway/gateway_test.go +0 -676
- package/templates/_gateway/go.mod +0 -5
- package/templates/_gateway/groups.go +0 -66
- package/templates/_gateway/main.go +0 -45
- package/templates/_shared/AGENTS.md +0 -146
- package/templates/_shared/CLAUDE.md +0 -1
- package/templates/_shared/GO-LICENSE +0 -27
- package/templates/_shared/GO-PATENTS +0 -22
- package/templates/_shared/LICENSES/TEMPLATE.txt +0 -21
- package/templates/_shared/third-party-notices.mjs +0 -51
- package/templates/binary/LICENSES/GO-LICENSE +0 -27
- package/templates/binary/LICENSES/GO-PATENTS +0 -22
- package/templates/binary/dsm-package.yaml +0 -46
- package/templates/binary/example/main.go +0 -16
- package/templates/binary/gitignore +0 -2
- package/templates/binary/i18n/messages/de.json +0 -4
- package/templates/binary/i18n/messages/en.json +0 -4
- package/templates/binary/i18n/messages/es.json +0 -4
- package/templates/binary/i18n/messages/fr.json +0 -4
- package/templates/binary/i18n/messages/it.json +0 -4
- package/templates/binary/i18n/messages/ja.json +0 -4
- package/templates/binary/i18n/messages/ko.json +0 -4
- package/templates/binary/i18n/messages/zh-CN.json +0 -4
- package/templates/binary/i18n/messages/zh-TW.json +0 -4
- package/templates/binary/ui/app.css +0 -4
- package/templates/binary/ui/app.js +0 -32
- package/templates/compose/compose.yaml +0 -8
- package/templates/compose/synology-app.yaml +0 -16
- package/templates/native-authorization/AuthorizationGate.vue +0 -91
- package/templates/native-authorization/i18n/de.json +0 -37
- package/templates/native-authorization/i18n/en.json +0 -37
- package/templates/native-authorization/i18n/es.json +0 -37
- package/templates/native-authorization/i18n/fr.json +0 -37
- package/templates/native-authorization/i18n/index.ts +0 -15
- package/templates/native-authorization/i18n/it.json +0 -37
- package/templates/native-authorization/i18n/ja.json +0 -37
- package/templates/native-authorization/i18n/ko.json +0 -37
- package/templates/native-authorization/i18n/zh-CN.json +0 -37
- package/templates/native-authorization/i18n/zh-TW.json +0 -37
- package/templates/native-go/README.md +0 -459
- package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +0 -61
- package/templates/native-go/backend/cmd/app/main.go +0 -95
- package/templates/native-go/backend/cmd/background-worker/main.go +0 -38
- package/templates/native-go/backend/go.mod +0 -9
- package/templates/native-go/backend/go.sum +0 -4
- package/templates/native-go/backend/internal/api/cgi_framing_test.go +0 -32
- package/templates/native-go/backend/internal/api/cookie_review_test.go +0 -28
- package/templates/native-go/backend/internal/api/deadline_test.go +0 -114
- package/templates/native-go/backend/internal/api/dsm-session.go +0 -54
- package/templates/native-go/backend/internal/api/dsm-session_test.go +0 -51
- package/templates/native-go/backend/internal/api/entry_test.go +0 -47
- package/templates/native-go/backend/internal/api/errors.go +0 -47
- package/templates/native-go/backend/internal/api/permissions.go +0 -161
- package/templates/native-go/backend/internal/api/permissions.json +0 -5
- package/templates/native-go/backend/internal/api/permissions_test.go +0 -113
- package/templates/native-go/backend/internal/api/policy_fixture_test.go +0 -8
- package/templates/native-go/backend/internal/api/registry.go +0 -142
- package/templates/native-go/backend/internal/api/registry_test.go +0 -344
- package/templates/native-go/backend/internal/api/resource_limits_test.go +0 -87
- package/templates/native-go/backend/internal/api/sdk-permissions.json +0 -59
- package/templates/native-go/backend/internal/api/sdk_policy_test.go +0 -31
- package/templates/native-go/backend/internal/api/server.go +0 -305
- package/templates/native-go/backend/internal/api/testdata/permissions-cases.json +0 -172
- package/templates/native-go/backend/internal/app/background.go +0 -249
- package/templates/native-go/backend/internal/app/background_none.go +0 -8
- package/templates/native-go/backend/internal/app/background_owner.go +0 -38
- package/templates/native-go/backend/internal/app/background_owner_test.go +0 -163
- package/templates/native-go/backend/internal/app/background_schedule.go +0 -69
- package/templates/native-go/backend/internal/app/background_schedule_test.go +0 -62
- package/templates/native-go/backend/internal/app/background_test.go +0 -320
- package/templates/native-go/backend/internal/app/delegate_config.go +0 -57
- package/templates/native-go/backend/internal/app/delegate_config_test.go +0 -28
- package/templates/native-go/backend/internal/app/delegate_none.go +0 -5
- package/templates/native-go/backend/internal/app/identity.go +0 -20
- package/templates/native-go/backend/internal/app/identity_test.go +0 -15
- package/templates/native-go/backend/internal/app/migrations.go +0 -41
- package/templates/native-go/backend/internal/app/migrations_test.go +0 -41
- package/templates/native-go/backend/internal/app/portal.go +0 -30
- package/templates/native-go/backend/internal/app/portal_test.go +0 -55
- package/templates/native-go/backend/internal/app/root_none.go +0 -9
- package/templates/native-go/backend/internal/app/routes.go +0 -137
- package/templates/native-go/backend/internal/app/routes_test.go +0 -165
- package/templates/native-go/backend/internal/app/session_files.go +0 -9
- package/templates/native-go/backend/internal/app/session_files_test.go +0 -14
- package/templates/native-go/backend/internal/app/shared_folder.go +0 -144
- package/templates/native-go/backend/internal/app/shared_folder_test.go +0 -158
- package/templates/native-go/backend/internal/background/access.go +0 -57
- package/templates/native-go/backend/internal/background/lock_test.go +0 -131
- package/templates/native-go/backend/internal/background/owner_test.go +0 -118
- package/templates/native-go/backend/internal/background/runner.go +0 -185
- package/templates/native-go/backend/internal/background/runner_test.go +0 -209
- package/templates/native-go/backend/internal/background/schedule.go +0 -336
- package/templates/native-go/backend/internal/background/schedule_test.go +0 -368
- package/templates/native-go/backend/internal/background/store.go +0 -825
- package/templates/native-go/backend/internal/background/store_test.go +0 -365
- package/templates/native-go/backend/internal/datamigrate/migrate.go +0 -191
- package/templates/native-go/backend/internal/datamigrate/migrate_test.go +0 -177
- package/templates/native-go/backend/internal/dsm/admin.go +0 -76
- package/templates/native-go/backend/internal/dsm/admin_linux.go +0 -110
- package/templates/native-go/backend/internal/dsm/admin_linux_test.go +0 -105
- package/templates/native-go/backend/internal/dsm/admin_other.go +0 -15
- package/templates/native-go/backend/internal/dsm/admin_test.go +0 -67
- package/templates/native-go/backend/internal/dsm/apppriv.go +0 -30
- package/templates/native-go/backend/internal/dsm/auth.go +0 -94
- package/templates/native-go/backend/internal/dsm/auth_test.go +0 -159
- package/templates/native-go/backend/internal/dsm/bridge_file.go +0 -75
- package/templates/native-go/backend/internal/dsm/bridge_file_test.go +0 -57
- package/templates/native-go/backend/internal/dsm/entry.go +0 -177
- package/templates/native-go/backend/internal/dsm/entry_test.go +0 -315
- package/templates/native-go/backend/internal/dsm/native/admin-aarch64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/admin-armv7.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/admin-x86_64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/admin_check.c +0 -28
- package/templates/native-go/backend/internal/dsm/native/apppriv-aarch64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/apppriv-armv7.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/apppriv-x86_64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/apppriv_check.c +0 -33
- package/templates/native-go/backend/internal/dsm/native/build.sh +0 -18
- package/templates/native-go/backend/internal/dsm/native/licenses/GLIBC-NOTICES.txt +0 -400
- package/templates/native-go/backend/internal/dsm/native/licenses/LGPL-2.1.txt +0 -501
- package/templates/native-go/backend/internal/dsm/native/licenses/SOURCE.txt +0 -5
- package/templates/native-go/backend/internal/dsm/native/licenses/ZIG-MIT.txt +0 -21
- package/templates/native-go/backend/internal/dsm/native/provenance.json +0 -18
- package/templates/native-go/backend/internal/filestation/browse_test.go +0 -67
- package/templates/native-go/backend/internal/filestation/check_permission.go +0 -71
- package/templates/native-go/backend/internal/filestation/check_permission_test.go +0 -77
- package/templates/native-go/backend/internal/filestation/client.go +0 -337
- package/templates/native-go/backend/internal/filestation/client_test.go +0 -155
- package/templates/native-go/backend/internal/filestation/doc.go +0 -4
- package/templates/native-go/backend/internal/filestation/download_dsm71_test.go +0 -82
- package/templates/native-go/backend/internal/filestation/http.go +0 -70
- package/templates/native-go/backend/internal/filestation/http_test.go +0 -188
- package/templates/native-go/backend/internal/filestation/operations_test.go +0 -206
- package/templates/native-go/backend/internal/filestation/read_file_test.go +0 -89
- package/templates/native-go/backend/internal/filestation/sdk_policy_test.go +0 -39
- package/templates/native-go/backend/internal/filestation/service.go +0 -254
- package/templates/native-go/backend/internal/filestation/service_test.go +0 -74
- package/templates/native-go/backend/internal/filestation/upload_stream.go +0 -76
- package/templates/native-go/backend/internal/filestation/upload_stream_test.go +0 -77
- package/templates/native-go/backend/internal/filestation/write.go +0 -32
- package/templates/native-go/backend/internal/filestation/write_test.go +0 -124
- package/templates/native-go/backend/internal/identity/README.md +0 -59
- package/templates/native-go/backend/internal/identity/dsm.go +0 -115
- package/templates/native-go/backend/internal/identity/http.go +0 -291
- package/templates/native-go/backend/internal/identity/identity_test.go +0 -530
- package/templates/native-go/backend/internal/identity/service.go +0 -159
- package/templates/native-go/backend/internal/identity/store.go +0 -109
- package/templates/native-go/backend/internal/jsonlimits/limits.go +0 -48
- package/templates/native-go/backend/internal/jsonlimits/limits_test.go +0 -52
- package/templates/native-go/backend/internal/portal/portal.go +0 -138
- package/templates/native-go/backend/internal/portal/portal_test.go +0 -89
- package/templates/native-go/dsm-package.yaml +0 -71
- package/templates/native-go/gitignore +0 -1
- package/templates/native-go/i18n/glossary.json +0 -663
- package/templates/native-go/i18n/messages/de.json +0 -29
- package/templates/native-go/i18n/messages/en.json +0 -29
- package/templates/native-go/i18n/messages/es.json +0 -29
- package/templates/native-go/i18n/messages/fr.json +0 -29
- package/templates/native-go/i18n/messages/it.json +0 -29
- package/templates/native-go/i18n/messages/ja.json +0 -29
- package/templates/native-go/i18n/messages/ko.json +0 -29
- package/templates/native-go/i18n/messages/zh-CN.json +0 -29
- package/templates/native-go/i18n/messages/zh-TW.json +0 -29
- package/templates/native-go/ui/app.css +0 -45
- package/templates/native-go/ui/app.js +0 -111
- package/templates/native-go-delegate/DELEGATE.md +0 -263
- package/templates/native-go-delegate/backend/cmd/background-worker/main.go +0 -48
- package/templates/native-go-delegate/backend/internal/app/delegate.go +0 -25
- package/templates/native-go-delegate/backend/internal/app/delegate_on.go +0 -5
- package/templates/native-go-delegate/backend/internal/app/delegate_routes_test.go +0 -31
- package/templates/native-go-delegate/backend/internal/background/delegate_review_test.go +0 -174
- package/templates/native-go-delegate/backend/internal/background/delegated.go +0 -277
- package/templates/native-go-delegate/backend/internal/background/delegated_moves.go +0 -270
- package/templates/native-go-delegate/backend/internal/background/delegated_test.go +0 -34
- package/templates/native-go-delegate/backend/internal/delegate/admission_recovery_test.go +0 -410
- package/templates/native-go-delegate/backend/internal/delegate/busy_review_test.go +0 -15
- package/templates/native-go-delegate/backend/internal/delegate/cancel_contract_test.go +0 -95
- package/templates/native-go-delegate/backend/internal/delegate/client.go +0 -151
- package/templates/native-go-delegate/backend/internal/delegate/client_test.go +0 -214
- package/templates/native-go-delegate/backend/internal/delegate/destination.go +0 -110
- package/templates/native-go-delegate/backend/internal/delegate/destination_state.go +0 -117
- package/templates/native-go-delegate/backend/internal/delegate/destination_state_test.go +0 -60
- package/templates/native-go-delegate/backend/internal/delegate/destination_test.go +0 -116
- package/templates/native-go-delegate/backend/internal/delegate/example.go +0 -81
- package/templates/native-go-delegate/backend/internal/delegate/example_test.go +0 -91
- package/templates/native-go-delegate/backend/internal/delegate/executor_contract_test.go +0 -511
- package/templates/native-go-delegate/backend/internal/delegate/files.go +0 -132
- package/templates/native-go-delegate/backend/internal/delegate/long_running_routes.go +0 -92
- package/templates/native-go-delegate/backend/internal/delegate/long_running_routes_test.go +0 -99
- package/templates/native-go-delegate/backend/internal/delegate/move.go +0 -348
- package/templates/native-go-delegate/backend/internal/delegate/move_test.go +0 -351
- package/templates/native-go-delegate/backend/internal/delegate/operations_list.go +0 -65
- package/templates/native-go-delegate/backend/internal/delegate/operations_list_test.go +0 -114
- package/templates/native-go-delegate/backend/internal/delegate/retry.go +0 -106
- package/templates/native-go-delegate/backend/internal/delegate/retry_test.go +0 -143
- package/templates/native-go-delegate/backend/internal/delegate/service.go +0 -364
- package/templates/native-go-delegate/backend/internal/delegate/service_test.go +0 -318
- package/templates/native-go-delegate/backend/internal/delegate/staging.go +0 -121
- package/templates/native-go-delegate/backend/internal/delegate/status_disabled_test.go +0 -51
- package/templates/native-go-delegate/backend/internal/delegate/testdata/executor_contract.txt +0 -112
- package/templates/native-go-delegate/backend/internal/delegate/transient_contract_test.go +0 -137
- package/templates/native-go-delegate/backend/internal/delegate/wait_cancel_test.go +0 -101
- package/templates/native-go-delegate/backend/internal/delegate/worker.go +0 -225
- package/templates/native-go-delegate/backend/internal/filestation/files.go +0 -43
- package/templates/native-go-delegate/backend/internal/filestation/files_test.go +0 -59
- package/templates/native-go-delegate/frontend/src/CapabilityPanels.vue +0 -37
- package/templates/native-go-delegate/frontend/src/delegate/BackgroundSavePanel.vue +0 -113
- package/templates/native-go-delegate/frontend/src/delegate/DelegatePanel.vue +0 -70
- package/templates/native-go-delegate/frontend/src/delegate/copy.ts +0 -8
- package/templates/native-go-delegate/frontend/src/delegate/i18n/waiting.json +0 -11
- package/templates/native-go-delegate/frontend/test/background-save.test.ts +0 -121
- package/templates/native-go-delegate/frontend/test/delegate.test.ts +0 -145
- package/templates/native-go-delegate/frontend/test/scope-settings.test.ts +0 -49
- package/templates/native-go-delegate/test-frontend.sh +0 -12
- package/templates/native-go-delegate/test.sh +0 -18
- package/templates/native-go-jobs/BACKGROUND.md +0 -108
- package/templates/native-go-jobs/backend/internal/app/background_on.go +0 -7
- package/templates/native-go-jobs/backend/internal/app/background_routes_test.go +0 -90
- package/templates/native-go-jobs/frontend/src/background/BackgroundPanel.vue +0 -170
- package/templates/native-go-jobs/frontend/src/background/i18n/de.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/en.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/es.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/fr.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/it.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/ja.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/ko.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/zh-CN.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/zh-TW.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n.ts +0 -19
- package/templates/native-go-jobs/frontend/src/background/picker-provider.ts +0 -12
- package/templates/native-go-jobs/frontend/src/background/request-key.ts +0 -5
- package/templates/native-go-jobs/frontend/test/background.test.ts +0 -205
- package/templates/native-go-root-ops/backend/internal/app/executor.go +0 -140
- package/templates/native-go-root-ops/backend/internal/app/executor_test.go +0 -117
- package/templates/native-go-root-ops/root/whoami.sh +0 -3
- package/templates/native-go-vue/README.md +0 -47
- package/templates/native-go-vue/frontend/DESIGN.md +0 -61
- package/templates/native-go-vue/frontend/package-lock.json +0 -2530
- package/templates/native-go-vue/frontend/package.json +0 -6
- package/templates/native-go-vue/frontend/src/App.vue +0 -96
- package/templates/native-go-vue/frontend/src/CapabilityPanels.vue +0 -6
- package/templates/native-go-vue/frontend/src/context.ts +0 -78
- package/templates/native-go-vue/frontend/src/delegate/ExecutorSettings.vue +0 -70
- package/templates/native-go-vue/frontend/src/delegate/catalogs.ts +0 -11
- package/templates/native-go-vue/frontend/src/delegate/copy.test.ts +0 -12
- package/templates/native-go-vue/frontend/src/delegate/copy.ts +0 -4
- package/templates/native-go-vue/frontend/src/delegate/executor-settings.test.ts +0 -23
- package/templates/native-go-vue/frontend/src/delegate/executor-setup.ts +0 -24
- package/templates/native-go-vue/frontend/src/delegate/facade.test.ts +0 -100
- package/templates/native-go-vue/frontend/src/delegate/facade.ts +0 -85
- package/templates/native-go-vue/frontend/src/delegate/i18n/de.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/en.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/es.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/fr.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/it.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/ja.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/ko.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/de.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/en.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/es.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/fr.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/it.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/ja.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/ko.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-CN.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-TW.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/zh-CN.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/zh-TW.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/long-running.ts +0 -57
- package/templates/native-go-vue/frontend/src/delegate/save-copy.test.ts +0 -12
- package/templates/native-go-vue/frontend/src/delegate/save-copy.ts +0 -24
- package/templates/native-go-vue/frontend/src/delegate/scoped-picker.test.ts +0 -12
- package/templates/native-go-vue/frontend/src/delegate/scoped-picker.ts +0 -21
- package/templates/native-go-vue/frontend/src/files/FileBrowser.vue +0 -131
- package/templates/native-go-vue/frontend/src/files/FilesPage.vue +0 -35
- package/templates/native-go-vue/frontend/src/files/files.test.ts +0 -100
- package/templates/native-go-vue/frontend/src/files/provider.test.ts +0 -48
- package/templates/native-go-vue/frontend/src/files/transfers.test.ts +0 -27
- package/templates/native-go-vue/frontend/src/files/transfers.ts +0 -25
- package/templates/native-go-vue/frontend/src/i18n/de.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/en.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/es.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/fr.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/it.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/ja.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/ko.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/zh-CN.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/zh-TW.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n.ts +0 -13
- package/templates/native-go-vue/frontend/src/identity/DESIGN.md +0 -46
- package/templates/native-go-vue/frontend/src/identity/LoginPage.vue +0 -78
- package/templates/native-go-vue/frontend/src/identity/i18n/de.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/en.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/es.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/fr.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/it.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/ja.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/ko.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/zh-CN.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/zh-TW.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n.ts +0 -14
- package/templates/native-go-vue/frontend/src/identity/login.test.ts +0 -32
- package/templates/native-go-vue/frontend/src/identity/session.test.ts +0 -33
- package/templates/native-go-vue/frontend/src/identity/session.ts +0 -74
- package/templates/native-go-vue/frontend/src/main.ts +0 -32
- package/templates/native-go-vue/frontend/src/nas/NasPicker.vue +0 -42
- package/templates/native-go-vue/frontend/src/nas/contract.ts +0 -12
- package/templates/native-go-vue/frontend/src/nas/destination.test.ts +0 -48
- package/templates/native-go-vue/frontend/src/nas/i18n/files/de.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/en.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/es.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/fr.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/it.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/ja.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/ko.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/zh-CN.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/zh-TW.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n.ts +0 -2
- package/templates/native-go-vue/frontend/src/nas/locale.ts +0 -24
- package/templates/native-go-vue/frontend/src/nas/provider.ts +0 -50
- package/templates/native-go-vue/frontend/src/nas/use-request.ts +0 -18
- package/templates/native-go-vue/frontend/src/portal/PortalSettings.vue +0 -39
- package/templates/native-go-vue/frontend/src/shell/AppShell.vue +0 -48
- package/templates/native-go-vue/frontend/src/shell/i18n/de.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/en.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/es.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/fr.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/it.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/ja.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/ko.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n.ts +0 -17
- package/templates/native-go-vue/frontend/src/shell/pages.ts +0 -15
- package/templates/native-go-vue/frontend/src/style.css +0 -27
- package/templates/native-go-vue/frontend/test/apps.test.ts +0 -57
- package/templates/native-go-vue/frontend/test/native-controls.test.ts +0 -27
- package/templates/native-go-vue/frontend/test/portal-settings.test.ts +0 -71
- package/templates/native-go-vue/frontend/test/shell-i18n.test.ts +0 -50
- package/templates/native-go-vue/frontend/test/shell-ui.test.ts +0 -20
- package/templates/native-go-vue/frontend/test/shell.test.ts +0 -30
- package/templates/native-go-vue/frontend/tsconfig.json +0 -1
- package/templates/native-go-vue/frontend/vite.config.ts +0 -10
- package/templates/native-go-vue/gitignore +0 -2
- /package/{dist/templates/_daemon → assets/go/daemon}/fixture_linux_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/fixture_other_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/go.mod +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/main.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/main_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/process_linux.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/process_linux_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/process_other.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/testdata/child.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/auth.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/auth_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/cgi.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/cgi_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/csrf.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/csrf_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/directory.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/directory_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/gateway.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/gateway_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/go.mod +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/groups.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/main.go +0 -0
- /package/{dist/templates/_shared → assets/licenses}/GO-LICENSE +0 -0
- /package/{dist/templates/_shared → assets/licenses}/GO-PATENTS +0 -0
- /package/{dist/templates/_shared/LICENSES → assets/licenses}/TEMPLATE.txt +0 -0
|
@@ -1,735 +0,0 @@
|
|
|
1
|
-
package main
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"bufio"
|
|
5
|
-
"bytes"
|
|
6
|
-
"context"
|
|
7
|
-
"crypto/rand"
|
|
8
|
-
"encoding/hex"
|
|
9
|
-
"encoding/json"
|
|
10
|
-
"errors"
|
|
11
|
-
"io"
|
|
12
|
-
"net"
|
|
13
|
-
"path/filepath"
|
|
14
|
-
"regexp"
|
|
15
|
-
"strings"
|
|
16
|
-
"sync"
|
|
17
|
-
"time"
|
|
18
|
-
"unicode"
|
|
19
|
-
"unicode/utf8"
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
const version = "1"
|
|
23
|
-
const maxRequest = 64 << 10
|
|
24
|
-
|
|
25
|
-
var allOps = []string{"status", "delegate.create", "delegate.list", "delegate.revoke", "files.list", "files.info", "files.createFolder", "files.checkPermission", "files.write", "files.moveFromStaging", "files.operationStatus", "files.cancelOperation", "delegate.disable", "delegate.enable", "delegate.audit", "root.run"}
|
|
26
|
-
var tokenRE = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$`)
|
|
27
|
-
var destinationRE = regexp.MustCompile(`^[a-z][a-z0-9_-]{0,63}$`)
|
|
28
|
-
var idRE = regexp.MustCompile(`^[a-f0-9]{64}$`)
|
|
29
|
-
|
|
30
|
-
type Policy struct {
|
|
31
|
-
Version int `json:"v"`
|
|
32
|
-
Package string `json:"package"`
|
|
33
|
-
App string `json:"app"`
|
|
34
|
-
Entry string `json:"entry,omitempty"`
|
|
35
|
-
Scope string `json:"scope,omitempty"`
|
|
36
|
-
Operations []string `json:"operations"`
|
|
37
|
-
Destinations []string `json:"destinations,omitempty"`
|
|
38
|
-
Lifetime string `json:"lifetime,omitempty"`
|
|
39
|
-
Root map[string]string `json:"root,omitempty"`
|
|
40
|
-
}
|
|
41
|
-
type Subject struct {
|
|
42
|
-
Username string `json:"username"`
|
|
43
|
-
UID int `json:"uid"`
|
|
44
|
-
GID int `json:"gid"`
|
|
45
|
-
Groups []int `json:"groups"`
|
|
46
|
-
Home string `json:"home"`
|
|
47
|
-
Expired string `json:"expired"`
|
|
48
|
-
Admin bool `json:"admin"`
|
|
49
|
-
}
|
|
50
|
-
type Delegation struct {
|
|
51
|
-
ScopeGeneration uint64 `json:"scope_generation,omitempty"`
|
|
52
|
-
Lifetime string `json:"lifetime,omitempty"`
|
|
53
|
-
DestinationKey string `json:"destination,omitempty"`
|
|
54
|
-
Directory directoryIdentity `json:"directory,omitempty"`
|
|
55
|
-
ID string `json:"delegation_id"`
|
|
56
|
-
Package string `json:"package"`
|
|
57
|
-
Subject Subject `json:"subject"`
|
|
58
|
-
Job string `json:"job_id"`
|
|
59
|
-
Ops []string `json:"ops"`
|
|
60
|
-
Scope string `json:"scope"`
|
|
61
|
-
Path string `json:"path"`
|
|
62
|
-
Root string `json:"root"`
|
|
63
|
-
Expires time.Time `json:"expires_at"`
|
|
64
|
-
Revoked bool `json:"revoked"`
|
|
65
|
-
}
|
|
66
|
-
type Auth struct {
|
|
67
|
-
Cookie string `json:"dsm_cookie,omitempty"`
|
|
68
|
-
SynoToken string `json:"dsm_synotoken,omitempty"`
|
|
69
|
-
hasKeys bool
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Preserve wire key presence: an explicit empty credential is caller auth.
|
|
73
|
-
func (a *Auth) UnmarshalJSON(b []byte) error {
|
|
74
|
-
type plainAuth Auth
|
|
75
|
-
var decoded plainAuth
|
|
76
|
-
if err := strictJSON(b, &decoded); err != nil {
|
|
77
|
-
return err
|
|
78
|
-
}
|
|
79
|
-
var keys map[string]json.RawMessage
|
|
80
|
-
if err := json.Unmarshal(b, &keys); err != nil {
|
|
81
|
-
return err
|
|
82
|
-
}
|
|
83
|
-
for key := range keys {
|
|
84
|
-
if key != "dsm_cookie" && key != "dsm_synotoken" {
|
|
85
|
-
return errors.New("auth key")
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
*a = Auth(decoded)
|
|
89
|
-
a.hasKeys = len(keys) > 0 || bytes.Equal(bytes.TrimSpace(b), []byte("null"))
|
|
90
|
-
return nil
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
type Request struct {
|
|
94
|
-
Version int `json:"v"`
|
|
95
|
-
Op string `json:"op"`
|
|
96
|
-
Auth Auth `json:"auth"`
|
|
97
|
-
Params json.RawMessage `json:"params"`
|
|
98
|
-
}
|
|
99
|
-
type Response struct {
|
|
100
|
-
OK bool `json:"ok"`
|
|
101
|
-
Result any `json:"result,omitempty"`
|
|
102
|
-
Code string `json:"code,omitempty"`
|
|
103
|
-
Message string `json:"message,omitempty"`
|
|
104
|
-
}
|
|
105
|
-
type Params struct {
|
|
106
|
-
Lifetime string `json:"lifetime,omitempty"`
|
|
107
|
-
DestinationKey string `json:"destination,omitempty"`
|
|
108
|
-
Size int64 `json:"size,omitempty"`
|
|
109
|
-
Job string `json:"job_id,omitempty"`
|
|
110
|
-
Ops []string `json:"ops,omitempty"`
|
|
111
|
-
Scope string `json:"scope,omitempty"`
|
|
112
|
-
Path string `json:"path,omitempty"`
|
|
113
|
-
TTL int64 `json:"ttl_seconds,omitempty"`
|
|
114
|
-
ID string `json:"delegation_id,omitempty"`
|
|
115
|
-
Staging string `json:"staging,omitempty"`
|
|
116
|
-
Dest string `json:"dest_dir,omitempty"`
|
|
117
|
-
Name string `json:"name,omitempty"`
|
|
118
|
-
}
|
|
119
|
-
type DSM interface {
|
|
120
|
-
Verify(context.Context, string, string) (string, error)
|
|
121
|
-
Account(context.Context, string) (Subject, error)
|
|
122
|
-
Allow(context.Context, Subject, string, string) error
|
|
123
|
-
ScopeRoot(context.Context, Subject, string) (string, error)
|
|
124
|
-
API(context.Context, string, string, map[string]any) (json.RawMessage, error)
|
|
125
|
-
}
|
|
126
|
-
type writeJobKey struct{}
|
|
127
|
-
|
|
128
|
-
type Writer interface {
|
|
129
|
-
Write(context.Context, Subject, string, string, string, string) error
|
|
130
|
-
}
|
|
131
|
-
type RootRunner interface {
|
|
132
|
-
Run(context.Context, string, string) (string, error)
|
|
133
|
-
}
|
|
134
|
-
type Executor struct {
|
|
135
|
-
Policy Policy
|
|
136
|
-
DSM DSM
|
|
137
|
-
Writer Writer
|
|
138
|
-
Runner RootRunner
|
|
139
|
-
Store *Store
|
|
140
|
-
Now func() time.Time
|
|
141
|
-
ExecutorDigest, PolicyDigest string
|
|
142
|
-
legacyCalls map[string][]chan struct{}
|
|
143
|
-
copySlot chan struct{}
|
|
144
|
-
commitMu sync.Mutex // Durable admission/revoke/disable and bounded publish only.
|
|
145
|
-
async *operationRuntime
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
func deny(code string) Response {
|
|
149
|
-
return Response{Code: code, Message: strings.ToLower(strings.ReplaceAll(code, "_", " "))}
|
|
150
|
-
}
|
|
151
|
-
func success(v any) Response { return Response{OK: true, Result: v} }
|
|
152
|
-
func contains(v []string, s string) bool {
|
|
153
|
-
for _, x := range v {
|
|
154
|
-
if x == s {
|
|
155
|
-
return true
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return false
|
|
159
|
-
}
|
|
160
|
-
func validName(s string) bool {
|
|
161
|
-
return s != "" && !strings.Contains(s, "/") && !strings.Contains(s, "..") && !strings.ContainsFunc(s, unicode.IsControl) && utf8.ValidString(s)
|
|
162
|
-
}
|
|
163
|
-
func cleanPath(p string) bool {
|
|
164
|
-
return strings.HasPrefix(p, "/") && filepath.Clean(p) == p && !strings.ContainsFunc(p, unicode.IsControl) && utf8.ValidString(p)
|
|
165
|
-
}
|
|
166
|
-
func within(root, p string) bool {
|
|
167
|
-
return p == root || strings.HasPrefix(p, strings.TrimSuffix(root, "/")+"/")
|
|
168
|
-
}
|
|
169
|
-
func strictJSON(b []byte, v any) error {
|
|
170
|
-
if !utf8.Valid(b) {
|
|
171
|
-
return errors.New("utf8")
|
|
172
|
-
}
|
|
173
|
-
// encoding/json otherwise silently accepts duplicate keys, including auth.
|
|
174
|
-
d := json.NewDecoder(bytes.NewReader(b))
|
|
175
|
-
_, params := v.(*Params)
|
|
176
|
-
_, auth := v.(*Auth)
|
|
177
|
-
if err := uniqueValue(d, params || auth); err != nil {
|
|
178
|
-
return err
|
|
179
|
-
}
|
|
180
|
-
if _, err := d.Token(); err != io.EOF {
|
|
181
|
-
return errors.New("trailing JSON")
|
|
182
|
-
}
|
|
183
|
-
d = json.NewDecoder(bytes.NewReader(b))
|
|
184
|
-
d.DisallowUnknownFields()
|
|
185
|
-
return d.Decode(v)
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Match encoding/json's Unicode case folding when detecting duplicate keys.
|
|
189
|
-
func foldJSONKey(s string) string {
|
|
190
|
-
return strings.Map(func(r rune) rune {
|
|
191
|
-
folded := r
|
|
192
|
-
for next := unicode.SimpleFold(r); next != r; next = unicode.SimpleFold(next) {
|
|
193
|
-
if next < folded {
|
|
194
|
-
folded = next
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return folded
|
|
198
|
-
}, s)
|
|
199
|
-
}
|
|
200
|
-
func uniqueValue(d *json.Decoder, canonical bool) error {
|
|
201
|
-
tok, err := d.Token()
|
|
202
|
-
if err != nil {
|
|
203
|
-
return err
|
|
204
|
-
}
|
|
205
|
-
del, ok := tok.(json.Delim)
|
|
206
|
-
if !ok {
|
|
207
|
-
return nil
|
|
208
|
-
}
|
|
209
|
-
switch del {
|
|
210
|
-
case '{':
|
|
211
|
-
seen := map[string]bool{}
|
|
212
|
-
for d.More() {
|
|
213
|
-
k, err := d.Token()
|
|
214
|
-
if err != nil {
|
|
215
|
-
return err
|
|
216
|
-
}
|
|
217
|
-
s, ok := k.(string)
|
|
218
|
-
folded := foldJSONKey(s)
|
|
219
|
-
if !ok || seen[folded] {
|
|
220
|
-
return errors.New("duplicate key")
|
|
221
|
-
}
|
|
222
|
-
seen[folded] = true
|
|
223
|
-
credentialObject := strings.EqualFold(s, "auth") || strings.EqualFold(s, "params")
|
|
224
|
-
if credentialObject && s != "auth" && s != "params" {
|
|
225
|
-
return errors.New("noncanonical key")
|
|
226
|
-
}
|
|
227
|
-
if canonical && strings.ContainsFunc(s, func(r rune) bool { return !((r >= 'a' && r <= 'z') || (r >= '0' && r <= '9') || r == '_') }) {
|
|
228
|
-
return errors.New("noncanonical key")
|
|
229
|
-
}
|
|
230
|
-
if err = uniqueValue(d, canonical || credentialObject); err != nil {
|
|
231
|
-
return err
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
case '[':
|
|
235
|
-
for d.More() {
|
|
236
|
-
if err = uniqueValue(d, canonical); err != nil {
|
|
237
|
-
return err
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
default:
|
|
241
|
-
return errors.New("invalid JSON")
|
|
242
|
-
}
|
|
243
|
-
_, err = d.Token()
|
|
244
|
-
return err
|
|
245
|
-
}
|
|
246
|
-
func (e *Executor) Connection(parent context.Context, c net.Conn, uid int, peer func(net.Conn) (int, error)) {
|
|
247
|
-
got, err := peer(c)
|
|
248
|
-
if err != nil || (got != uid && got != 0) {
|
|
249
|
-
return
|
|
250
|
-
}
|
|
251
|
-
c.SetDeadline(time.Now().Add(15 * time.Second))
|
|
252
|
-
r := bufio.NewReaderSize(c, maxRequest+1)
|
|
253
|
-
line, err := r.ReadSlice('\n')
|
|
254
|
-
var out Response
|
|
255
|
-
if len(line) > maxRequest || err == bufio.ErrBufferFull {
|
|
256
|
-
out = deny("REQUEST_TOO_LARGE")
|
|
257
|
-
} else if err != nil {
|
|
258
|
-
out = deny("INVALID_REQUEST")
|
|
259
|
-
} else {
|
|
260
|
-
var req Request
|
|
261
|
-
if strictJSON(line, &req) != nil {
|
|
262
|
-
out = deny("INVALID_REQUEST")
|
|
263
|
-
} else {
|
|
264
|
-
ctx, cancel := context.WithTimeout(parent, 30*time.Second)
|
|
265
|
-
defer cancel()
|
|
266
|
-
out = e.handlePeer(ctx, req, got, uid)
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
c.SetWriteDeadline(time.Now().Add(5 * time.Second))
|
|
270
|
-
json.NewEncoder(c).Encode(out)
|
|
271
|
-
}
|
|
272
|
-
func (e *Executor) eligible(ctx context.Context, name string, uid int, files bool) (Subject, string) {
|
|
273
|
-
moveValidationStage(ctx, "account")
|
|
274
|
-
s, err := e.DSM.Account(ctx, name)
|
|
275
|
-
if moveValidationDeadline(ctx, err) {
|
|
276
|
-
return s, "EXECUTOR_PAUSED"
|
|
277
|
-
}
|
|
278
|
-
if err != nil || s.Username != name || s.Expired != "normal" || s.UID < 1024 || s.GID < 0 || len(s.Groups) == 0 || (uid >= 0 && s.UID != uid) {
|
|
279
|
-
return Subject{}, "INELIGIBLE"
|
|
280
|
-
}
|
|
281
|
-
moveValidationStage(ctx, "app-privilege")
|
|
282
|
-
if err := e.DSM.Allow(ctx, s, e.Policy.App, e.Policy.Entry); err != nil {
|
|
283
|
-
if moveValidationDeadline(ctx, err) {
|
|
284
|
-
return s, "EXECUTOR_PAUSED"
|
|
285
|
-
}
|
|
286
|
-
return Subject{}, "APP_DENIED"
|
|
287
|
-
}
|
|
288
|
-
moveValidationStage(ctx, "file-station-privilege")
|
|
289
|
-
if files {
|
|
290
|
-
if err := e.DSM.Allow(ctx, s, "SYNO.SDS.App.FileStation3.Instance", ""); err != nil {
|
|
291
|
-
if moveValidationDeadline(ctx, err) {
|
|
292
|
-
return s, "EXECUTOR_PAUSED"
|
|
293
|
-
}
|
|
294
|
-
return Subject{}, "APP_DENIED"
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return s, ""
|
|
298
|
-
}
|
|
299
|
-
func (e *Executor) verified(ctx context.Context, auth Auth) (Subject, string) {
|
|
300
|
-
if auth.Cookie == "" || len(auth.Cookie) > 4096 || (strings.Contains(auth.Cookie, ";") || strings.ContainsFunc(auth.Cookie, func(r rune) bool { return r < 0x20 || r == 0x7f })) || auth.SynoToken == "" || len(auth.SynoToken) > 4096 || strings.ContainsFunc(auth.SynoToken, unicode.IsControl) {
|
|
301
|
-
return Subject{}, "AUTH_DENIED"
|
|
302
|
-
}
|
|
303
|
-
name, err := e.DSM.Verify(ctx, auth.Cookie, auth.SynoToken)
|
|
304
|
-
if err != nil || name == "" {
|
|
305
|
-
return Subject{}, "AUTH_DENIED"
|
|
306
|
-
}
|
|
307
|
-
s, err := e.DSM.Account(ctx, name)
|
|
308
|
-
if err != nil || s.Username != name || s.Expired != "normal" {
|
|
309
|
-
return Subject{}, "AUTH_DENIED"
|
|
310
|
-
}
|
|
311
|
-
return s, ""
|
|
312
|
-
}
|
|
313
|
-
func (e *Executor) Handle(ctx context.Context, r Request) Response {
|
|
314
|
-
if isExtension(r.Op) {
|
|
315
|
-
return e.handleExtension(ctx, r)
|
|
316
|
-
}
|
|
317
|
-
if ctx.Err() != nil {
|
|
318
|
-
return deny("EXECUTOR_PAUSED")
|
|
319
|
-
}
|
|
320
|
-
if r.Version != 1 {
|
|
321
|
-
return deny("INVALID_REQUEST")
|
|
322
|
-
}
|
|
323
|
-
if !contains(allOps, r.Op) {
|
|
324
|
-
return deny("UNKNOWN_OP")
|
|
325
|
-
}
|
|
326
|
-
if !contains(e.Policy.Operations, r.Op) {
|
|
327
|
-
return deny("POLICY_DENIED")
|
|
328
|
-
}
|
|
329
|
-
var p Params
|
|
330
|
-
if len(r.Params) == 0 {
|
|
331
|
-
r.Params = json.RawMessage(`{}`)
|
|
332
|
-
}
|
|
333
|
-
if strictJSON(r.Params, &p) != nil {
|
|
334
|
-
return deny("INVALID_REQUEST")
|
|
335
|
-
}
|
|
336
|
-
// Reject parameters belonging to another operation, rather than silently ignoring them.
|
|
337
|
-
var keys map[string]json.RawMessage
|
|
338
|
-
if json.Unmarshal(r.Params, &keys) != nil {
|
|
339
|
-
return deny("INVALID_REQUEST")
|
|
340
|
-
}
|
|
341
|
-
allowed := map[string]string{"status": "", "delegate.create": "job_id ops scope path ttl_seconds destination lifetime", "delegate.list": "", "delegate.revoke": "delegation_id job_id", "files.list": "delegation_id job_id path", "files.info": "delegation_id job_id path", "files.createFolder": "delegation_id job_id path name", "files.checkPermission": "delegation_id job_id path", "files.write": "delegation_id job_id staging dest_dir name", "root.run": "name"}
|
|
342
|
-
for k := range keys {
|
|
343
|
-
if !contains(strings.Fields(allowed[r.Op]), k) {
|
|
344
|
-
return deny("INVALID_REQUEST")
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
if r.Op == "delegate.create" || strings.HasPrefix(r.Op, "files.") {
|
|
348
|
-
e.commitMu.Lock()
|
|
349
|
-
disabled, err := e.Store.Disabled()
|
|
350
|
-
e.commitMu.Unlock()
|
|
351
|
-
if err != nil {
|
|
352
|
-
return deny("STORAGE_ERROR")
|
|
353
|
-
}
|
|
354
|
-
if disabled {
|
|
355
|
-
return deny("disabled")
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
switch r.Op {
|
|
359
|
-
case "status":
|
|
360
|
-
e.commitMu.Lock()
|
|
361
|
-
defer e.commitMu.Unlock()
|
|
362
|
-
disabled, err := e.Store.Disabled()
|
|
363
|
-
out := map[string]any{"executor_digest": e.ExecutorDigest, "policy_digest": e.PolicyDigest, "version": version, "ready": err == nil, "disabled": disabled}
|
|
364
|
-
if e.Policy.Scope == installSelectedScope {
|
|
365
|
-
state, code := e.selectionLocked()
|
|
366
|
-
out["scope_state"] = code
|
|
367
|
-
out["selection"] = nil
|
|
368
|
-
if code == "" {
|
|
369
|
-
out["selection"] = map[string]any{"scope": state.Scope, "root": scopeVirtual(state.Scope), "generation": state.Generation}
|
|
370
|
-
}
|
|
371
|
-
if code == "STORAGE_ERROR" {
|
|
372
|
-
out["ready"] = false
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return success(out)
|
|
376
|
-
case "delegate.create":
|
|
377
|
-
long := p.Lifetime == "until-revoked"
|
|
378
|
-
if long {
|
|
379
|
-
if _, ok := keys["job_id"]; ok {
|
|
380
|
-
return deny("INVALID_REQUEST")
|
|
381
|
-
}
|
|
382
|
-
if _, ok := keys["ttl_seconds"]; ok {
|
|
383
|
-
return deny("INVALID_REQUEST")
|
|
384
|
-
}
|
|
385
|
-
if !contains(e.Policy.Destinations, p.DestinationKey) {
|
|
386
|
-
return deny("invalid-destination")
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
if (long && (e.Policy.Lifetime != p.Lifetime || !contains(e.Policy.Destinations, p.DestinationKey) || p.Job != "" || p.TTL != 0 || len(p.Ops) != 1 || p.Ops[0] != "files.moveFromStaging")) || (!long && (p.Lifetime != "" || p.DestinationKey != "" || !tokenRE.MatchString(p.Job) || p.TTL <= 0 || p.TTL > 86400*30 || contains(p.Ops, "files.moveFromStaging"))) || len(p.Ops) == 0 || p.Scope != e.Policy.Scope || !cleanPath(p.Path) {
|
|
390
|
-
return deny("INVALID_REQUEST")
|
|
391
|
-
}
|
|
392
|
-
for _, op := range p.Ops {
|
|
393
|
-
if !strings.HasPrefix(op, "files.") || !contains(allOps, op) || !contains(e.Policy.Operations, op) {
|
|
394
|
-
return deny("POLICY_DENIED")
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
s, code := e.verified(ctx, r.Auth)
|
|
398
|
-
if code != "" {
|
|
399
|
-
return deny(code)
|
|
400
|
-
}
|
|
401
|
-
s, code = e.eligible(ctx, s.Username, s.UID, true)
|
|
402
|
-
if code != "" {
|
|
403
|
-
return deny(code)
|
|
404
|
-
}
|
|
405
|
-
selection, selectionCode := e.selection()
|
|
406
|
-
if selectionCode != "" {
|
|
407
|
-
return deny(selectionCode)
|
|
408
|
-
}
|
|
409
|
-
root, err := e.DSM.ScopeRoot(ctx, s, selection.Scope)
|
|
410
|
-
if err != nil {
|
|
411
|
-
return deny("SCOPE_DENIED")
|
|
412
|
-
}
|
|
413
|
-
d := Delegation{Package: e.Policy.Package, Subject: s, Job: p.Job, Ops: p.Ops, Scope: selection.Scope, ScopeGeneration: selection.Generation, Path: scopeVirtual(selection.Scope), Root: root, Expires: e.Now().UTC().Add(time.Duration(p.TTL) * time.Second)}
|
|
414
|
-
var real string
|
|
415
|
-
if long {
|
|
416
|
-
real, err = mappedDirectory(d, p.Path)
|
|
417
|
-
} else {
|
|
418
|
-
real, err = scopedPath(d, p.Path)
|
|
419
|
-
}
|
|
420
|
-
if err != nil {
|
|
421
|
-
return deny("SCOPE_DENIED")
|
|
422
|
-
}
|
|
423
|
-
d.Root = real
|
|
424
|
-
d.Path = p.Path
|
|
425
|
-
if long {
|
|
426
|
-
d.Lifetime = p.Lifetime
|
|
427
|
-
d.DestinationKey = p.DestinationKey
|
|
428
|
-
d.Expires = time.Time{}
|
|
429
|
-
d.Directory, err = bindDirectory(real)
|
|
430
|
-
if err != nil {
|
|
431
|
-
return deny("SCOPE_DENIED")
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
// Permission creation is checked as the subject, never SYSTEM_ADMIN.
|
|
435
|
-
if _, err = e.DSM.API(ctx, s.Username, "files.checkPermission", map[string]any{"path": p.Path}); err != nil {
|
|
436
|
-
return deny("PERMISSION_DENIED")
|
|
437
|
-
}
|
|
438
|
-
id := make([]byte, 32)
|
|
439
|
-
if _, err = rand.Read(id); err != nil {
|
|
440
|
-
return deny("INTERNAL")
|
|
441
|
-
}
|
|
442
|
-
d.ID = hex.EncodeToString(id)
|
|
443
|
-
e.commitMu.Lock()
|
|
444
|
-
disabled, disableErr := e.Store.Disabled()
|
|
445
|
-
if !e.scopeMatchesLocked(d) {
|
|
446
|
-
e.commitMu.Unlock()
|
|
447
|
-
return deny("SCOPE_DENIED")
|
|
448
|
-
}
|
|
449
|
-
if disableErr != nil || disabled {
|
|
450
|
-
e.commitMu.Unlock()
|
|
451
|
-
return deny("disabled")
|
|
452
|
-
}
|
|
453
|
-
putErr := e.auditLocked(s, "delegate.create", "", d.Path, "admitting")
|
|
454
|
-
// A destination key denotes one current choice for this person. Changing
|
|
455
|
-
// it cancels its previous grant under the same publish fence.
|
|
456
|
-
if putErr == nil && long {
|
|
457
|
-
var previous []Delegation
|
|
458
|
-
previous, putErr = e.Store.List()
|
|
459
|
-
for _, prior := range previous {
|
|
460
|
-
if putErr != nil {
|
|
461
|
-
break
|
|
462
|
-
}
|
|
463
|
-
if prior.Package != d.Package || prior.Subject.UID != s.UID || prior.Subject.Username != s.Username || prior.Lifetime != "until-revoked" || prior.DestinationKey != d.DestinationKey || prior.Revoked {
|
|
464
|
-
continue
|
|
465
|
-
}
|
|
466
|
-
putErr = e.auditLocked(s, "delegate.revoke", prior.ID, prior.Path, "destination-replaced")
|
|
467
|
-
if putErr == nil {
|
|
468
|
-
prior.Revoked = true
|
|
469
|
-
putErr = e.Store.Put(prior)
|
|
470
|
-
}
|
|
471
|
-
if putErr == nil {
|
|
472
|
-
e.cancelGrantLocked(prior.ID, "destination-replaced")
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
if putErr == nil {
|
|
477
|
-
putErr = e.Store.Put(d)
|
|
478
|
-
}
|
|
479
|
-
e.commitMu.Unlock()
|
|
480
|
-
if putErr != nil {
|
|
481
|
-
return deny("STORAGE_ERROR")
|
|
482
|
-
}
|
|
483
|
-
if long {
|
|
484
|
-
return success(publicDelegation(d))
|
|
485
|
-
}
|
|
486
|
-
return success(map[string]any{"delegation_id": d.ID, "subject": publicSubject(s), "expires_at": d.Expires})
|
|
487
|
-
case "delegate.list":
|
|
488
|
-
s, code := e.verified(ctx, r.Auth)
|
|
489
|
-
if code != "" {
|
|
490
|
-
return deny(code)
|
|
491
|
-
}
|
|
492
|
-
ds, err := e.Store.List()
|
|
493
|
-
if err != nil {
|
|
494
|
-
return deny("STORAGE_ERROR")
|
|
495
|
-
}
|
|
496
|
-
out := []any{}
|
|
497
|
-
for _, d := range ds {
|
|
498
|
-
if d.Package == e.Policy.Package && d.Subject.UID == s.UID && d.Subject.Username == s.Username {
|
|
499
|
-
if !e.scopeMatches(d) {
|
|
500
|
-
d.Revoked = true
|
|
501
|
-
}
|
|
502
|
-
out = append(out, publicDelegation(d))
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
return success(map[string]any{"delegations": out})
|
|
506
|
-
case "delegate.revoke":
|
|
507
|
-
d, err := e.Store.Get(p.ID)
|
|
508
|
-
if err != nil || d.Package != e.Policy.Package {
|
|
509
|
-
return deny("DELEGATION_DENIED")
|
|
510
|
-
}
|
|
511
|
-
if r.Auth.hasKeys || r.Auth.Cookie != "" || r.Auth.SynoToken != "" {
|
|
512
|
-
s, code := e.verified(ctx, r.Auth)
|
|
513
|
-
if code != "" {
|
|
514
|
-
return deny(code)
|
|
515
|
-
}
|
|
516
|
-
if (d.Lifetime != "" || !s.Admin) && (s.UID != d.Subject.UID || s.Username != d.Subject.Username) {
|
|
517
|
-
return deny("DELEGATION_DENIED")
|
|
518
|
-
}
|
|
519
|
-
} else if d.Lifetime != "" || p.Job == "" || p.Job != d.Job {
|
|
520
|
-
return deny("DELEGATION_DENIED")
|
|
521
|
-
}
|
|
522
|
-
e.commitMu.Lock()
|
|
523
|
-
locked := true
|
|
524
|
-
defer func() {
|
|
525
|
-
if locked {
|
|
526
|
-
e.commitMu.Unlock()
|
|
527
|
-
}
|
|
528
|
-
}()
|
|
529
|
-
d, err = e.Store.Get(p.ID)
|
|
530
|
-
if err != nil {
|
|
531
|
-
return deny("STORAGE_ERROR")
|
|
532
|
-
}
|
|
533
|
-
d.Revoked = true
|
|
534
|
-
if e.Store.Put(d) != nil {
|
|
535
|
-
return deny("STORAGE_ERROR")
|
|
536
|
-
}
|
|
537
|
-
e.cancelGrantLocked(d.ID, "grant-revoked")
|
|
538
|
-
if e.auditLocked(d.Subject, "delegate.revoke", "", d.Path, "revoked") != nil {
|
|
539
|
-
return deny("STORAGE_ERROR")
|
|
540
|
-
}
|
|
541
|
-
pending := e.legacyPendingLocked(d.ID)
|
|
542
|
-
e.commitMu.Unlock()
|
|
543
|
-
locked = false
|
|
544
|
-
if waitLegacy(ctx, pending) != nil {
|
|
545
|
-
return deny("EXECUTOR_PAUSED")
|
|
546
|
-
}
|
|
547
|
-
return success(map[string]any{"revoked": true})
|
|
548
|
-
case "root.run":
|
|
549
|
-
if !tokenRE.MatchString(p.Name) {
|
|
550
|
-
return deny("INVALID_REQUEST")
|
|
551
|
-
}
|
|
552
|
-
digest, ok := e.Policy.Root[p.Name]
|
|
553
|
-
if !ok {
|
|
554
|
-
return deny("POLICY_DENIED")
|
|
555
|
-
}
|
|
556
|
-
s, code := e.verified(ctx, r.Auth)
|
|
557
|
-
if code != "" {
|
|
558
|
-
return deny(code)
|
|
559
|
-
}
|
|
560
|
-
if !s.Admin {
|
|
561
|
-
return deny("ADMIN_REQUIRED")
|
|
562
|
-
}
|
|
563
|
-
if e.DSM.Allow(ctx, s, e.Policy.App, e.Policy.Entry) != nil {
|
|
564
|
-
return deny("APP_DENIED")
|
|
565
|
-
}
|
|
566
|
-
if e.Runner == nil {
|
|
567
|
-
return deny("ROOT_FAILED")
|
|
568
|
-
}
|
|
569
|
-
out, err := e.Runner.Run(ctx, p.Name, digest)
|
|
570
|
-
if err != nil {
|
|
571
|
-
return deny("ROOT_FAILED")
|
|
572
|
-
}
|
|
573
|
-
return success(map[string]any{"output": out})
|
|
574
|
-
}
|
|
575
|
-
d, err := e.Store.Get(p.ID)
|
|
576
|
-
if err != nil || d.Package != e.Policy.Package || d.Revoked || (d.Lifetime != "" || !e.Now().Before(d.Expires)) || d.Job != p.Job || !contains(d.Ops, r.Op) || !e.scopeMatches(d) {
|
|
577
|
-
return deny("DELEGATION_DENIED")
|
|
578
|
-
}
|
|
579
|
-
s, code := e.eligible(ctx, d.Subject.Username, d.Subject.UID, true)
|
|
580
|
-
if code != "" {
|
|
581
|
-
return deny(code)
|
|
582
|
-
}
|
|
583
|
-
root, err := e.DSM.ScopeRoot(ctx, s, d.Scope)
|
|
584
|
-
if err != nil {
|
|
585
|
-
return deny("SCOPE_DENIED")
|
|
586
|
-
}
|
|
587
|
-
// Revalidate the root so a moved home/share never inherits an old delegation.
|
|
588
|
-
check := d
|
|
589
|
-
check.Root = root
|
|
590
|
-
check.Path = scopeVirtual(d.Scope)
|
|
591
|
-
real, err := scopedPath(check, d.Path)
|
|
592
|
-
if err != nil || real != d.Root {
|
|
593
|
-
return deny("SCOPE_DENIED")
|
|
594
|
-
}
|
|
595
|
-
path := p.Path
|
|
596
|
-
if r.Op == "files.write" {
|
|
597
|
-
path = p.Dest
|
|
598
|
-
}
|
|
599
|
-
if !cleanPath(path) {
|
|
600
|
-
return deny("INVALID_REQUEST")
|
|
601
|
-
}
|
|
602
|
-
if !within(d.Path, path) {
|
|
603
|
-
return deny("SCOPE_DENIED")
|
|
604
|
-
}
|
|
605
|
-
real, err = scopedPath(d, path)
|
|
606
|
-
if err != nil {
|
|
607
|
-
return deny("SCOPE_DENIED")
|
|
608
|
-
}
|
|
609
|
-
if r.Op == "files.write" {
|
|
610
|
-
if !validName(p.Name) || !validRelative(p.Staging) {
|
|
611
|
-
return deny("INVALID_REQUEST")
|
|
612
|
-
}
|
|
613
|
-
release, err := e.acquireCopy(ctx)
|
|
614
|
-
if err != nil {
|
|
615
|
-
return deny("EXECUTOR_PAUSED")
|
|
616
|
-
}
|
|
617
|
-
defer release()
|
|
618
|
-
e.commitMu.Lock()
|
|
619
|
-
disabled, x := e.Store.Disabled()
|
|
620
|
-
fresh, x2 := e.Store.Get(d.ID)
|
|
621
|
-
e.commitMu.Unlock()
|
|
622
|
-
if x != nil || x2 != nil {
|
|
623
|
-
return deny("STORAGE_ERROR")
|
|
624
|
-
}
|
|
625
|
-
if disabled {
|
|
626
|
-
return deny("disabled")
|
|
627
|
-
}
|
|
628
|
-
if fresh.Revoked || ctx.Err() != nil {
|
|
629
|
-
return deny("DELEGATION_DENIED")
|
|
630
|
-
}
|
|
631
|
-
writerCtx := context.WithValue(ctx, writeJobKey{}, p.Job)
|
|
632
|
-
writerCtx = context.WithValue(writerCtx, legacyPublishKey{}, func(publish func() (MoveReceipt, error)) (MoveReceipt, error) {
|
|
633
|
-
current, c := e.eligible(ctx, d.Subject.Username, d.Subject.UID, true)
|
|
634
|
-
if c != "" || !sameIdentity(s, current) {
|
|
635
|
-
return MoveReceipt{}, errors.New("identity changed")
|
|
636
|
-
}
|
|
637
|
-
if _, x := e.DSM.API(ctx, s.Username, "files.checkPermission", map[string]any{"path": p.Dest}); x != nil {
|
|
638
|
-
return MoveReceipt{}, x
|
|
639
|
-
}
|
|
640
|
-
e.commitMu.Lock()
|
|
641
|
-
defer e.commitMu.Unlock()
|
|
642
|
-
disabled, x := e.Store.Disabled()
|
|
643
|
-
fresh, x2 := e.Store.Get(d.ID)
|
|
644
|
-
if x != nil || x2 != nil || disabled || fresh.Revoked || !e.Now().Before(fresh.Expires) || ctx.Err() != nil {
|
|
645
|
-
return MoveReceipt{}, errors.New("write fenced")
|
|
646
|
-
}
|
|
647
|
-
return publish()
|
|
648
|
-
})
|
|
649
|
-
if err = e.Writer.Write(writerCtx, s, p.Staging, real, p.Name, d.Root); err != nil {
|
|
650
|
-
return deny("WRITE_FAILED")
|
|
651
|
-
}
|
|
652
|
-
return success(map[string]any{"path": strings.TrimSuffix(p.Dest, "/") + "/" + p.Name})
|
|
653
|
-
}
|
|
654
|
-
args := map[string]any{"path": path}
|
|
655
|
-
if r.Op == "files.createFolder" {
|
|
656
|
-
if !validName(p.Name) {
|
|
657
|
-
return deny("INVALID_REQUEST")
|
|
658
|
-
}
|
|
659
|
-
args["name"] = p.Name
|
|
660
|
-
}
|
|
661
|
-
done, code := e.beginLegacy(d)
|
|
662
|
-
if code != "" {
|
|
663
|
-
return deny(code)
|
|
664
|
-
}
|
|
665
|
-
defer done()
|
|
666
|
-
out, err := e.DSM.API(ctx, s.Username, r.Op, args)
|
|
667
|
-
if err != nil {
|
|
668
|
-
return deny("DSM_FAILED")
|
|
669
|
-
}
|
|
670
|
-
return success(out)
|
|
671
|
-
}
|
|
672
|
-
func publicSubject(s Subject) any { return map[string]any{"username": s.Username, "uid": s.UID} }
|
|
673
|
-
func publicDelegation(d Delegation) any {
|
|
674
|
-
out := map[string]any{"delegation_id": d.ID, "subject": publicSubject(d.Subject), "job_id": d.Job, "ops": d.Ops, "scope": d.Scope, "path": d.Path, "expires_at": d.Expires, "revoked": d.Revoked, "destination": d.DestinationKey, "lifetime": d.Lifetime}
|
|
675
|
-
if d.ScopeGeneration != 0 {
|
|
676
|
-
out["scope_generation"] = d.ScopeGeneration
|
|
677
|
-
}
|
|
678
|
-
return out
|
|
679
|
-
}
|
|
680
|
-
func scopeVirtual(scope string) string {
|
|
681
|
-
if scope == "home" {
|
|
682
|
-
return "/home"
|
|
683
|
-
}
|
|
684
|
-
if strings.HasPrefix(scope, "shared:") && validName(strings.TrimPrefix(scope, "shared:")) {
|
|
685
|
-
return "/" + strings.TrimPrefix(scope, "shared:")
|
|
686
|
-
}
|
|
687
|
-
return ""
|
|
688
|
-
}
|
|
689
|
-
func scopedPath(d Delegation, p string) (string, error) {
|
|
690
|
-
virtual := scopeVirtual(d.Scope)
|
|
691
|
-
if virtual == "" || !cleanPath(p) || !within(virtual, p) {
|
|
692
|
-
return "", errors.New("scope")
|
|
693
|
-
}
|
|
694
|
-
// Root is the bound delegation directory; Path is its File Station spelling.
|
|
695
|
-
base := d.Path
|
|
696
|
-
if base == "" {
|
|
697
|
-
base = virtual
|
|
698
|
-
}
|
|
699
|
-
if !within(base, p) {
|
|
700
|
-
return "", errors.New("scope")
|
|
701
|
-
}
|
|
702
|
-
real, err := filepath.EvalSymlinks(filepath.Join(d.Root, strings.TrimPrefix(strings.TrimPrefix(p, base), "/")))
|
|
703
|
-
if err != nil || !within(d.Root, real) {
|
|
704
|
-
return "", errors.New("scope")
|
|
705
|
-
}
|
|
706
|
-
return real, nil
|
|
707
|
-
}
|
|
708
|
-
func validRelative(p string) bool {
|
|
709
|
-
if p == "" || filepath.IsAbs(p) || filepath.Clean(p) != p {
|
|
710
|
-
return false
|
|
711
|
-
}
|
|
712
|
-
for _, part := range strings.Split(p, "/") {
|
|
713
|
-
if !validName(part) || part == "." {
|
|
714
|
-
return false
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
return true
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
// Permanent destinations reject every symlink component; legacy File Station
|
|
721
|
-
// lookup retains its historical canonical-path semantics.
|
|
722
|
-
func mappedDirectory(d Delegation, p string) (string, error) {
|
|
723
|
-
base := d.Path
|
|
724
|
-
if base == "" {
|
|
725
|
-
base = scopeVirtual(d.Scope)
|
|
726
|
-
}
|
|
727
|
-
if base == "" || !cleanPath(d.Root) || !cleanPath(p) || !within(base, p) {
|
|
728
|
-
return "", errors.New("scope")
|
|
729
|
-
}
|
|
730
|
-
real := filepath.Join(d.Root, strings.TrimPrefix(strings.TrimPrefix(p, base), "/"))
|
|
731
|
-
if _, err := bindDirectory(real); err != nil {
|
|
732
|
-
return "", err
|
|
733
|
-
}
|
|
734
|
-
return real, nil
|
|
735
|
-
}
|