Repository navigation
security: close the 0.7.1 advisory batch (14 fixes) - #727
Merged
Merged
Conversation
The node-id write path (GHSA-ph8r) resolved the finding and wrote its report/verification with no task check, so any agent holding the tool could overwrite another task's finding. Refuse unless the caller's task owns the finding; inherited findings stay read-only and an unknown caller fails closed. Triggered chat runs carry their source task(s) as a server-owned context value (RunInfo is empty for ChatAgent turns), never from tool arguments.
The hook sees ExecuteExtraTool for every deferred custom tool and every MCP tool, so a deny/ask rule keyed on the real tool name never matched. Unwrap the wrapper input (the same unwrap the target gate already uses) and evaluate IsToolEnabled, MatchPersistence and Match on the inner name and input, keeping the stricter of the wrapper and inner decisions.
The panel's test endpoint dispatched the rendered command, script or URL without evaluating the intercept rules or writing the audit, so a call a worker would be blocked from running could be run from the panel. Evaluate the built-in deny rules and the rule set on the rendered text before the dispatch, refuse on deny/ask, and record the decision as the agent path does. The admin-only route and its sandbox behaviour are unchanged.
Agent/auto scope rows are coverage-only (approved_by_operator=false): sandbox egress already filtered them, but the scoped asset reads (scopeTargetCTE behind QueryDSLInScope/GetByIDsInScope), the task's company list, and the lesson read scope still honoured them, so an agent could widen what it reads by calling add_task_scope (GHSA-53wc). Require approved_by_operator=true on those read paths. The coverage ledger keeps counting every scope row unchanged: only authorization reads are filtered, not the coverage denominator.
The recursive-force-delete rules required the recursive and the force flag in one token, so rm -r -f /, rm -R -f / and rm -f -r / passed while the combined rm -rf / was denied. The v1 and v2 seed patterns now read the short flags combined or separate, and a v4 seed rewrites the rows an upgraded install already has (leaving operator-edited patterns alone).
install.sh wrote config.json, which carries the database password, under the ambient umask and never chmodded it. Write it 0600. PrepareExecPrivilege returned before its 0600 tightening whenever the executor drop was disabled, so a non-root local start never restricted the file either. Tighten it on every start and only force root ownership when the drop is enabled (which implies a root server).
…part 3) runScriptTool only ran the stateful check: unlike the command tool it never called GateRenderedCommand, and the hook reads the call's parameters, not the script's stored code. A gated task could therefore run a script that reaches any destination. Run the same destination gate on the script text before the interpreter starts and refuse when its targets are not approved.
Block rules compared raw strings: exact_ip was a literal compare, exact domain was case-folded only, and fuzzy_ip was case-sensitive. Targets are canonical, so a rule written as 0:0:0:0:0:0:0:1, with a trailing dot or in upper case never matched and the block silently failed open (GHSA-3vq4 / GHSA-v6j2). Canonicalize both sides in matchOne (netip Unmap/zone-strip for IPs; lower-case, one trailing dot removed, IDNA for domains; lower-case fuzzy_ip) and canonicalize or reject the same variants at save time.
GHSA-39w9: POST /api/llm/test accepted any base_url and proxy, made a real request with them, returned the reply and the provider error text, and followed redirects without an address check, while POST /api/llm/models was already guarded. The test now validates the base URL and the proxy through the same guard, dials and revalidates every redirect through it, and never reads the *_PROXY environment. Only public addresses are accepted. The code-owned default Ollama endpoint keeps working; an exact host:port in ARTEX_LLM_PRIVATE_ENDPOINTS is the documented way to test a local model server. The test button refuses SOCKS5 proxies because the guard cannot see the destination behind them.
GHSA-589f: FingerprintTarget checked the target before the request but built its client on http.DefaultTransport, so the environment proxy and a fresh DNS resolution could reach loopback, private or instance-metadata addresses after the check. The client now uses its own transport, never the *_PROXY environment, and dials through the gate's pinned dialer, which resolves again and refuses an address the pin does not cover. The probe requests reuse the same transport.
GHSA-663x: ValidateExemptionHost and IsNonPublicAddr accepted 0.0.0.0/8 as public, so 0.0.0.1 could be exempted from the target gate or used as a model endpoint. The range is rejected now, and the model reserved-prefix test covers it.
…ction GHSA-q37j: with capture enabled, go-mitmproxy dials one upstream per client connection and reuses it for later plain-HTTP requests, so a request for host B, with B's Cookie and Authorization headers, was delivered to host A. The sink now sets UseSeparateClient when the request names another host:port than the connection's upstream, so each host gets its own connection. Intercepted TLS tunnels are unchanged.
…capes Fixes GHSA-r7q2 and GHSA-7h5v: chatUpload previously joined base/uploads and ran os.MkdirAll + saveUpload outside an os.Root handle, allowing an exec process that owns the workspace to replace uploads/ with a symlink and make the root panel process write files outside s.m.dir. Anchor every chat upload under os.OpenRoot(s.m.dir), verify each directory component via root.Mkdir + root.Lstat (rejecting symlinks), choose free names via root.Lstat, and write via root.OpenFile(..., O_WRONLY|O_CREATE| O_EXCL, 0644).
…space API Fixes GHSA-fqvh: stageTaskArchiveFiles, applyMoves, rollbackFiles, and recoverTaskArchiveStages trusted paths unmarshalled from .staging/<id>/journal.json, and workspaceDeniedPrefixes only blocked traffic/_* so the workspace API could write to archives/. Validate staging and restore journals before any MkdirAll or Rename (matching ArchiveID/TaskID, clean relative paths under files/ with no absolutes or "..", and exact server-derived Source paths under dataDir) and add "archives" to workspaceDeniedPrefixes.
Eliminate the TOCTOU check-then-use window between wsResolveConfined and filesystem writes in wsWrite, wsMkdir and wsUpload (GHSA-3p3q). After wsResolveConfined canonicalizes the path within s.m.dir, open the workspace root via os.OpenRoot(cp.realRoot) and perform all directory creation, symlink verification and file writes using root-relative paths and root.OpenFile instead of host-path os.MkdirAll, os.WriteFile and saveUpload. Walking components with root.Lstat also blocks post-resolution symlink swaps targeting denied platform subtrees such as traffic/_ca or archives.
Adds one entry per advisory fixed by this batch, moves the 0.7.1 date to 2026-12-01, credits the reporters, and documents that the model list and the connection test reach only public addresses unless the exact host:port is in ARTEX_LLM_PRIVATE_ENDPOINTS.
esp0xdeadbeef
pushed a commit
to esp0xdeadbeef/ARTEX
that referenced
this pull request
Nov 30, 2026
upstream: Merge pull request BaaRai#727 from BaaRai/sec/advisory-batch-071 overlay: sync-upstream: re-sync once instead of failing on a rejected push files: flake.nix flake.lock nix .github/workflows/update-flake-lock.yml .github/workflows/sync-upstream.yml scripts/sync-upstream.sh
esp0xdeadbeef
pushed a commit
to esp0xdeadbeef/ARTEX
that referenced
this pull request
Nov 30, 2026
upstream: Merge pull request BaaRai#727 from BaaRai/sec/advisory-batch-071 overlay: sync-upstream: parent the result on main, not on upstream files: flake.nix flake.lock nix .github/workflows/update-flake-lock.yml .github/workflows/sync-upstream.yml scripts/sync-upstream.sh
github-actions Bot
pushed a commit
to esp0xdeadbeef/ARTEX
that referenced
this pull request
Nov 30, 2026
upstream: Merge pull request BaaRai#727 from BaaRai/sec/advisory-batch-071 overlay: nix overlay: record the upstream commit the loop was proven against files: flake.nix flake.lock nix .github/workflows/update-flake-lock.yml .github/workflows/sync-upstream.yml scripts/sync-upstream.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the 14 open advisories that are fixable now, on top of the sandbox, the scope-ownership change and the CORS proof checks already on main. Each fix has a test that fails without it. Credit to the reporters is in the changelog.
Triage of the 26 advisories in triage: 7 fixed before this batch (GHSA-67c6, GHSA-prm8, GHSA-86r5, GHSA-fcx3, GHSA-3gwj, GHSA-3558, GHSA-3rm5), 14 fixed here, 3 duplicates, 2 invalid. Two remain: GHSA-4rcx is an intended admin capability (its reported PoC is closed by the sandbox), and GHSA-fgq3 is a 41-byte "test".
What this batch fixes
os.OpenRooton the data dir, every componentLstat-verified,O_CREATE|O_EXCL; a symlinkeduploads/is refusedfiles/relatives, server-derived sources) beforeMkdirAll/Rename;archivesdenied in the workspace APIwsWrite/wsMkdir/wsUploadgo throughos.OpenRoot, closing the resolve-then-write race/api/llm/testvalidates base URL and proxy, re-checks every dial and redirect, ignores*_PROXY;ARTEX_LLM_PRIVATE_ENDPOINTSfor local servers0.0.0.0/8is non-public in the exemption and model guardsupdate_finding_reportis scoped to the caller's task; inherited findings read-only; no task context fails closedExecuteExtraToolis unwrapped and rules/persistence are evaluated on the inner tool, stricter decision winsrunScriptToolpasses the target gate before the interpreter startsconfig.jsonis 0600 from the installer and from the start path even without the exec droprmrules match-r -f,-R -f,-f -r; a v4 seed rewrites the old pattern without touching operator editsapproved_by_operator; the coverage ledger still counts every rowVerification
go build ./...,go vet ./...: PASS on the merged tree.go test -count=1 ./db ./server ./agent ./guard ./intercept ./trafficon disposable PostgreSQL 16: db 94.9s, server 141.5s, agent 42.8s, guard 4.3s, intercept 12.4s, traffic 59.8s, all PASS.TestChatUploadRejectsSymlinkedUploadsDir,TestTaskArchiveStageJournalRejectsHostilePaths,TestWorkspaceWritePathTOCTOUSymlinkSwap,TestLLMTestRefusesNonPublicTargetsBeforeDial,TestFingerprintRefusesReboundTargetAtDial,TestThisNetworkIsNonPublic,TestPlainHTTPKeepAliveDoesNotCrossHosts,TestUpdateFindingReportScopedToOwningTask,TestAgentScopeDoesNotGrantReadsUntilOperatorApproved,TestPrepareExecPrivilegeTightensConfigFileWithoutExecDrop,TestMatchAssetInterceptRulescanonical cases,TestExecuteExtraToolDenyAppliesToInnerTool,TestCustomToolTestEndpointAppliesRules,TestRecursiveForceDeleteSeparateFlags,TestCustomScriptRenderedTargetGated.Behavior changes to know
host:portinARTEX_LLM_PRIVATE_ENDPOINTSto use the Test button, and SOCKS5 proxies are refused there.update_finding_report; task-triggered and merged runs are scoped.task_scoperows no longer grant asset/company/lesson reads; operators approve scope once (migration 0023 already backfills manual rows).Known limits
wsRead,wsDownload,wsList,wsDelete) still resolve before use; only the write paths were in scope.Renamehost paths after validation; moving them ontoos.Rootis a follow-up.Ships in 0.7.1. The advisory metadata update and publication comes after the tag.