diff --git a/.gitea/workflows/datastack-ci.yml b/.gitea/workflows/datastack-ci.yml index e4baf14..5d43532 100644 --- a/.gitea/workflows/datastack-ci.yml +++ b/.gitea/workflows/datastack-ci.yml @@ -204,6 +204,12 @@ jobs: if ($LASTEXITCODE -ne 0) { throw 'SDK install failed' } npm --prefix sdk/node/datastack run build if ($LASTEXITCODE -ne 0) { throw 'SDK compilation failed' } + - name: FF01 native Windows File Manager CRUD and ZIP acceptance + shell: powershell + run: | + $ErrorActionPreference = 'Stop' + npx.cmd --yes tsx@4.20.6 --test tests/files-manager.test.ts + if ($LASTEXITCODE -ne 0) { throw 'FF01 Windows Files Manager regression failed' } security-audit: if: ${{ (github.event_name != 'pull_request_target' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.base.ref == 'main')) && (github.event_name != 'workflow_dispatch' || github.event.inputs.p01_only != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.python_only != 'true')) }} diff --git a/notes/002-PRODUCTION-UPDATE-ROADMAP.md b/notes/002-PRODUCTION-UPDATE-ROADMAP.md index 2f34fd6..3a89552 100644 --- a/notes/002-PRODUCTION-UPDATE-ROADMAP.md +++ b/notes/002-PRODUCTION-UPDATE-ROADMAP.md @@ -242,3 +242,15 @@ Gitea API version reported `28.4.0` during preflight. `main` branch unprotected Candidate state: no acceptance PASS or mirror sync claimed yet. Next gate: one focused Gitea workflow dispatch on this exact candidate after remote runner safety confirmation, inspect terminal seven-job result and exact four-path patch, then squash once into Gitea main with `[skip ci]` to avoid duplicate full-CI trigger, sync GitHub/GitLab and compare 420 tracked objects. If acceptance fails or remote isolation becomes uncertain, STOP without main merge. Production NO-GO: Windows File Manager PUT 404, 20 runtime Moderate dependency entries and live acceptance remain unresolved. +## FINAL-FIX-01 — consolidated Windows FM fix + residual dependency security disposition (candidate) + +WF-01 prerequisite CLOSED: Gitea PR #11 merged, Gitea CI #107 terminal 7/7 PASS; frozen Gitea main `1e2cd31aefc5cd8425e44624a96095d40c917223`, Git tree `e2957792d719eef3f61b49539ed749ac25be5cf9`; verified Gitea/GitHub/GitLab exact 420/420 objects (0 mismatch). This phase's source boundary is `server/filesManager.js` mount/router Windows root only, `tests/files-manager.test.ts`, `.gitea/workflows/datastack-ci.yml` Windows compatibility job, and these three notes. package.json/package-lock.json and all ingestion/Redis/SDK/runtime/Compose files are untouched because no separate reproduced regression or vetted compatible package remedy exists. + +Reproduction on verified dedicated Windows Actions host `WIN-IK7N6SD2UBU` (not personal PC), isolated new TEMP clone at exact baseline. `npm ci --no-audit --no-fund` exit 0, 1,278 packages. Native Windows Node 26.12.0 focused tests/files-manager.test.ts: 3/4 PASS, 1 FAIL at :154 HTTP PUT returned 404. Independent disposable request-response instrumentation captured HTTP 404 body ENOENT from mkdir attempting `C:\\C:\\client-alpha`, so this is not auth, prefix, or proxy status. Source-grounded upstream `restafary@13` `server/handle-dot-dir.js` incorrectly handles Windows drive-absolute `root` by joining it to CWD when it does not start with `/`; `redzip` downstream mkdir fails. Root cause reproduced without tracing or production data. + +Scoped workaround in `mountFilesManager`: Windows only, convert embedded Cloudcmd config root into explicit cwd-relative path on the same drive; retain securityGuard's and exported storage absolute root. For different-volume roots, fail closed at Cloudcmd initialization with existing 503 unavailable response; no guessed cross-volume bypass. `buildCloudCmdConfig`, Linux behavior, API paths, UI, auth/CSRF, lockfile and other features unchanged. Exact external disposable patch verified native Windows full File Manager suite 4/4 PASS, 0 FAIL including authenticated CRUD/rename/ZIP/UNZIP/download/delete, viewer RBAC, CSRF, lockfile, traversal and config-lock checks. Linux regression and CI candidate acceptance are not claimed yet. Add focused native Windows execution to existing Gitea Windows job; other CI jobs remain unchanged. + +Security STOP boundary: original audited runtime 20 Moderate affected packages (0 High, 0 Critical), full 22 Moderate (0 High, 0 Critical), including Cloudcmd got/glob/minimatch/nested file-type. The prior P04-S06 publisher/authenticity and older-major compatibility investigation did not establish an acceptable backport. Newly reviewed upstream Cloudcmd v19.24.1 changes only `@cloudcmd/fileop` dependency declaration vs v19.24.0, not proof of remediation for these four chains. No unverified upgrade, incompatible override, arbitrary fork, package or lockfile change; dependency remediation remains BLOCKED. Under approved stop rule, FINAL-ACCEPTANCE-02 and production readiness must NOT be claimed until an independently vetted compatible security remedy or explicit approved risk disposition exists. + +Candidate state: Windows fix reproduced and disposable PASS; Gitea full acceptance, exact security/diff review, merge and three-remote parity PENDING. No runner modification, personal-PC execution, production deployment, data mutation, migration, release, tag or destructive cleanup. + diff --git a/notes/003-PHASE-STATUS-LOG.md b/notes/003-PHASE-STATUS-LOG.md index e9943d7..4b680ef 100644 --- a/notes/003-PHASE-STATUS-LOG.md +++ b/notes/003-PHASE-STATUS-LOG.md @@ -264,3 +264,15 @@ Gitea API version reported `28.4.0` during preflight. `main` branch unprotected Candidate state: no acceptance PASS or mirror sync claimed yet. Next gate: one focused Gitea workflow dispatch on this exact candidate after remote runner safety confirmation, inspect terminal seven-job result and exact four-path patch, then squash once into Gitea main with `[skip ci]` to avoid duplicate full-CI trigger, sync GitHub/GitLab and compare 420 tracked objects. If acceptance fails or remote isolation becomes uncertain, STOP without main merge. Production NO-GO: Windows File Manager PUT 404, 20 runtime Moderate dependency entries and live acceptance remain unresolved. +## FINAL-FIX-01 — consolidated Windows FM fix + residual dependency security disposition (candidate) + +WF-01 prerequisite CLOSED: Gitea PR #11 merged, Gitea CI #107 terminal 7/7 PASS; frozen Gitea main `1e2cd31aefc5cd8425e44624a96095d40c917223`, Git tree `e2957792d719eef3f61b49539ed749ac25be5cf9`; verified Gitea/GitHub/GitLab exact 420/420 objects (0 mismatch). This phase's source boundary is `server/filesManager.js` mount/router Windows root only, `tests/files-manager.test.ts`, `.gitea/workflows/datastack-ci.yml` Windows compatibility job, and these three notes. package.json/package-lock.json and all ingestion/Redis/SDK/runtime/Compose files are untouched because no separate reproduced regression or vetted compatible package remedy exists. + +Reproduction on verified dedicated Windows Actions host `WIN-IK7N6SD2UBU` (not personal PC), isolated new TEMP clone at exact baseline. `npm ci --no-audit --no-fund` exit 0, 1,278 packages. Native Windows Node 26.12.0 focused tests/files-manager.test.ts: 3/4 PASS, 1 FAIL at :154 HTTP PUT returned 404. Independent disposable request-response instrumentation captured HTTP 404 body ENOENT from mkdir attempting `C:\\C:\\client-alpha`, so this is not auth, prefix, or proxy status. Source-grounded upstream `restafary@13` `server/handle-dot-dir.js` incorrectly handles Windows drive-absolute `root` by joining it to CWD when it does not start with `/`; `redzip` downstream mkdir fails. Root cause reproduced without tracing or production data. + +Scoped workaround in `mountFilesManager`: Windows only, convert embedded Cloudcmd config root into explicit cwd-relative path on the same drive; retain securityGuard's and exported storage absolute root. For different-volume roots, fail closed at Cloudcmd initialization with existing 503 unavailable response; no guessed cross-volume bypass. `buildCloudCmdConfig`, Linux behavior, API paths, UI, auth/CSRF, lockfile and other features unchanged. Exact external disposable patch verified native Windows full File Manager suite 4/4 PASS, 0 FAIL including authenticated CRUD/rename/ZIP/UNZIP/download/delete, viewer RBAC, CSRF, lockfile, traversal and config-lock checks. Linux regression and CI candidate acceptance are not claimed yet. Add focused native Windows execution to existing Gitea Windows job; other CI jobs remain unchanged. + +Security STOP boundary: original audited runtime 20 Moderate affected packages (0 High, 0 Critical), full 22 Moderate (0 High, 0 Critical), including Cloudcmd got/glob/minimatch/nested file-type. The prior P04-S06 publisher/authenticity and older-major compatibility investigation did not establish an acceptable backport. Newly reviewed upstream Cloudcmd v19.24.1 changes only `@cloudcmd/fileop` dependency declaration vs v19.24.0, not proof of remediation for these four chains. No unverified upgrade, incompatible override, arbitrary fork, package or lockfile change; dependency remediation remains BLOCKED. Under approved stop rule, FINAL-ACCEPTANCE-02 and production readiness must NOT be claimed until an independently vetted compatible security remedy or explicit approved risk disposition exists. + +Candidate state: Windows fix reproduced and disposable PASS; Gitea full acceptance, exact security/diff review, merge and three-remote parity PENDING. No runner modification, personal-PC execution, production deployment, data mutation, migration, release, tag or destructive cleanup. + diff --git a/notes/006-BASELINE-AND-PATCH-EVIDENCE.md b/notes/006-BASELINE-AND-PATCH-EVIDENCE.md index e8fb7e2..0fa9c59 100644 --- a/notes/006-BASELINE-AND-PATCH-EVIDENCE.md +++ b/notes/006-BASELINE-AND-PATCH-EVIDENCE.md @@ -415,3 +415,15 @@ Gitea API version reported `28.4.0` during preflight. `main` branch unprotected Candidate state: no acceptance PASS or mirror sync claimed yet. Next gate: one focused Gitea workflow dispatch on this exact candidate after remote runner safety confirmation, inspect terminal seven-job result and exact four-path patch, then squash once into Gitea main with `[skip ci]` to avoid duplicate full-CI trigger, sync GitHub/GitLab and compare 420 tracked objects. If acceptance fails or remote isolation becomes uncertain, STOP without main merge. Production NO-GO: Windows File Manager PUT 404, 20 runtime Moderate dependency entries and live acceptance remain unresolved. +## FINAL-FIX-01 — consolidated Windows FM fix + residual dependency security disposition (candidate) + +WF-01 prerequisite CLOSED: Gitea PR #11 merged, Gitea CI #107 terminal 7/7 PASS; frozen Gitea main `1e2cd31aefc5cd8425e44624a96095d40c917223`, Git tree `e2957792d719eef3f61b49539ed749ac25be5cf9`; verified Gitea/GitHub/GitLab exact 420/420 objects (0 mismatch). This phase's source boundary is `server/filesManager.js` mount/router Windows root only, `tests/files-manager.test.ts`, `.gitea/workflows/datastack-ci.yml` Windows compatibility job, and these three notes. package.json/package-lock.json and all ingestion/Redis/SDK/runtime/Compose files are untouched because no separate reproduced regression or vetted compatible package remedy exists. + +Reproduction on verified dedicated Windows Actions host `WIN-IK7N6SD2UBU` (not personal PC), isolated new TEMP clone at exact baseline. `npm ci --no-audit --no-fund` exit 0, 1,278 packages. Native Windows Node 26.12.0 focused tests/files-manager.test.ts: 3/4 PASS, 1 FAIL at :154 HTTP PUT returned 404. Independent disposable request-response instrumentation captured HTTP 404 body ENOENT from mkdir attempting `C:\\C:\\client-alpha`, so this is not auth, prefix, or proxy status. Source-grounded upstream `restafary@13` `server/handle-dot-dir.js` incorrectly handles Windows drive-absolute `root` by joining it to CWD when it does not start with `/`; `redzip` downstream mkdir fails. Root cause reproduced without tracing or production data. + +Scoped workaround in `mountFilesManager`: Windows only, convert embedded Cloudcmd config root into explicit cwd-relative path on the same drive; retain securityGuard's and exported storage absolute root. For different-volume roots, fail closed at Cloudcmd initialization with existing 503 unavailable response; no guessed cross-volume bypass. `buildCloudCmdConfig`, Linux behavior, API paths, UI, auth/CSRF, lockfile and other features unchanged. Exact external disposable patch verified native Windows full File Manager suite 4/4 PASS, 0 FAIL including authenticated CRUD/rename/ZIP/UNZIP/download/delete, viewer RBAC, CSRF, lockfile, traversal and config-lock checks. Linux regression and CI candidate acceptance are not claimed yet. Add focused native Windows execution to existing Gitea Windows job; other CI jobs remain unchanged. + +Security STOP boundary: original audited runtime 20 Moderate affected packages (0 High, 0 Critical), full 22 Moderate (0 High, 0 Critical), including Cloudcmd got/glob/minimatch/nested file-type. The prior P04-S06 publisher/authenticity and older-major compatibility investigation did not establish an acceptable backport. Newly reviewed upstream Cloudcmd v19.24.1 changes only `@cloudcmd/fileop` dependency declaration vs v19.24.0, not proof of remediation for these four chains. No unverified upgrade, incompatible override, arbitrary fork, package or lockfile change; dependency remediation remains BLOCKED. Under approved stop rule, FINAL-ACCEPTANCE-02 and production readiness must NOT be claimed until an independently vetted compatible security remedy or explicit approved risk disposition exists. + +Candidate state: Windows fix reproduced and disposable PASS; Gitea full acceptance, exact security/diff review, merge and three-remote parity PENDING. No runner modification, personal-PC execution, production deployment, data mutation, migration, release, tag or destructive cleanup. + diff --git a/server/filesManager.js b/server/filesManager.js index 0e0ed2e..3c1c69c 100644 --- a/server/filesManager.js +++ b/server/filesManager.js @@ -1011,6 +1011,16 @@ async function mountFilesManager({ let initErrorMessage = ''; try { + // restafary treats drive-qualified Windows storage roots as cwd-relative. + // Only Cloudcmd needs a portable root; keep the guard and exported root absolute. + if (process.platform === 'win32') { + const relativeRoot = path.relative(process.cwd(), resolvedRoot); + if (path.isAbsolute(relativeRoot)) { + throw new Error('Windows Cloudcmd storage root must be on the server drive.'); + } + configOptions.root = relativeRoot ? `./${relativeRoot.replaceAll('\\', '/')}` : '.'; + } + const cloudcmdPkg = await import('cloudcmd'); const cloudcmdFn = cloudcmdPkg.cloudcmd || cloudcmdPkg.default; const createConfigManager = diff --git a/tests/files-manager.test.ts b/tests/files-manager.test.ts index b5861f4..592ed2f 100644 --- a/tests/files-manager.test.ts +++ b/tests/files-manager.test.ts @@ -86,6 +86,8 @@ test('FM-REQ-01..06: live CloudCmd mount enforces auth, DB revocation, RBAC, CSR try { assert.equal(handle.engineReady, true, `CloudCmd failed to init: ${handle.initErrorMessage}`); assert.equal(handle.socketPath, '/vcon/files-engine/socket.io'); + // Cloudcmd's Windows-specific representation must still resolve to the jailed root. + assert.equal(path.resolve(handle.configOptions.root), tmpRoot); await new Promise((resolve) => server.listen(0, '127.0.0.1', () => resolve())); const address = server.address() as { port: number }; @@ -151,7 +153,9 @@ test('FM-REQ-01..06: live CloudCmd mount enforces auth, DB revocation, RBAC, CSR headers: ownerHeaders, body: 'k,v\n1,ok\n', }); - assert.equal(createRes.status, 200); + if (createRes.status !== 200) { + assert.fail(`Cloudcmd PUT failed with ${createRes.status}: ${(await createRes.text()).slice(0, 240)}`); + } assert.equal(fs.readFileSync(path.join(tmpRoot, 'client-alpha', 'note.csv'), 'utf8'), 'k,v\n1,ok\n'); const renameRes = await fetch(`${baseUrl}/vcon/files-engine/api/v1/rename`, {