Read 2026-10-23
khoj-ai/khoj: technical due diligence, read from its repository
What Borehole read in khoj-ai/khoj's code and history at ae229ca: its licence, security advisories, releases, review practice, tests, dependencies and operations. Every finding cites the file and line it rests on. The full report also covers the team and asks the questions the code cannot answer.
| Dimension | Rating |
|---|---|
| Architecture & Codebase — including AI provenance | strong |
| Engineering Process & SDLC Maturity | adequate |
| Product & Engineering Maturity | adequate |
| Security & Reliability Posture | adequate |
| Observability & Operations | adequate |
| Fit with the Acquirer | not assessable |
What the repository says
- Releases are cut from another branch than the one surveyed
LICENSE: Relicensed: GPL-3.0 → AGPL-3.0 (2023-11-16)
Architecture & Codebase — including AI provenance
strongsrc/khoj/routers/helpers.py is 3,459 lines, 64× this codebase's median file
adequateThe median source file here is 54 lines. 15 files exceed 1,000 lines, the largest being 3,459. Size is not a defect on its own — some problems genuinely live in one place — but these are where merge conflicts, review fatigue and single-owner knowledge concentrate, and they are the first thing that slows an inheriting engineer down.
src/khoj/routers/helpers.py:1 — 3,459 lines (64× median) |
src/interface/obsidian/src/chat_view.ts:1 — 2,573 lines (47× median) |
src/khoj/database/adapters/__init__.py:1 — 2,381 lines (44× median) |
src/khoj/routers/api_chat.py:1 — 1,762 lines (32× median) |
src/interface/web/app/settings/page.tsx:1 — 1,466 lines (27× median) |
Engineering Process & SDLC Maturity
adequateTests cover a thin slice of the codebase
adequate30 test files against 371 source files (8.1%). This does not measure whether the tests are good, only whether enough of them exist for the codebase to be changed safely by someone who did not write it — which is exactly the situation after an acquisition.
| 30 test files / 371 source files |
Product & Engineering Maturity
adequate5% of bug fixes add or change a test
adequateOf 255 fixes in the last 24 months, 12 touched a test. A fix without the test that would have caught the bug can quietly come back, and the suite never learns from what went wrong.
| 12 of 255 |
Releases are cut from another branch than the one surveyed
adequateThe newest release, 1.42.10, is not on the branch this survey read; the newest release on it is 1.42.8. The shipped product may differ from what this report describes. Survey the release branch too.
| tag 1.42.10 |
Security & Reliability Posture
adequate2 Dockerfiles run the application as root
adequateNo USER instruction switches away from root, so the process runs with full privileges inside the container. It is a one-line fix and an ordinary expectation, which is why its absence is worth asking about: it usually says more about whether anyone has reviewed the deployment than about this container specifically.
Dockerfile — runs as root |
src/telemetry/Dockerfile — runs as root |
1 environment file is committed
adequatesrc/interface/web/.env.production is tracked in git. Environment files are where credentials usually live, and committing one usually means nobody decided how secrets reach the running application. Whatever is in it is in the history for good. Check 05.1 says whether it holds anything credential-shaped.
src/interface/web/.env.production — committed environment file |
The build runs third-party code it does not pin
adequate8 third-party CI actions are referenced by a tag or branch rather than a commit, so they run whatever that tag points to on the day. Tags have been moved to malicious commits in real supply-chain attacks, and a piped script is whatever the server returns that minute. Pinning to a commit is the fix, and it is small.
.github/workflows/dockerize.yml:72 — action pinned by tag |
.github/workflows/dockerize.yml:75 — action pinned by tag |
14 outbound calls can wait forever
adequate14 HTTP calls use a client with no timeout (Python `requests` without `timeout=`, or Go's default client). When a dependency slows down, each one holds a worker until the connection gives up, and enough of them take the service down with the dependency.
src/khoj/configure.py:451 — outbound call without a timeout |
src/khoj/processor/content/github/github_to_entries.py:123 — outbound call without a timeout |
src/khoj/processor/conversation/utils.py:1056 — outbound call without a timeout |
1 deserialiser that can run code
adequate1 places read data with a deserialiser that executes what it reads (pickle). That is safe on data the system wrote itself and remote code execution on anything else. Ask where each one's input comes from.
src/khoj/database/migrations/0064_remove_conversation_temp_id_alter_conversation_id.py:25 — code-executing deserialiser |
31 locked dependencies have published vulnerabilities, 31 high or critical in what ships
adequate31 of 489 locked dependencies match 122 published advisories in OSV, 67 of them rated high or critical. A lockfile says which version is installed, not whether the flawed code is reachable from this product, so each needs a look. Most are fixed by an upgrade, and the advisory names the version. This lockfile pins development tools alongside what ships and does not say which is which, so some of these may never reach a user.
26 places insert HTML from a variable without sanitising it
adequate26 places set HTML from a value that is neither a literal nor passed through a sanitiser. Where the value can come from a user, that is stored cross-site scripting, and it is the first thing a buyer's security review looks for in a frontend.
src/interface/desktop/assets/purify.min.js:2 — HTML from a variable |
src/interface/desktop/chatutils.js:14 — HTML from a variable |
src/interface/desktop/chatutils.js:88 — HTML from a variable |
Relicensed: GPL-3.0 → AGPL-3.0 (2023-11-16)
adequateThe root licence changed 1 time(s). The latest terms restrict what users, hosts or a buyer may do in ways the earlier ones did not. Code taken under the old terms stays under them, so both matter in diligence.
5 advisories against this project in the last 24 months, 1 high or critical
adequateThe newest was published on 2026-06-28. A project that publishes advisories is telling its users about its fixes, and the count and pace say how much security work it carries. Whether 1 of them are fixed in the code you ship could not be told from this history: its version is only known to be at least 1.42.8. Answer lives in: the release you run, set against each fixed version. GHSA-6whj-7qmg-86qj (moderate) is fixed in the surveyed commit; which release carries it cannot be told from this history, which does not place the release users run. Answer lives in: the version you run.
| 2026-06-28: CVE-2026-13508 (low): A flaw has been found in khoj-ai khoj up to 2.0.0-beta.28. This impacts an unknown function of the file src/khoj/routers/api_chat.py of the component Conversati |
| 2026-06-24: GHSA-62mm-xwmv-crhg (high), fixed in 2.0.0-beta.25: khoj has an unauthenticated path traversal in /home/ endpoint that allows file read from server filesystem |
| 2026-02-01: GHSA-6whj-7qmg-86qj (moderate): Khoj has an IDOR in Notion OAuth Flow that Enables Index Poisoning |
| 2024-12-29: GHSA-hq4h-w933-jm6c (moderate), fixed in 1.29.0: khoj has an IDOR in subscription management allows unauthorized subscription modifications |
| 2024-08-20: GHSA-cf72-vg59-4j4h (moderate), fixed in 1.15.0: Khoj Vulnerable to Stored Cross-site Scripting In Automate (Preview feature) |
Observability & Operations
adequateNo telemetry or error reporting is wired in anywhere
adequateNone of 505 readable files references an instrumentation, metrics or error-reporting library. If this system is in production, nobody learns that it broke from the system itself — they learn it from a customer. That is a reliability finding before it is an observability one.
| searched 505 tracked text files for 16 known instrumentation libraries; manifests for metrics, tracing and error-reporting families; locked dependencies for the packages that emit; 0 matched |
No structured logging library is in use
adequateNothing references a structured logging library. Logs that are written to be read by a person are not searchable by a machine, which means incident response here is proportional to how well someone remembers the codebase rather than to what the tooling can find.
| searched 505 files for 10 structured logging libraries; 0 matched |
One request cannot be followed through the logs
adequateNothing in the service carries a request or correlation id, and there is no tracing. When a customer reports a failure, the log lines that belong to their request cannot be picked out from everyone else's.
| no request id, correlation id or tracing found |
No error reporter is wired in
adequateNothing in the service initialises an error reporter (Sentry, Rollbar, Bugsnag, Honeybadger or an APM agent). An exception in production reaches a person only if someone is reading the logs, which usually means a customer reports it first.
| no error reporter initialised |
4 of 5 deployed images carry no version, or `latest`
adequate4 images in the deployment configuration are named without a version or as `latest`. A redeploy can change the software without a commit, a rollback has nothing to roll back to, and nobody can say from the repository what is running.
docker-compose.yml:16 — image without a version |
docker-compose.yml:23 — image without a version |
docker-compose.yml:32 — image without a version |
Fit with the Acquirer
not assessableNot rated: structurally not assessable from a repository.
Read more, or read your own
The full report on khoj-ai/khoj: every dimension, the questions for the room, and the audit log.
Survey a repository: free on public repositories. Private code is read on your own machine by a collector whose source you can read first.