ProjectBuild a Permission-Aware Knowledge Hub as an MCP Server: the explanation · Module 18: Security: threats and fixes · part 20 of 22
Part 20 · Module 18: Security: threats and fixes

Module 18: Security: threats and fixes

24 min read·
About 45 minutes · Needs: Module 7 (groups and visibility), Module 10 (the permission filter and the withheld count), Module 12 (OAuth, tokens and the session cookie), Module 14 (audit redaction) · Code: server/wayfinder/core/middleware.py, core/http.py, core/ratelimit.py, core/config.py, core/proxy.py, mcp/server.py, mcp/stdio.py, cli.py, tests/test_security_review.py, tests/retrieval/test_security_acl.py, tests/test_demo_accounts.py

Where this fits

WHERE THIS FITS Wayfinder this module AI CLIENTS the model writes the answer CONSOLE React, nginx WAYFINDER SERVER Starlette, mcp 2.3 RETRIEVAL permission filter before ranking INDEXING fastembed DATA Postgres 17 OPERATIONS evals, Docker, Cloud Run Claude Code HTTP + OAuth Cursor HTTP + OAuth Claude Desktop stdio bridge or connector MCP Inspector debugging, quick OAuth Web console React: search, audit, connect nginx one URL: /mcp, OAuth, /api MCP layer tools, resources Elicitation confirm create_issue OAuth 2.1 auth server, PKCE Tokens, sessions wf_pat_, cookie Console API /api REST Audit log every call, redacted stdio bridge wayfinder-stdio Guards proxy secret, limits Access rules groups per team Hybrid search pgvector + full text Fusion, boosts RRF, freshness, ADRs Knowledge decisions, owners Indexer loader, chunker bge-small-en fastembed, CPU PostgreSQL pgvector, full text Seed company Tidewater Freight Evaluation retrieval, 0 leaks Containers Docker Compose Deploy Cloud Run, Cloud SQL CI/CD GitHub Actions, WIF
The parts this module hardens (blue): nginx at the front door, the server's guards, the OAuth server and tokens, the audit log, and the access rules every search depends on.

Other modules build features. This one asks how each feature can be abused and shows the code that stops it. The highlighted parts are where attacks land: nginx at the front door, the guards in the server (body cap, rate limits, CSRF, headers, proxy secret), the OAuth server and tokens, the audit log, and the access rules that every search depends on.

The rest of this project is yours to keep

This project is bought on its own, once, and stays readable afterwards, including the parts added to it later.

Or open everything with a plan