Skip to content

Security: DeepTrackAI/KiLin

Security

docs/security.md

Privacy, trust boundaries and failure limitations

Threat model and explicit non-goals

User-owned local data, local KíLín execution and optional remote services occupy separate trust zones.

Figure: A local-first application still processes untrusted evidence and may contact external services through explicitly allowed operations.

KíLín is designed for locally controlled knowledge work. Projects, indexes, source snapshots, generated outputs and conversations can be kept under the user's filesystem control and inference can use local models. These features are valuable, but they are not equivalent to a secure sandbox, authenticated multi-user service, encryption system or adversarial prompt-injection defense. This document states implemented boundaries and where users or deployers remain responsible for security.

The desktop GUI includes a basic passkey-based access check for invited prerelease users. It runs before the main desktop window opens and remembers successful activation locally. This GUI-level check is not project-file encryption; operating-system permissions and other local data protections remain important.

Boundary What KíLín does What it does not guarantee
Local source selection Applies scan exclusions, size limits, path containment checks and explicit import rules. Comprehensive secret detection; race-free protection against filesystem changes.
Project workspaces Keeps managed copies, outputs, templates and indexes organized; validates path destinations for managed operations. OS process/filesystem isolation or safe execution of arbitrary untrusted code.
Model use Supports local model cache, explicit allow_download=False and backend choices; configures trust_remote_code=False. That dependency installation or optional model downloads are offline; that model files are harmless or answers correct.
Conversations Uses advisory locks and atomic single-file replacement. Encryption, tamper resistance against an uncooperative process, cross-file transactions or secure erase.
GUI Loads local HTML/JS, disables remote-local-content access in its Qt view, and inserts answer text without evaluating arbitrary HTML. Strong isolation from all hostile local programs or malicious instructions embedded in viewed documents.
Tools Selects from registered built-ins with validated settings and scoped context. A general permission/policy sandbox or arbitrary external plugin containment.

Workspace source-access policy

Project tools may read source content only from the project's explicit source selection within its workspace. A path appearing in a document, a model response, a bibliography command or a tool argument is a reference, not permission to import or read another file. The active selected-source inventory establishes authorization; filesystem existence alone does not.

The ordinary workflow is to explicitly import outside files into the workspace through the core import APIs. This authorized import operation may read the selected originals for copying; subsequent indexing and source-reading tools operate on the managed copies, not the originals. Installed package files, separately approved model caches and other application infrastructure are distinct from project source data.

Source-reading tools must reject paths outside the workspace or saved source root, unselected filenames, traversal escapes, and symlinks that redirect reads. They must not fall back from an absent selected source to another file with the same name at the workspace root or in the original import directory. Missing or ambiguous dependencies are reported.

The reusable tools/_shared/source_access.py helper applies these checks for reference checking. In particular, .tex references to .bib and .bbl files resolve only to explicitly selected workspace sources; when the same filename exists in several selected directories, the referring .tex directory is preferred. Other tools should use the same contract for future source-reading changes. Existing profiles that point to source directories outside their workspace must import those files before this helper can read them.

These are application-level rules, not an OS-enforced sandbox or a claim of complete repository-wide filesystem isolation. Existing reads outside this tool are not exhaustively audited by this change. The helper performs best-effort validation; concurrent changes to the filesystem still require a stronger boundary for adversarial multi-user operation.

Sensitive data paths

The original sources, copied sources/ tree, sources.json provenance, source_snapshot.json manifest, indexes/ vectors and cached exact text, logs/traces/conversation_*.json, archived/deleted conversations, outputs/, templates/, user preferences and model caches can each expose private information. Embeddings are derived from sensitive text and should not automatically be treated as anonymous. Tool outputs and generated PDFs may include quotations or confidential synthesis from indexed content.

An enabled diagnostic trace is particularly sensitive. It can record full prompts, source excerpts, model output, token identifiers, errors and tracebacks; a trace export should not be represented as privacy-safe. A trace-disabled session still persists completed conversation checkpoints, which may themselves contain question, answer and evidence text. See Trace recording and Conversation ownership.

KíLín does not provide a general automatic secret scrubber, encrypted workspace format, backup retention policy or secure deletion mechanism. Access control, disk encryption, user separation, backups and permissions are deployment responsibilities. Files under ignored local sandbox/ are not automatically safe to share; Git ignores and clean ZIP exports merely reduce accidental packaging.

Original files and managed snapshots

Automatic directory scans exclude common secrets, metadata and binary model weights. The exclusion lists are not exhaustive, and explicit file selection can override some directory-scan exclusions, including certain protected-looking filenames. That capability may be necessary for legitimate research, but it makes informed user consent essential. The structured reason_code field identifies why a scanner entry was skipped; it is not an access-control token and cannot make a forbidden symlink safe.

Imported sources are copied to managed workspaces. Deleting a managed source snapshot does not delete the original. project_files.py validates that edits occur inside outputs//templates/ and rejects symlink/path traversal under its declared contract. WorkspaceResource validation prevents built-in tools from silently installing a packaged file outside safe destinations. None of these checks fully prevents concurrent local filesystem modification by another process.

