Borehole · Project · free tier
khoj-ai/khoj
Free reading: not for reliance
ae229ca · 5,180 commits · 702 files
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.

DimensionRating
Architecture & Codebase — including AI provenancestrong
Engineering Process & SDLC Maturityadequate
Product & Engineering Maturityadequate
Security & Reliability Postureadequate
Observability & Operationsadequate
Fit with the Acquirernot 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

strong
01.6

src/khoj/routers/helpers.py is 3,459 lines, 64× this codebase's median file

adequate

The 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.

Evidence
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

adequate
02.3

Tests cover a thin slice of the codebase

adequate

30 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.

Evidence
30 test files / 371 source files

Product & Engineering Maturity

adequate
04.19

5% of bug fixes add or change a test

adequate

Of 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.

Evidence
12 of 255
04.62

Releases are cut from another branch than the one surveyed

adequate

The 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.

Evidence
tag 1.42.10

Security & Reliability Posture

adequate
05.6

2 Dockerfiles run the application as root

adequate

No 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.

Evidence
Dockerfile — runs as root
src/telemetry/Dockerfile — runs as root
05.25

1 environment file is committed

adequate

src/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.

Evidence
src/interface/web/.env.production — committed environment file
05.27

The build runs third-party code it does not pin

adequate

8 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.

Evidence
.github/workflows/dockerize.yml:72 — action pinned by tag
.github/workflows/dockerize.yml:75 — action pinned by tag
05.13

14 outbound calls can wait forever

adequate

14 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.

Evidence
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
05.22

1 deserialiser that can run code

adequate

1 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.

05.26

31 locked dependencies have published vulnerabilities, 31 high or critical in what ships

adequate

31 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.

Evidence
uv.lock — anyio 4.8.0: GHSA-82r6-8w77-94w6 (critical), fixed in 4.14.2
uv.lock — certifi 2025.4.26: GHSA-6q48-6c7w-9gw2 (critical), fixed in 2026.10.19
uv.lock — pillow 12.2.0: GHSA-332p-7hrc-92wf (critical), fixed in 13.0.0
05.48

26 places insert HTML from a variable without sanitising it

adequate

26 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.

Evidence
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
05.60

Relicensed: GPL-3.0 → AGPL-3.0 (2023-11-16)

adequate

The 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.

Evidence
LICENSE — GPL-3.0 from 2021-08-16
LICENSE — AGPL-3.0 from 2023-11-16
05.65

5 advisories against this project in the last 24 months, 1 high or critical

adequate

The 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.

Evidence
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

adequate
06.1

No telemetry or error reporting is wired in anywhere

adequate

None 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.

Evidence
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
06.2

No structured logging library is in use

adequate

Nothing 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.

Evidence
searched 505 files for 10 structured logging libraries; 0 matched
06.8

One request cannot be followed through the logs

adequate

Nothing 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.

Evidence
no request id, correlation id or tracing found
06.9

No error reporter is wired in

adequate

Nothing 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.

Evidence
no error reporter initialised
06.18

4 of 5 deployed images carry no version, or `latest`

adequate

4 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.

Evidence
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 assessable

Not 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.