@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,926 +0,0 @@
|
|
|
1
|
-
package main
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"bufio"
|
|
5
|
-
"context"
|
|
6
|
-
"encoding/json"
|
|
7
|
-
"errors"
|
|
8
|
-
"os"
|
|
9
|
-
"path/filepath"
|
|
10
|
-
"strings"
|
|
11
|
-
"sync"
|
|
12
|
-
"time"
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
// Copy performs bulk work outside the commit lock. The callback is the sole
|
|
16
|
-
// authority to publish, after a durable intent and one final fence check.
|
|
17
|
-
type MoveWriter interface {
|
|
18
|
-
Move(context.Context, Subject, Operation, Delegation, func(func() (MoveReceipt, error)) (MoveReceipt, error)) (MoveReceipt, error)
|
|
19
|
-
}
|
|
20
|
-
type operationRuntime struct {
|
|
21
|
-
ctx context.Context
|
|
22
|
-
cancel context.CancelFunc
|
|
23
|
-
wake chan struct{}
|
|
24
|
-
done chan struct{}
|
|
25
|
-
cancelJob context.CancelFunc
|
|
26
|
-
job string
|
|
27
|
-
failed bool
|
|
28
|
-
cancelReason string // commitMu protects the first acknowledged cancellation cause.
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const moveValidationTimeout = 30 * time.Second
|
|
32
|
-
|
|
33
|
-
const userCancelReason = "operation-canceled-by-user"
|
|
34
|
-
|
|
35
|
-
func (r *operationRuntime) cancelJobLocked(reason string) {
|
|
36
|
-
if r.cancelJob != nil {
|
|
37
|
-
if r.cancelReason == "" {
|
|
38
|
-
r.cancelReason = reason
|
|
39
|
-
}
|
|
40
|
-
r.cancelJob()
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
func isExtension(op string) bool {
|
|
45
|
-
return contains([]string{"files.moveFromStaging", "files.operationStatus", "files.cancelOperation", "delegate.disable", "delegate.enable", "delegate.audit"}, op)
|
|
46
|
-
}
|
|
47
|
-
func (e *Executor) startOperations(parent context.Context) error {
|
|
48
|
-
e.commitMu.Lock()
|
|
49
|
-
defer e.commitMu.Unlock()
|
|
50
|
-
if e.async != nil {
|
|
51
|
-
return errors.New("operations already started")
|
|
52
|
-
}
|
|
53
|
-
ops, err := e.Store.Operations()
|
|
54
|
-
if err != nil {
|
|
55
|
-
return err
|
|
56
|
-
}
|
|
57
|
-
for _, op := range ops {
|
|
58
|
-
if op.Package != e.Policy.Package {
|
|
59
|
-
return errors.New("operation package")
|
|
60
|
-
}
|
|
61
|
-
if op.State == "copying" {
|
|
62
|
-
op.State, op.Code = "interrupted", "interrupted"
|
|
63
|
-
if op.PublishIntent {
|
|
64
|
-
op.State, op.Code = "uncertain", "uncertain"
|
|
65
|
-
} else if op.CancelRequested != "" {
|
|
66
|
-
op.State, op.Code, op.Reason = "canceled", "OPERATION_CANCELED", op.CancelRequested
|
|
67
|
-
}
|
|
68
|
-
op.Updated = e.Now().UTC()
|
|
69
|
-
if err = e.Store.PutOperation(op); err != nil {
|
|
70
|
-
return err
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
ctx, cancel := context.WithCancel(parent)
|
|
75
|
-
r := &operationRuntime{ctx: ctx, cancel: cancel, wake: make(chan struct{}, 1), done: make(chan struct{})}
|
|
76
|
-
e.async = r
|
|
77
|
-
go e.operationLoop(r)
|
|
78
|
-
e.wakeLocked()
|
|
79
|
-
return nil
|
|
80
|
-
}
|
|
81
|
-
func (e *Executor) stopOperations() {
|
|
82
|
-
e.commitMu.Lock()
|
|
83
|
-
r := e.async
|
|
84
|
-
if r != nil {
|
|
85
|
-
r.cancel()
|
|
86
|
-
}
|
|
87
|
-
e.commitMu.Unlock()
|
|
88
|
-
if r != nil {
|
|
89
|
-
<-r.done
|
|
90
|
-
e.commitMu.Lock()
|
|
91
|
-
e.async = nil
|
|
92
|
-
e.commitMu.Unlock()
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
func (e *Executor) wakeLocked() {
|
|
96
|
-
if e.async != nil {
|
|
97
|
-
select {
|
|
98
|
-
case e.async.wake <- struct{}{}:
|
|
99
|
-
default:
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
func (e *Executor) cancelGrantLocked(id, reason string) {
|
|
104
|
-
if e.async == nil {
|
|
105
|
-
return
|
|
106
|
-
}
|
|
107
|
-
ops, err := e.Store.Operations()
|
|
108
|
-
if err != nil {
|
|
109
|
-
e.async.failed = true
|
|
110
|
-
e.async.cancelJobLocked("storage-error")
|
|
111
|
-
return
|
|
112
|
-
}
|
|
113
|
-
for _, op := range ops {
|
|
114
|
-
if op.ID == id && op.State == "queued" {
|
|
115
|
-
op.State = "canceled"
|
|
116
|
-
op.Code = "OPERATION_CANCELED"
|
|
117
|
-
op.Reason = reason
|
|
118
|
-
op.Updated = e.Now().UTC()
|
|
119
|
-
if e.Store.PutOperation(op) != nil {
|
|
120
|
-
e.async.failed = true
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// A copy in flight records the revocation before its writer is signaled,
|
|
124
|
-
// so a stop or crash settles it canceled with this reason, not interrupted.
|
|
125
|
-
if op.ID == id && op.State == "copying" && op.CancelRequested == "" {
|
|
126
|
-
op.CancelRequested = reason
|
|
127
|
-
op.Updated = e.Now().UTC()
|
|
128
|
-
if e.Store.PutOperation(op) != nil {
|
|
129
|
-
e.async.failed = true
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if op.ID == id && op.Job == e.async.job && e.async.cancelJob != nil {
|
|
133
|
-
e.async.cancelJobLocked(reason)
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
func (e *Executor) handleExtension(ctx context.Context, r Request) Response {
|
|
138
|
-
if ctx.Err() != nil {
|
|
139
|
-
return deny("EXECUTOR_PAUSED")
|
|
140
|
-
}
|
|
141
|
-
if r.Version != 1 {
|
|
142
|
-
return deny("INVALID_REQUEST")
|
|
143
|
-
}
|
|
144
|
-
if !contains(e.Policy.Operations, r.Op) {
|
|
145
|
-
return deny("POLICY_DENIED")
|
|
146
|
-
}
|
|
147
|
-
var p Params
|
|
148
|
-
if len(r.Params) == 0 {
|
|
149
|
-
r.Params = json.RawMessage(`{}`)
|
|
150
|
-
}
|
|
151
|
-
if strictJSON(r.Params, &p) != nil {
|
|
152
|
-
return deny("INVALID_REQUEST")
|
|
153
|
-
}
|
|
154
|
-
allowed := map[string]string{"files.moveFromStaging": "delegation_id job_id staging name size", "files.operationStatus": "delegation_id job_id", "files.cancelOperation": "delegation_id job_id", "delegate.disable": "", "delegate.enable": "", "delegate.audit": ""}
|
|
155
|
-
var keys map[string]json.RawMessage
|
|
156
|
-
if json.Unmarshal(r.Params, &keys) != nil {
|
|
157
|
-
return deny("INVALID_REQUEST")
|
|
158
|
-
}
|
|
159
|
-
for k := range keys {
|
|
160
|
-
if !contains(strings.Fields(allowed[r.Op]), k) {
|
|
161
|
-
return deny("INVALID_REQUEST")
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
if r.Op == "delegate.disable" || r.Op == "delegate.enable" || r.Op == "delegate.audit" {
|
|
165
|
-
return e.administration(ctx, r)
|
|
166
|
-
}
|
|
167
|
-
if !tokenRE.MatchString(p.Job) || !idRE.MatchString(p.ID) {
|
|
168
|
-
return deny("INVALID_REQUEST")
|
|
169
|
-
}
|
|
170
|
-
if r.Op != "files.moveFromStaging" {
|
|
171
|
-
// Authenticated management is owner-bound. Auth-less producer lookup/cancel
|
|
172
|
-
// requires BOTH protected grant reference and original job, never a new job.
|
|
173
|
-
var caller Subject
|
|
174
|
-
hasAuth := r.Auth.hasKeys || r.Auth.Cookie != "" || r.Auth.SynoToken != ""
|
|
175
|
-
if hasAuth {
|
|
176
|
-
var code string
|
|
177
|
-
caller, code = e.verified(ctx, r.Auth)
|
|
178
|
-
if code != "" {
|
|
179
|
-
return deny(code)
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
e.commitMu.Lock()
|
|
183
|
-
defer e.commitMu.Unlock()
|
|
184
|
-
op, err := e.Store.GetOperation(p.Job)
|
|
185
|
-
if os.IsNotExist(err) && r.Op == "files.cancelOperation" {
|
|
186
|
-
return e.cancelUnadmittedLocked(p, hasAuth, caller)
|
|
187
|
-
}
|
|
188
|
-
if err != nil || op.Package != e.Policy.Package || op.ID != p.ID {
|
|
189
|
-
return deny("operation-not-found")
|
|
190
|
-
}
|
|
191
|
-
if hasAuth && (caller.Username != op.Subject.Username || caller.UID != op.Subject.UID) {
|
|
192
|
-
return deny("operation-not-found")
|
|
193
|
-
}
|
|
194
|
-
if r.Op == "files.cancelOperation" {
|
|
195
|
-
if code := e.cancelOperationLocked(&op); code != "" {
|
|
196
|
-
return deny(code)
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return success(publicOperation(op))
|
|
200
|
-
}
|
|
201
|
-
if len(keys) != 5 || !validRelative(p.Staging) || !validName(p.Name) {
|
|
202
|
-
return deny("INVALID_REQUEST")
|
|
203
|
-
}
|
|
204
|
-
if _, ok := keys["size"]; !ok || p.Size < 0 || p.Size > maxMoveBytes || string(keys["size"]) == "null" {
|
|
205
|
-
return deny("invalid-size")
|
|
206
|
-
}
|
|
207
|
-
if _, ok := e.Writer.(MoveWriter); !ok {
|
|
208
|
-
return deny("EXECUTOR_PAUSED")
|
|
209
|
-
}
|
|
210
|
-
// Never reinterpret provided credentials as offline authority.
|
|
211
|
-
if r.Auth.hasKeys || r.Auth.Cookie != "" || r.Auth.SynoToken != "" {
|
|
212
|
-
s, code := e.verified(ctx, r.Auth)
|
|
213
|
-
if code != "" {
|
|
214
|
-
return deny(code)
|
|
215
|
-
}
|
|
216
|
-
d, err := e.Store.Get(p.ID)
|
|
217
|
-
if err != nil || s.UID != d.Subject.UID || s.Username != d.Subject.Username {
|
|
218
|
-
return deny("DELEGATION_DENIED")
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
e.commitMu.Lock()
|
|
222
|
-
old, err := e.Store.GetOperation(p.Job)
|
|
223
|
-
e.commitMu.Unlock()
|
|
224
|
-
if err == nil {
|
|
225
|
-
if old.Package == e.Policy.Package && old.ID == p.ID && old.canceledBeforeAdmission() {
|
|
226
|
-
return success(publicOperation(old))
|
|
227
|
-
}
|
|
228
|
-
if old.Package != e.Policy.Package || old.ID != p.ID || old.Staging != p.Staging || old.Name != p.Name || old.Size != p.Size {
|
|
229
|
-
return deny("operation-conflict")
|
|
230
|
-
}
|
|
231
|
-
return success(publicOperation(old))
|
|
232
|
-
}
|
|
233
|
-
if !os.IsNotExist(err) {
|
|
234
|
-
return deny("STORAGE_ERROR")
|
|
235
|
-
}
|
|
236
|
-
e.commitMu.Lock()
|
|
237
|
-
disabled, disabledErr := e.Store.Disabled()
|
|
238
|
-
e.commitMu.Unlock()
|
|
239
|
-
if disabledErr != nil {
|
|
240
|
-
return deny("STORAGE_ERROR")
|
|
241
|
-
}
|
|
242
|
-
if disabled {
|
|
243
|
-
return deny("disabled")
|
|
244
|
-
}
|
|
245
|
-
d, err := e.Store.Get(p.ID)
|
|
246
|
-
if err != nil {
|
|
247
|
-
return deny("DELEGATION_DENIED")
|
|
248
|
-
}
|
|
249
|
-
s, code := e.validateMove(ctx, d)
|
|
250
|
-
if code != "" {
|
|
251
|
-
if code != "EXECUTOR_PAUSED" && e.invalidateMove(d) != nil {
|
|
252
|
-
return deny("STORAGE_ERROR")
|
|
253
|
-
}
|
|
254
|
-
return deny(code)
|
|
255
|
-
}
|
|
256
|
-
e.commitMu.Lock()
|
|
257
|
-
defer e.commitMu.Unlock()
|
|
258
|
-
if e.async == nil || e.async.ctx.Err() != nil || e.async.failed {
|
|
259
|
-
return deny("EXECUTOR_PAUSED")
|
|
260
|
-
}
|
|
261
|
-
if code = e.moveFenceLocked(d); code != "" {
|
|
262
|
-
return deny(code)
|
|
263
|
-
}
|
|
264
|
-
if old, err = e.Store.GetOperation(p.Job); err == nil {
|
|
265
|
-
if old.ID == p.ID && old.canceledBeforeAdmission() {
|
|
266
|
-
return success(publicOperation(old))
|
|
267
|
-
}
|
|
268
|
-
if old.ID != p.ID || old.Staging != p.Staging || old.Name != p.Name || old.Size != p.Size {
|
|
269
|
-
return deny("operation-conflict")
|
|
270
|
-
}
|
|
271
|
-
return success(publicOperation(old))
|
|
272
|
-
} else if !os.IsNotExist(err) {
|
|
273
|
-
return deny("STORAGE_ERROR")
|
|
274
|
-
}
|
|
275
|
-
ops, err := e.Store.Operations()
|
|
276
|
-
if err != nil {
|
|
277
|
-
return deny("STORAGE_ERROR")
|
|
278
|
-
}
|
|
279
|
-
queued := 0
|
|
280
|
-
for _, op := range ops {
|
|
281
|
-
if op.State == "queued" {
|
|
282
|
-
queued++
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
if queued >= maxQueued {
|
|
286
|
-
return deny("queue-full")
|
|
287
|
-
}
|
|
288
|
-
op := Operation{Version: 1, Package: e.Policy.Package, ID: d.ID, Job: p.Job, Subject: s, Staging: p.Staging, Name: p.Name, Size: p.Size, State: "queued", Updated: e.Now().UTC()}
|
|
289
|
-
if e.auditLocked(s, r.Op, op.Job, d.Path, "admitting") != nil || e.Store.PutOperation(op) != nil {
|
|
290
|
-
return deny("STORAGE_ERROR")
|
|
291
|
-
}
|
|
292
|
-
e.wakeLocked()
|
|
293
|
-
return success(publicOperation(op))
|
|
294
|
-
}
|
|
295
|
-
func publicOperation(op Operation) any {
|
|
296
|
-
out := map[string]any{"job_id": op.Job, "state": op.State}
|
|
297
|
-
if op.State == "committed" {
|
|
298
|
-
out["receipt"] = map[string]any{"path": op.Path, "size": op.Size}
|
|
299
|
-
}
|
|
300
|
-
if op.State == "copying" && op.CancelRequested != "" {
|
|
301
|
-
op.Code, op.Reason = "CANCEL_REQUESTED", op.CancelRequested
|
|
302
|
-
}
|
|
303
|
-
if op.Code != "" {
|
|
304
|
-
out["code"] = op.Code
|
|
305
|
-
}
|
|
306
|
-
if op.Reason != "" {
|
|
307
|
-
out["reason"] = op.Reason
|
|
308
|
-
}
|
|
309
|
-
return out
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// cancelOperationLocked cancels a queued operation at once. A copy in flight
|
|
313
|
-
// keeps copying until its writer stops, so the request is made durable first:
|
|
314
|
-
// a restart settles it canceled instead of interrupted. Terminal operations and
|
|
315
|
-
// repeated requests are answered unchanged.
|
|
316
|
-
func (e *Executor) cancelOperationLocked(op *Operation) string {
|
|
317
|
-
switch {
|
|
318
|
-
case op.State == "queued":
|
|
319
|
-
op.State, op.Code, op.Reason = "canceled", "OPERATION_CANCELED", userCancelReason
|
|
320
|
-
case op.State == "copying" && op.CancelRequested == "":
|
|
321
|
-
op.CancelRequested = userCancelReason
|
|
322
|
-
default:
|
|
323
|
-
return ""
|
|
324
|
-
}
|
|
325
|
-
op.Updated = e.Now().UTC()
|
|
326
|
-
if e.Store.PutOperation(*op) != nil {
|
|
327
|
-
return "STORAGE_ERROR"
|
|
328
|
-
}
|
|
329
|
-
if op.State == "copying" && e.async != nil && e.async.job == op.Job {
|
|
330
|
-
e.async.cancelJobLocked(userCancelReason)
|
|
331
|
-
}
|
|
332
|
-
if e.auditLocked(op.Subject, "files.cancelOperation", op.Job, "", "canceled") != nil {
|
|
333
|
-
return "STORAGE_ERROR"
|
|
334
|
-
}
|
|
335
|
-
return ""
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// cancelUnadmittedLocked answers a cancel that arrives before its admission,
|
|
339
|
-
// for example while a lost or slow admission is still being validated. A
|
|
340
|
-
// tombstone under the package grant makes that admission return canceled.
|
|
341
|
-
func (e *Executor) cancelUnadmittedLocked(p Params, hasAuth bool, caller Subject) Response {
|
|
342
|
-
d, err := e.Store.Get(p.ID)
|
|
343
|
-
if err != nil || d.Package != e.Policy.Package || (hasAuth && (caller.Username != d.Subject.Username || caller.UID != d.Subject.UID)) {
|
|
344
|
-
return deny("operation-not-found")
|
|
345
|
-
}
|
|
346
|
-
op := Operation{Version: 1, Package: e.Policy.Package, ID: d.ID, Job: p.Job, Subject: d.Subject, State: "canceled", Code: "OPERATION_CANCELED", Reason: userCancelReason, Updated: e.Now().UTC()}
|
|
347
|
-
if e.Store.PutOperation(op) != nil || e.auditLocked(op.Subject, "files.cancelOperation", op.Job, "", "canceled") != nil {
|
|
348
|
-
return deny("STORAGE_ERROR")
|
|
349
|
-
}
|
|
350
|
-
return success(publicOperation(op))
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
func (e *Executor) administration(ctx context.Context, r Request) Response {
|
|
354
|
-
s, code := e.verified(ctx, r.Auth)
|
|
355
|
-
if code != "" {
|
|
356
|
-
return deny(code)
|
|
357
|
-
}
|
|
358
|
-
if r.Op != "delegate.audit" && !s.Admin {
|
|
359
|
-
return deny("ADMIN_REQUIRED")
|
|
360
|
-
}
|
|
361
|
-
if e.DSM.Allow(ctx, s, e.Policy.App, e.Policy.Entry) != nil {
|
|
362
|
-
return deny("APP_DENIED")
|
|
363
|
-
}
|
|
364
|
-
e.commitMu.Lock()
|
|
365
|
-
locked := true
|
|
366
|
-
defer func() {
|
|
367
|
-
if locked {
|
|
368
|
-
e.commitMu.Unlock()
|
|
369
|
-
}
|
|
370
|
-
}()
|
|
371
|
-
if r.Op == "delegate.audit" {
|
|
372
|
-
out := []AuditEvent{}
|
|
373
|
-
total := 0
|
|
374
|
-
sizes := []int{}
|
|
375
|
-
for _, name := range []string{"audit.previous", "audit.jsonl"} {
|
|
376
|
-
f, err := os.Open(filepath.Join(e.Store.Dir, name))
|
|
377
|
-
if os.IsNotExist(err) {
|
|
378
|
-
continue
|
|
379
|
-
}
|
|
380
|
-
if err != nil {
|
|
381
|
-
return deny("STORAGE_ERROR")
|
|
382
|
-
}
|
|
383
|
-
scan := bufio.NewScanner(f)
|
|
384
|
-
scan.Buffer(make([]byte, 4096), maxRequest)
|
|
385
|
-
for scan.Scan() {
|
|
386
|
-
var event AuditEvent
|
|
387
|
-
if strictJSON(scan.Bytes(), &event) != nil {
|
|
388
|
-
f.Close()
|
|
389
|
-
return deny("STORAGE_ERROR")
|
|
390
|
-
}
|
|
391
|
-
if event.Package == e.Policy.Package && (s.Admin || (s.Username == event.Username && s.UID == event.UID)) {
|
|
392
|
-
out = append(out, event)
|
|
393
|
-
n := len(scan.Bytes()) + 1
|
|
394
|
-
total += n
|
|
395
|
-
sizes = append(sizes, n)
|
|
396
|
-
for len(out) > 256 || total > maxOutput-4096 {
|
|
397
|
-
total -= sizes[0]
|
|
398
|
-
sizes = sizes[1:]
|
|
399
|
-
out = out[1:]
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
err = scan.Err()
|
|
404
|
-
f.Close()
|
|
405
|
-
if err != nil {
|
|
406
|
-
return deny("STORAGE_ERROR")
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
return success(map[string]any{"events": out})
|
|
410
|
-
}
|
|
411
|
-
wasDisabled, disabledErr := e.Store.Disabled()
|
|
412
|
-
if disabledErr != nil {
|
|
413
|
-
return deny("STORAGE_ERROR")
|
|
414
|
-
}
|
|
415
|
-
if r.Op == "delegate.enable" && !wasDisabled {
|
|
416
|
-
return success(map[string]any{"disabled": false})
|
|
417
|
-
}
|
|
418
|
-
// Disable becomes durable FIRST, including when revocation subsequently fails.
|
|
419
|
-
if r.Op == "delegate.disable" {
|
|
420
|
-
if e.Store.SetDisabled(true) != nil {
|
|
421
|
-
return deny("STORAGE_ERROR")
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
ds, err := e.Store.List()
|
|
425
|
-
if err != nil {
|
|
426
|
-
return deny("STORAGE_ERROR")
|
|
427
|
-
}
|
|
428
|
-
for _, d := range ds {
|
|
429
|
-
if d.Package != e.Policy.Package {
|
|
430
|
-
continue
|
|
431
|
-
}
|
|
432
|
-
d.Revoked = true
|
|
433
|
-
if e.Store.Put(d) != nil {
|
|
434
|
-
return deny("STORAGE_ERROR")
|
|
435
|
-
}
|
|
436
|
-
e.cancelGrantLocked(d.ID, "integration-disabled")
|
|
437
|
-
}
|
|
438
|
-
if e.auditLocked(s, r.Op, "", "", r.Op) != nil {
|
|
439
|
-
return deny("STORAGE_ERROR")
|
|
440
|
-
}
|
|
441
|
-
if r.Op == "delegate.enable" {
|
|
442
|
-
if e.Store.SetDisabled(false) != nil {
|
|
443
|
-
return deny("STORAGE_ERROR")
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
pending := e.legacyPendingLocked("")
|
|
447
|
-
e.commitMu.Unlock()
|
|
448
|
-
locked = false
|
|
449
|
-
if waitLegacy(ctx, pending) != nil {
|
|
450
|
-
return deny("EXECUTOR_PAUSED")
|
|
451
|
-
}
|
|
452
|
-
return success(map[string]any{"disabled": r.Op == "delegate.disable"})
|
|
453
|
-
}
|
|
454
|
-
func (e *Executor) moveFenceLocked(d Delegation) string {
|
|
455
|
-
disabled, err := e.Store.Disabled()
|
|
456
|
-
if err != nil {
|
|
457
|
-
return "STORAGE_ERROR"
|
|
458
|
-
}
|
|
459
|
-
if disabled {
|
|
460
|
-
return "disabled"
|
|
461
|
-
}
|
|
462
|
-
fresh, err := e.Store.Get(d.ID)
|
|
463
|
-
if err != nil || fresh.Package != e.Policy.Package || fresh.Revoked || !e.scopeMatchesLocked(fresh) || fresh.Lifetime != "until-revoked" || fresh.Root != d.Root || fresh.Directory != d.Directory {
|
|
464
|
-
return "DELEGATION_DENIED"
|
|
465
|
-
}
|
|
466
|
-
return ""
|
|
467
|
-
}
|
|
468
|
-
func (e *Executor) validateMove(ctx context.Context, d Delegation) (Subject, string) {
|
|
469
|
-
if ctx.Err() != nil {
|
|
470
|
-
return Subject{}, "EXECUTOR_PAUSED"
|
|
471
|
-
}
|
|
472
|
-
if d.Package != e.Policy.Package || d.Revoked || d.Lifetime != "until-revoked" || e.Policy.Lifetime != d.Lifetime || !e.scopeMatches(d) || !contains(e.Policy.Destinations, d.DestinationKey) || !contains(d.Ops, "files.moveFromStaging") {
|
|
473
|
-
return Subject{}, "DELEGATION_DENIED"
|
|
474
|
-
}
|
|
475
|
-
s, code := e.eligible(ctx, d.Subject.Username, d.Subject.UID, true)
|
|
476
|
-
if ctx.Err() != nil {
|
|
477
|
-
return s, "EXECUTOR_PAUSED"
|
|
478
|
-
}
|
|
479
|
-
if code != "" {
|
|
480
|
-
return s, code
|
|
481
|
-
}
|
|
482
|
-
moveValidationStage(ctx, "scope-root")
|
|
483
|
-
root, err := e.DSM.ScopeRoot(ctx, s, d.Scope)
|
|
484
|
-
if moveValidationDeadline(ctx, err) {
|
|
485
|
-
return s, "EXECUTOR_PAUSED"
|
|
486
|
-
}
|
|
487
|
-
if ctx.Err() != nil {
|
|
488
|
-
return s, "EXECUTOR_PAUSED"
|
|
489
|
-
}
|
|
490
|
-
if err != nil {
|
|
491
|
-
return s, "SCOPE_DENIED"
|
|
492
|
-
}
|
|
493
|
-
moveValidationStage(ctx, "directory-identity")
|
|
494
|
-
check := d
|
|
495
|
-
check.Root = root
|
|
496
|
-
check.Path = scopeVirtual(d.Scope)
|
|
497
|
-
real, err := mappedDirectory(check, d.Path)
|
|
498
|
-
if err != nil || real != d.Root {
|
|
499
|
-
return s, "SCOPE_DENIED"
|
|
500
|
-
}
|
|
501
|
-
di, err := bindDirectory(real)
|
|
502
|
-
if err != nil || di != d.Directory {
|
|
503
|
-
return s, "SCOPE_DENIED"
|
|
504
|
-
}
|
|
505
|
-
moveValidationStage(ctx, "permission")
|
|
506
|
-
if _, err = e.DSM.API(ctx, s.Username, "files.checkPermission", map[string]any{"path": d.Path}); err != nil {
|
|
507
|
-
if ctx.Err() != nil || moveValidationDeadline(ctx, err) {
|
|
508
|
-
return s, "EXECUTOR_PAUSED"
|
|
509
|
-
}
|
|
510
|
-
return s, "PERMISSION_DENIED"
|
|
511
|
-
}
|
|
512
|
-
if ctx.Err() != nil {
|
|
513
|
-
return s, "EXECUTOR_PAUSED"
|
|
514
|
-
}
|
|
515
|
-
return s, ""
|
|
516
|
-
}
|
|
517
|
-
func (e *Executor) operationLoop(r *operationRuntime) {
|
|
518
|
-
defer close(r.done)
|
|
519
|
-
e.recoverParts(r)
|
|
520
|
-
for {
|
|
521
|
-
select {
|
|
522
|
-
case <-r.ctx.Done():
|
|
523
|
-
return
|
|
524
|
-
case <-r.wake:
|
|
525
|
-
}
|
|
526
|
-
for {
|
|
527
|
-
e.commitMu.Lock()
|
|
528
|
-
ops, err := e.Store.Operations()
|
|
529
|
-
if err != nil {
|
|
530
|
-
r.failed = true
|
|
531
|
-
e.commitMu.Unlock()
|
|
532
|
-
return
|
|
533
|
-
}
|
|
534
|
-
var op Operation
|
|
535
|
-
found := false
|
|
536
|
-
for _, item := range ops {
|
|
537
|
-
if item.State == "queued" {
|
|
538
|
-
op = item
|
|
539
|
-
found = true
|
|
540
|
-
break
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
if !found || r.ctx.Err() != nil || r.failed {
|
|
544
|
-
e.commitMu.Unlock()
|
|
545
|
-
break
|
|
546
|
-
}
|
|
547
|
-
ctx, cancel := context.WithTimeout(r.ctx, 24*time.Hour)
|
|
548
|
-
r.job = op.Job
|
|
549
|
-
r.cancelReason = ""
|
|
550
|
-
r.cancelJob = cancel
|
|
551
|
-
op.State = "copying"
|
|
552
|
-
op.Updated = e.Now().UTC()
|
|
553
|
-
if err = e.Store.PutOperation(op); err != nil {
|
|
554
|
-
r.failed = true
|
|
555
|
-
cancel()
|
|
556
|
-
e.commitMu.Unlock()
|
|
557
|
-
return
|
|
558
|
-
}
|
|
559
|
-
e.commitMu.Unlock()
|
|
560
|
-
e.performMove(ctx, r, op)
|
|
561
|
-
cancel()
|
|
562
|
-
e.commitMu.Lock()
|
|
563
|
-
r.job = ""
|
|
564
|
-
r.cancelJob = nil
|
|
565
|
-
e.commitMu.Unlock()
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
func (e *Executor) performMove(ctx context.Context, r *operationRuntime, op Operation) {
|
|
570
|
-
release, slotErr := e.acquireCopy(ctx)
|
|
571
|
-
if slotErr == nil {
|
|
572
|
-
defer release()
|
|
573
|
-
}
|
|
574
|
-
d, err := e.Store.Get(op.ID)
|
|
575
|
-
var s Subject
|
|
576
|
-
code := "DELEGATION_DENIED"
|
|
577
|
-
if err == nil {
|
|
578
|
-
s, code = e.validateMove(ctx, d)
|
|
579
|
-
}
|
|
580
|
-
if slotErr != nil {
|
|
581
|
-
code = "EXECUTOR_PAUSED"
|
|
582
|
-
}
|
|
583
|
-
var receipt MoveReceipt
|
|
584
|
-
if code == "" {
|
|
585
|
-
// A deadline is an unavailable observation, not evidence of revocation.
|
|
586
|
-
// Bulk bytes remain private; publication still requires fresh validation.
|
|
587
|
-
// Local revoke/scope/disable handlers cancel directly under commitMu, even
|
|
588
|
-
// while this bounded DSM check is blocked by load or swap.
|
|
589
|
-
pollCtx, stop := context.WithCancel(ctx)
|
|
590
|
-
var poll sync.WaitGroup
|
|
591
|
-
poll.Add(1)
|
|
592
|
-
go func() {
|
|
593
|
-
defer poll.Done()
|
|
594
|
-
diagnostics := 8
|
|
595
|
-
tick := time.NewTicker(5 * time.Second)
|
|
596
|
-
defer tick.Stop()
|
|
597
|
-
for {
|
|
598
|
-
select {
|
|
599
|
-
case <-pollCtx.Done():
|
|
600
|
-
return
|
|
601
|
-
case <-tick.C:
|
|
602
|
-
checkCtx, checkCancel := context.WithTimeout(pollCtx, moveValidationTimeout)
|
|
603
|
-
current, c, transient := e.observeMoveValidation(checkCtx, d, op.Job, &diagnostics)
|
|
604
|
-
transient = transient && pollCtx.Err() == nil
|
|
605
|
-
if c == "" && !sameIdentity(s, current) {
|
|
606
|
-
c = "IDENTITY_CHANGED"
|
|
607
|
-
}
|
|
608
|
-
checkCancel()
|
|
609
|
-
e.commitMu.Lock()
|
|
610
|
-
fence := e.moveFenceLocked(d)
|
|
611
|
-
if c != "" && c != "EXECUTOR_PAUSED" && pollCtx.Err() == nil {
|
|
612
|
-
fresh, x := e.Store.Get(d.ID)
|
|
613
|
-
if x == nil {
|
|
614
|
-
fresh.Revoked = true
|
|
615
|
-
if e.Store.Put(fresh) != nil {
|
|
616
|
-
r.failed = true
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
if fence != "" {
|
|
621
|
-
r.cancelJobLocked("grant-inactive")
|
|
622
|
-
} else if c != "" && !transient && pollCtx.Err() == nil {
|
|
623
|
-
r.cancelJobLocked("validation-" + strings.ToLower(strings.ReplaceAll(c, "_", "-")))
|
|
624
|
-
}
|
|
625
|
-
e.commitMu.Unlock()
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
}()
|
|
629
|
-
writerCtx := context.WithValue(ctx, partRecordKey{}, func(part partMetadata) error {
|
|
630
|
-
e.commitMu.Lock()
|
|
631
|
-
defer e.commitMu.Unlock()
|
|
632
|
-
if ctx.Err() != nil {
|
|
633
|
-
return ctx.Err()
|
|
634
|
-
}
|
|
635
|
-
if code := e.moveFenceLocked(d); code != "" {
|
|
636
|
-
return errors.New(code)
|
|
637
|
-
}
|
|
638
|
-
op.Part = &part
|
|
639
|
-
if err := e.Store.PutOperation(op); err != nil {
|
|
640
|
-
r.failed = true
|
|
641
|
-
return err
|
|
642
|
-
}
|
|
643
|
-
return nil
|
|
644
|
-
})
|
|
645
|
-
receipt, err = e.Writer.(MoveWriter).Move(writerCtx, s, op, d, func(publish func() (MoveReceipt, error)) (MoveReceipt, error) {
|
|
646
|
-
current, c := e.validateMove(ctx, d)
|
|
647
|
-
if c != "" {
|
|
648
|
-
code = c
|
|
649
|
-
if c != "EXECUTOR_PAUSED" && e.invalidateMove(d) != nil {
|
|
650
|
-
return MoveReceipt{}, errors.New("STORAGE_ERROR")
|
|
651
|
-
}
|
|
652
|
-
return MoveReceipt{}, errors.New(c)
|
|
653
|
-
}
|
|
654
|
-
// Group changes between opening the child and publishing require a new attempt.
|
|
655
|
-
if !sameIdentity(s, current) {
|
|
656
|
-
return MoveReceipt{}, errors.New("IDENTITY_CHANGED")
|
|
657
|
-
}
|
|
658
|
-
e.commitMu.Lock()
|
|
659
|
-
defer e.commitMu.Unlock()
|
|
660
|
-
if ctx.Err() != nil || r.ctx.Err() != nil {
|
|
661
|
-
return MoveReceipt{}, ctx.Err()
|
|
662
|
-
}
|
|
663
|
-
if c = e.moveFenceLocked(d); c != "" {
|
|
664
|
-
return MoveReceipt{}, errors.New(c)
|
|
665
|
-
}
|
|
666
|
-
op.PublishIntent = true
|
|
667
|
-
op.Updated = e.Now().UTC()
|
|
668
|
-
if e.Store.PutOperation(op) != nil {
|
|
669
|
-
r.failed = true
|
|
670
|
-
return MoveReceipt{}, errors.New("STORAGE_ERROR")
|
|
671
|
-
}
|
|
672
|
-
out, x := publish()
|
|
673
|
-
if x == nil {
|
|
674
|
-
op.State = "committed"
|
|
675
|
-
op.Path = strings.TrimSuffix(d.Path, "/") + "/" + op.Name
|
|
676
|
-
if out.CleanupPending {
|
|
677
|
-
op.Code = "CLEANUP_PENDING"
|
|
678
|
-
}
|
|
679
|
-
op.Updated = e.Now().UTC()
|
|
680
|
-
if e.Store.PutOperation(op) != nil {
|
|
681
|
-
r.failed = true
|
|
682
|
-
return out, errors.New("STORAGE_ERROR")
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
return out, x
|
|
686
|
-
})
|
|
687
|
-
stop()
|
|
688
|
-
poll.Wait()
|
|
689
|
-
}
|
|
690
|
-
e.commitMu.Lock()
|
|
691
|
-
defer e.commitMu.Unlock()
|
|
692
|
-
saved, x := e.Store.GetOperation(op.Job)
|
|
693
|
-
if x != nil {
|
|
694
|
-
r.failed = true
|
|
695
|
-
return
|
|
696
|
-
}
|
|
697
|
-
if saved.State == "committed" {
|
|
698
|
-
if receipt.CleanupPending {
|
|
699
|
-
saved.Code = "CLEANUP_PENDING"
|
|
700
|
-
}
|
|
701
|
-
if e.Store.PutOperation(saved) != nil {
|
|
702
|
-
r.failed = true
|
|
703
|
-
}
|
|
704
|
-
if e.auditLocked(op.Subject, "files.moveFromStaging", op.Job, saved.Path, "committed") != nil {
|
|
705
|
-
r.failed = true
|
|
706
|
-
}
|
|
707
|
-
return
|
|
708
|
-
}
|
|
709
|
-
saved.State = "interrupted"
|
|
710
|
-
saved.Code = code
|
|
711
|
-
var rejected publishRejectedError
|
|
712
|
-
if errors.As(err, &rejected) {
|
|
713
|
-
saved.State = "interrupted"
|
|
714
|
-
saved.Code = rejected.Code
|
|
715
|
-
} else if saved.PublishIntent {
|
|
716
|
-
saved.State = "uncertain"
|
|
717
|
-
saved.Code = "uncertain"
|
|
718
|
-
} else if saved.CancelRequested != "" {
|
|
719
|
-
saved.State = "canceled"
|
|
720
|
-
saved.Code = "OPERATION_CANCELED"
|
|
721
|
-
saved.Reason = saved.CancelRequested
|
|
722
|
-
} else if ctx.Err() != nil && r.ctx.Err() == nil {
|
|
723
|
-
saved.State = "canceled"
|
|
724
|
-
saved.Code = "OPERATION_CANCELED"
|
|
725
|
-
saved.Reason = r.cancelReason
|
|
726
|
-
if saved.Reason == "" {
|
|
727
|
-
saved.Reason = "operation-deadline-exceeded"
|
|
728
|
-
}
|
|
729
|
-
} else if r.ctx.Err() != nil && code == "" {
|
|
730
|
-
// The executor stopped the writer; nothing about the destination failed.
|
|
731
|
-
saved.Code = "EXECUTOR_PAUSED"
|
|
732
|
-
} else if err != nil {
|
|
733
|
-
if code == "" {
|
|
734
|
-
saved.Code = "WRITE_FAILED"
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
// Eligibility failure invalidates the grant; transient copy errors do not.
|
|
738
|
-
if code != "" && code != "EXECUTOR_PAUSED" {
|
|
739
|
-
fresh, x := e.Store.Get(op.ID)
|
|
740
|
-
if x == nil {
|
|
741
|
-
fresh.Revoked = true
|
|
742
|
-
if e.Store.Put(fresh) != nil {
|
|
743
|
-
r.failed = true
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
saved.Updated = e.Now().UTC()
|
|
748
|
-
if e.Store.PutOperation(saved) != nil || e.auditLocked(op.Subject, "files.moveFromStaging", op.Job, d.Path, saved.State) != nil {
|
|
749
|
-
r.failed = true
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
func sameIdentity(a, b Subject) bool {
|
|
753
|
-
return a.Username == b.Username && a.UID == b.UID && a.GID == b.GID && sameGroups(a.Groups, b.Groups)
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
// Legacy runner API calls use a short admission lease. Revoke/disable persist
|
|
757
|
-
// their fence, then drain these calls OUTSIDE the commit lock before replying.
|
|
758
|
-
func (e *Executor) beginLegacy(d Delegation) (func(), string) {
|
|
759
|
-
e.commitMu.Lock()
|
|
760
|
-
defer e.commitMu.Unlock()
|
|
761
|
-
disabled, err := e.Store.Disabled()
|
|
762
|
-
fresh, x := e.Store.Get(d.ID)
|
|
763
|
-
if err != nil || x != nil {
|
|
764
|
-
return nil, "STORAGE_ERROR"
|
|
765
|
-
}
|
|
766
|
-
if disabled {
|
|
767
|
-
return nil, "disabled"
|
|
768
|
-
}
|
|
769
|
-
if fresh.Revoked || !e.Now().Before(fresh.Expires) {
|
|
770
|
-
return nil, "DELEGATION_DENIED"
|
|
771
|
-
}
|
|
772
|
-
if e.legacyCalls == nil {
|
|
773
|
-
e.legacyCalls = map[string][]chan struct{}{}
|
|
774
|
-
}
|
|
775
|
-
done := make(chan struct{})
|
|
776
|
-
e.legacyCalls[d.ID] = append(e.legacyCalls[d.ID], done)
|
|
777
|
-
return func() {
|
|
778
|
-
e.commitMu.Lock()
|
|
779
|
-
defer e.commitMu.Unlock()
|
|
780
|
-
close(done)
|
|
781
|
-
calls := e.legacyCalls[d.ID]
|
|
782
|
-
for i, ch := range calls {
|
|
783
|
-
if ch == done {
|
|
784
|
-
e.legacyCalls[d.ID] = append(calls[:i], calls[i+1:]...)
|
|
785
|
-
break
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
if len(e.legacyCalls[d.ID]) == 0 {
|
|
789
|
-
delete(e.legacyCalls, d.ID)
|
|
790
|
-
}
|
|
791
|
-
}, ""
|
|
792
|
-
}
|
|
793
|
-
func (e *Executor) legacyPendingLocked(id string) []chan struct{} {
|
|
794
|
-
out := []chan struct{}{}
|
|
795
|
-
for key, calls := range e.legacyCalls {
|
|
796
|
-
if id == "" || key == id {
|
|
797
|
-
out = append(out, calls...)
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
return out
|
|
801
|
-
}
|
|
802
|
-
func waitLegacy(ctx context.Context, pending []chan struct{}) error {
|
|
803
|
-
for _, done := range pending {
|
|
804
|
-
select {
|
|
805
|
-
case <-ctx.Done():
|
|
806
|
-
return ctx.Err()
|
|
807
|
-
case <-done:
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
return nil
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
func (e *Executor) invalidateMove(d Delegation) error {
|
|
814
|
-
e.commitMu.Lock()
|
|
815
|
-
defer e.commitMu.Unlock()
|
|
816
|
-
fresh, err := e.Store.Get(d.ID)
|
|
817
|
-
if err != nil {
|
|
818
|
-
return err
|
|
819
|
-
}
|
|
820
|
-
fresh.Revoked = true
|
|
821
|
-
if err = e.Store.Put(fresh); err != nil {
|
|
822
|
-
return err
|
|
823
|
-
}
|
|
824
|
-
e.cancelGrantLocked(d.ID, "validation-denied")
|
|
825
|
-
return e.auditLocked(d.Subject, "delegate.invalidate", "", d.Path, "revoked")
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
type PartCleaner interface {
|
|
829
|
-
CleanupRecorded(context.Context, Subject, partMetadata) error
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
// PartPublisher reports whether an operation's recorded part inode is already
|
|
833
|
-
// the final name, so a crash after publish intent settles without a new copy.
|
|
834
|
-
type PartPublisher interface {
|
|
835
|
-
PublishedPart(context.Context, Operation) bool
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
func (e *Executor) settleUncertain(r *operationRuntime, op Operation) {
|
|
839
|
-
checker, ok := e.Writer.(PartPublisher)
|
|
840
|
-
if !ok || op.State != "uncertain" || op.Part == nil {
|
|
841
|
-
return
|
|
842
|
-
}
|
|
843
|
-
ctx, cancel := context.WithTimeout(r.ctx, 5*time.Second)
|
|
844
|
-
published := checker.PublishedPart(ctx, op)
|
|
845
|
-
cancel()
|
|
846
|
-
if !published {
|
|
847
|
-
return
|
|
848
|
-
}
|
|
849
|
-
e.commitMu.Lock()
|
|
850
|
-
defer e.commitMu.Unlock()
|
|
851
|
-
fresh, err := e.Store.GetOperation(op.Job)
|
|
852
|
-
d, x := e.Store.Get(op.ID)
|
|
853
|
-
if err != nil || x != nil || fresh.State != "uncertain" {
|
|
854
|
-
return
|
|
855
|
-
}
|
|
856
|
-
fresh.State, fresh.Code = "committed", ""
|
|
857
|
-
fresh.Path = strings.TrimSuffix(d.Path, "/") + "/" + fresh.Name
|
|
858
|
-
fresh.Updated = e.Now().UTC()
|
|
859
|
-
if e.Store.PutOperation(fresh) != nil || e.auditLocked(fresh.Subject, "files.moveFromStaging", fresh.Job, fresh.Path, "committed") != nil {
|
|
860
|
-
r.failed = true
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
func (e *Executor) recoverParts(r *operationRuntime) {
|
|
865
|
-
cleaner, ok := e.Writer.(PartCleaner)
|
|
866
|
-
if !ok {
|
|
867
|
-
return
|
|
868
|
-
}
|
|
869
|
-
e.commitMu.Lock()
|
|
870
|
-
ops, err := e.Store.Operations()
|
|
871
|
-
e.commitMu.Unlock()
|
|
872
|
-
if err != nil {
|
|
873
|
-
e.commitMu.Lock()
|
|
874
|
-
r.failed = true
|
|
875
|
-
e.commitMu.Unlock()
|
|
876
|
-
return
|
|
877
|
-
}
|
|
878
|
-
for _, op := range ops {
|
|
879
|
-
if op.Part == nil || op.State == "queued" || op.State == "copying" {
|
|
880
|
-
continue
|
|
881
|
-
}
|
|
882
|
-
e.settleUncertain(r, op)
|
|
883
|
-
s, code := e.eligible(r.ctx, op.Subject.Username, op.Subject.UID, true)
|
|
884
|
-
cleanupErr := errors.New("cleanup ineligible")
|
|
885
|
-
if code == "" {
|
|
886
|
-
ctx, cancel := context.WithTimeout(r.ctx, 5*time.Second)
|
|
887
|
-
cleanupErr = cleaner.CleanupRecorded(ctx, s, *op.Part)
|
|
888
|
-
cancel()
|
|
889
|
-
}
|
|
890
|
-
e.commitMu.Lock()
|
|
891
|
-
fresh, x := e.Store.GetOperation(op.Job)
|
|
892
|
-
if x == nil {
|
|
893
|
-
if cleanupErr == nil {
|
|
894
|
-
fresh.Part = nil
|
|
895
|
-
} else if fresh.State == "committed" {
|
|
896
|
-
fresh.Code = "CLEANUP_PENDING"
|
|
897
|
-
}
|
|
898
|
-
if e.Store.PutOperation(fresh) != nil {
|
|
899
|
-
r.failed = true
|
|
900
|
-
}
|
|
901
|
-
} else {
|
|
902
|
-
r.failed = true
|
|
903
|
-
}
|
|
904
|
-
e.commitMu.Unlock()
|
|
905
|
-
if r.ctx.Err() != nil {
|
|
906
|
-
return
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
// Legacy and permanent writers share one package-wide, cancelable bulk slot.
|
|
912
|
-
// Waiting for a large new copy must not hold a lock or outlive a legacy request.
|
|
913
|
-
func (e *Executor) acquireCopy(ctx context.Context) (func(), error) {
|
|
914
|
-
e.commitMu.Lock()
|
|
915
|
-
if e.copySlot == nil {
|
|
916
|
-
e.copySlot = make(chan struct{}, 1)
|
|
917
|
-
}
|
|
918
|
-
slot := e.copySlot
|
|
919
|
-
e.commitMu.Unlock()
|
|
920
|
-
select {
|
|
921
|
-
case <-ctx.Done():
|
|
922
|
-
return nil, ctx.Err()
|
|
923
|
-
case slot <- struct{}{}:
|
|
924
|
-
return func() { <-slot }, nil
|
|
925
|
-
}
|
|
926
|
-
}
|