mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-28 19:27:41 +00:00
392bc15d91
* feat(git): swap isomorphic-git for native git transport behind clone seam Replace the isomorphic-git engine (HTTP-only, single importer) with the native git CLI behind the existing withClonedRepo seam, so SSH deploy keys, ref semantics, and private CAs become reachable in later PRs. - resolve-before-fetch: ls-remote pins the branch to an immutable SHA, then rev-parse verifies the checkout against it; tip races refuse - hardened spawns: argv arrays only, protocol allowlist (https only), neutralized hooks, isolated HOME and all config channels, no prompts - token reaches git only via a credential helper reading SENCHO_GIT_TOKEN from the child env; never argv or URL - size cap becomes a workspace watchdog (on-disk measure) keeping the same knob and breach message; deterministic final gate added - Windows: pin http.sslBackend=openssl (schannel ignores sslCAInfo) and anchor to Git's bundled CA; NODE_EXTRA_CA_CERTS combines with platform defaults instead of replacing them - error classification retargets to exit code + stderr while preserving the contractual mappings (AUTH_FAILED maps to 400, never 401; unauthenticated refusals mask as REPO_NOT_FOUND) - runtime image installs git; tests re-pointed at the transport boundary plus a new engine suite (classifier corpus, argv hardening, watchdog) Zero externally visible behavior change except two edge cases: an empty branch now surfaces BRANCH_NOT_FOUND, and a mid-fetch force push refuses instead of materializing the moved tip. * fix(git): unblock CI on linux kill-path test and codeql log warning Two CI-only findings from the first pipeline run: - The scripted spawn child in the transport tests lacked the kill method that killTree's POSIX fallback reaches when a fake process group does not exist; Linux runs crashed inside the timeout tests while Windows (taskkill branch) could not reproduce it. Give the fixture the method the real ChildProcess always has. - CodeQL flagged the workspace-removal warning that interpolated the NODE_EXTRA_CA_CERTS path (environment-sourced values are treated as sensitive at log sinks). Reword the warning to name the variable instead of its value; operators know their own environment. * fix(git): collapse remaining duplicated test setup so the shared helper is used * fix(git): close watchdog, size-gate, ref-validator, and kill-ordering gaps in native transport Resolves the release-blocking findings from an independent pre-merge audit of the native git transport swap: - A watchdog-triggered kill mid-clone was misclassified as a generic exit failure instead of a size breach, because runGit resolves (not rejects) when the child is killed via SIGKILL. - The final on-disk size measurement failed open when it could not be read (workspace removed mid-walk, permissions), letting an unmeasured clone through as a success. Now fails closed and logs the real cause. - The ref-name validator was an overly restrictive allow-list that rejected valid branch names (leading underscore, non-ASCII, '#'). Replaced with a deny-list matching real `git check-ref-format --branch` semantics, verified against the git binary, including a per-path-segment `.lock` check the first pass missed. - runGit's timeout handler settled as soon as a kill was issued rather than confirmed, racing workspace cleanup against a still-alive child tree. It now waits for the child's close event, with a bounded fallback if termination is never confirmed, and preserves the timeout classification if 'error' fires after the kill. - Windows killTree now also falls back to child.kill() when taskkill itself exits non-zero, not just when it fails to spawn. - Added a real, non-mocked integration test that drives the credential helper through the actual git binary against a local HTTPS server with Basic Auth checking. It caught a genuine bug the mocked suite could not see: the credential.helper config value was quoted in a way that broke git's own absolute-path helper detection, failing every authenticated clone. Fixed by removing the quotes. - Migrated a separately developed test file's mocks off the deleted isomorphic-git module onto the native transport seam, matching the pattern already used elsewhere, after merging with main pulled in that feature. Also updates two stale comments left over from the isomorphic-git era and adds a git version check to the Docker runtime image smoke tests. * fix(git): make credential-helper path safe, unify ref length, and fix Windows kill ordering Addresses three PR 1 correction items from pre-merge audit: - credential.helper is a shell string, not argv: interpolating the helper's workspace-relative path broke authenticated fetches whenever the workspace sat under a directory with a space in its name. The config value is now a fixed string that names an environment variable instead, so no workspace path character can affect how git's shell parses it. - The transport rejected branch names over 200 characters while the route accepted up to 256 and real git has no comparable limit. REF_MAX_LEN is now a single exported constant shared by the transport and both routes. - On Windows, taskkill runs as a separate process and could still be walking a killed process tree after the direct git child reported closed, letting the caller delete the workspace early. Kill operations are now awaited to completion (bounded by a timeout) before a timed-out or size-breached run settles, on both the close and error event paths. Verified against a real authenticated git server inside the built runtime image: public HTTPS, private HTTPS with a valid PAT, invalid PAT, a deleted branch, an oversized repository, and the awkward workspace-path case, including from a workspace path containing spaces and shell metacharacters. * fix(git): reap killed helpers and classify curl refusals
97 lines
2.9 KiB
JSON
97 lines
2.9 KiB
JSON
{
|
|
"name": "backend",
|
|
"version": "1.0.0",
|
|
"description": "",
|
|
"main": "index.js",
|
|
"scripts": {
|
|
"postinstall": "test -f scripts/generate-version.js && node scripts/generate-version.js || true",
|
|
"prebuild": "node scripts/generate-version.js",
|
|
"build": "tsc",
|
|
"start": "node dist/index.js",
|
|
"predev": "node scripts/generate-version.js",
|
|
"dev": "nodemon --watch src --ext ts,json --exec ts-node src/index.ts",
|
|
"test:docker-integration": "vitest run --config vitest.docker-integration.config.ts",
|
|
"test": "vitest run",
|
|
"lint": "eslint src",
|
|
"reset-mfa": "node dist/cli/resetMfa.js",
|
|
"reset-password": "node dist/cli/resetPassword.js",
|
|
"create-emergency-admin": "node dist/cli/createEmergencyAdmin.js",
|
|
"clear-sessions": "node dist/cli/clearSessions.js",
|
|
"disable-sso": "node dist/cli/disableSso.js",
|
|
"enable-local-login": "node dist/cli/enableLocalLogin.js",
|
|
"diagnostics": "node dist/cli/diagnostics.js",
|
|
"validate-db": "node dist/cli/validateDb.js",
|
|
"backup-data": "node dist/cli/backupData.js"
|
|
},
|
|
"keywords": [],
|
|
"author": "",
|
|
"license": "AGPL-3.0-only",
|
|
"type": "commonjs",
|
|
"engines": {
|
|
"node": ">=26.0.0"
|
|
},
|
|
"overrides": {
|
|
"brace-expansion": "^5.0.8",
|
|
"postcss": "^8.5.23"
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "^10.0.1",
|
|
"@types/bcrypt": "^6.0.0",
|
|
"@types/better-sqlite3": "^9.6.0",
|
|
"@types/compression": "^1.8.1",
|
|
"@types/cookie-parser": "^1.4.10",
|
|
"@types/cors": "^2.8.19",
|
|
"@types/dockerode": "^4.0.1",
|
|
"@types/express": "^5.0.6",
|
|
"@types/http-proxy": "^1.17.17",
|
|
"@types/http-proxy-middleware": "^1.0.0",
|
|
"@types/jsonwebtoken": "^9.0.10",
|
|
"@types/multer": "^2.1.0",
|
|
"@types/node": "^26.0.0",
|
|
"@types/semver": "^7.7.1",
|
|
"@types/supertest": "^7.2.0",
|
|
"@types/tar-stream": "^3.1.4",
|
|
"@types/ws": "^8.18.1",
|
|
"@types/yaml": "^1.9.6",
|
|
"eslint": "^10.1.0",
|
|
"nodemon": "^3.1.13",
|
|
"supertest": "^7.2.2",
|
|
"ts-node": "^10.9.2",
|
|
"typescript": "^6.0.2",
|
|
"typescript-eslint": "^8.0.0",
|
|
"vitest": "^4.1.0"
|
|
},
|
|
"optionalDependencies": {
|
|
"@aws-sdk/client-ecr": "^3.1019.0",
|
|
"@aws-sdk/client-s3": "^3.1037.0"
|
|
},
|
|
"dependencies": {
|
|
"axios": "^1.15.0",
|
|
"bcrypt": "^6.0.0",
|
|
"better-sqlite3": "^13.0.1",
|
|
"composerize": "^1.7.5",
|
|
"compression": "^1.8.1",
|
|
"cookie-parser": "^1.4.7",
|
|
"cors": "^2.8.6",
|
|
"cron-parser": "^5.5.0",
|
|
"dockerode": "^5.0.0",
|
|
"express": "^5.2.1",
|
|
"express-rate-limit": "^8.3.1",
|
|
"helmet": "^8.1.0",
|
|
"http-proxy": "^1.18.1",
|
|
"http-proxy-middleware": "^4.0.0",
|
|
"jsonwebtoken": "^9.0.3",
|
|
"ldapts": "^9.0.0",
|
|
"multer": "^2.1.1",
|
|
"node-pty": "^1.1.0",
|
|
"openid-client": "^6.8.2",
|
|
"otplib": "^13.4.0",
|
|
"semver": "^7.7.4",
|
|
"systeminformation": "^5.31.1",
|
|
"tar-stream": "^3.1.8",
|
|
"ws": "^8.19.0",
|
|
"yaml": "^2.8.2",
|
|
"zod": "^4.3.6"
|
|
}
|
|
}
|