New-project reservation protects existing and partially created destinations from cooperating creators; stale markers require deliberate recovery. The creation failure contract owns that procedure. It is not protection against arbitrary hostile filesystem mutation, and it does not serialize later source updates.

External access and third-party components

Running KíLín locally does not imply every action is offline:

  • kilin --gui may invoke uv sync to prepare missing optional dependencies; dependency resolution can contact package registries.
  • Model downloads and backend loaders may contact Hugging Face repositories when permitted. allow_download=False prevents model download through the supported local-only loader path, but is not a general network firewall.
  • Users may explicitly open output files with native desktop applications whose subsequent behavior is outside KíLín's control.
  • Optional tool/model dependencies or OS libraries may have their own telemetry, cache locations, permissions and vulnerabilities.

For a constrained offline workflow, preinstall known dependencies, cache verified compatible model revisions, choose allow_download=False, and launch without automatic synchronization (see GUI README). Network isolation, when required, should additionally be enforced by the host OS/environment.

Model content and prompt injection

Documents and code repositories can contain instructions addressed to an LLM. Retrieval supplies those bytes as evidence, not authoritative system policy. A model might still follow malicious instructions in an untrusted source, cite a passage incorrectly, hallucinate or produce unsafe code. Numeric citation checking establishes only that cited indices exist, not that the answer is supported or correct. Human review is still required for scientific conclusions, software changes and high-impact decisions.

Tools are explicitly registered, and ToolContext limits how models interact with KíLín operations. This is good architectural containment but not a comprehensive prompt-injection mitigation or command-execution sandbox. There is no general agentic OS-shell execution boundary documented as implemented in this repository snapshot.

Persistence, concurrency and failure

Conversation ownership specifies canonical paths, companion-file advisory locking and atomic single-file writes. These guards coordinate participating writers; they do not stop a program that ignores them, create a transaction across indexes/manifests/traces or guarantee power-loss durability. A persistent .lock file alone is not an active lease, and removing an active companion can break coordination.

Unexpected failure can leave previously completed source operations in place. GUI Stop is likewise not rollback of earlier filesystem work or a way to resume interrupted generation. The Stop protocol distinguishes cooperative cancellation from forced process replacement; the answer lifecycle distinguishes displayed partial output from a checkpointed result.

Safe deployment and review checklist

  1. Keep private workspaces and conversation traces out of public archives. Treat exported notebooks, CSVs and figures as potentially sensitive too.
  2. Restrict model downloads and dependency installation explicitly when offline or reproducibility is essential.
  3. Review source selections, especially individual files whose names would normally be excluded from automatic directory scanning.
  4. Do not use scanned/indexed source content as trusted instructions or assume successful citation checks establish factual correctness.
  5. Validate all user-supplied paths, tool settings, model IDs and packaged resources at their owning subsystem; avoid reimplementing policy in the frontend.
  6. Run tests for malicious path forms, symbolic links, concurrent writers, malformed state/trace files, failed writes and cleanup.
  7. Isolate Qt/WebEngine integration tests from test processes that construct other Qt application types. Run native tests on supported hosts.

Any plan to support hostile multi-user input, executable agents, remote services or stronger isolation requires a separate threat model and a separately approved design. Do not market workspace organization as a security guarantee.

Change impact and verification

A new external action, executable capability or writable location changes the trust boundary, even when the UI calls it a convenience. Identify the actor, input, destination and failure residue first; review the owning subsystem's validation instead of inventing parallel GUI policy. Stronger guarantees require an explicit design, not stronger wording in this reference.

Start with workspace transactions, resource containment, atomic writes, conversation ownership and safe generated outputs. These are concrete boundary regressions, not a comprehensive security audit.

Conversation-memory trust and privacy

Project conversation memory reads only active conversation records within logs/traces/ of the opened workspace; archived entries are excluded on resynchronization. Source files do not automatically become conversation memories, and memory does not grant permission to read sources outside the project. Derived records and vectors are stored in the project-owned indexes/conversation_memory.json; authoritative user feedback remains in memory/feedback.json. Both contain potentially confidential information. Completed answers with conversation-memory references also persist short excerpts of retrieved messages in their trace checkpoints; these must be kept private as well. Deleting a memory origin from the active index is not secure erasure of archived conversations, trace snapshots, backups, or previous index copies.

Retrieved memory is untrusted earlier text, not independently validated scientific evidence. It is placed in a separate prompt section, with role, turn identity, timestamp, and conversation origin. System-level instructions prevent its references from being treated as documentary citations and preserve existing project and reviewing role boundaries. This instruction boundary does not guarantee resistance to all prompt injections. Users remain responsible for validating scientific statements against current primary sources. No cross-project memory retrieval or remote memory service is implemented.

Related

Project workspaces, Source pipeline, Model management, Trace recording, Development.

There aren't any published security advisories