CLI review fixes: wiki-lint path traversal, launcher leak, search/agent-config parity#415
Merged
Merged
Conversation
lint_wiki_page joined the user-supplied wiki_source onto wiki_root with no containment check, so 'wiki lint ../../../../etc/passwd' read an arbitrary file and echoed its lines back as unmarked-claim issues. Validate the resolved path within wiki_root before reading, mirroring browse.find_page and the drafts path.
…, agent-config remote model - run_launcher wraps prepare()/warm under the spawned-server finally so a raise (e.g. declining opencode setup) no longer leaks the lilbee serve process. - CLI search applies the cfg.max_distance relevance cutoff that REST and MCP use, and renders a legitimate 0.0 score instead of dropping it via a truthy or-chain. - model list --task gets the same JSON error envelope + friendly message as --source, no longer leaking the internal ModelTask enum name. - agent-config includes a remote-configured chat model (matching launch and /v1/models) instead of only native registry refs.
A partial copy left a half-written skill dir that exists() then skipped forever, so opencode ran with an empty skill and no recovery. Build in a temp dir and os.replace into place, cleaning up staging on failure.
… import - memory remove exits non-zero on not-found, matching model remove / remove. - wiki status uses theme.SUCCESS/theme.ERROR instead of literal green/red. - model.py imports sys at module top instead of lazily.
…robe dedup + log handle - search/ask reject empty/whitespace queries via a shared helper (matching REST); search caps --top-k at 100 like the REST route. - json-mode add suppresses eager worker start like the interactive path. - spawn_server closes its log file handle after Popen dups the fd; the three /api/health probes share one _probe_health helper and a _HEALTH_PATH constant.
…nup, warm budget, opencode pins - SyncStatus.pending mutated via an atomic adjust_pending under a lock (was a non-atomic cross-thread counter despite the thread-safe docstring). - auto_sync reuses _format_sync_summary instead of rebuilding the summary string. - self-check cleans up its downloaded GGUF and per-leg work dirs (temp leak); download dir is also removed on failure. Extracted a shared _self_check_leg. - render_warm reports not-ready (not None) after a mid-stream drop so the caller doesn't double-spend the warm budget. - agent-config opencode pins default_ref + chat_ctx like launch opencode.
… + launcher leak test
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.
Problem
Review of the CLI command layer found a security blocking bug plus several entry-point parity gaps:
lilbee wiki lint <wiki_source>joined the user-supplied source onto the wiki root with no containment check, so a traversal source (../../../../etc/passwd) read an arbitrary file and echoed its lines back as "unmarked claim" issues.run_launcherranprepare()and the warm wait outside the cleanupfinally, leaking the spawnedlilbee serveprocess when prepare raised (e.g. declining opencode setup).searchskipped thecfg.max_distancerelevance cutoff that REST and MCP both apply, returning lower-relevance chunks than the API for the same query.model list --taskvalidated differently from--source: it leaked the internalModelTaskenum name and, in--jsonmode, emitted Typer usage text instead of the JSON error envelope.agent-configemitted a config omitting a remote-configured chat model thatlaunch opencodeand/v1/modelsboth include.Solution
browse.find_pageand the drafts path).finallyso the serve process is always stopped.max_distancefilter in CLI search; select the display score with explicit None checks so a real 0.0 survives._parse_task_or_bad_parammirroring the source parser (JSON envelope + friendly message).agent-config.os.replace, cleaning up staging on failure.Tested: the traversal is rejected without disclosure, the launcher cleanup, the max_distance filter, the
--taskenvelope, and the atomic skill install.