Skip to content

Latest commit

 

History

History
65 lines (41 loc) · 3.47 KB

File metadata and controls

65 lines (41 loc) · 3.47 KB

Talk With Jamie

CI

Live at talkwithjamie.netlify.app.

An AI chat that answers as me. It tells you it is an AI, chats are stored, and I can read them. All of that is said on the page before you type anything.

The chat is the easy half. The half worth reading the code for is the access control.

The actual problem

Anyone can use this, including as a guest, and it answers using context about me. So the design question was never "how do I make a chatbot". It was:

  • which context does a stranger get
  • which context do I get
  • how do I stop somebody talking the model into handing over the rest

How that is enforced

Context is split by audience. Public chunks are approved, general and deliberately boring. The private pack is built and reviewed on my own machine, then uploaded to private Blob storage. It is never committed or included in the deploy bundle.

Public chat can only retrieve public chunks. Not "is discouraged from" retrieving the others. Cannot. There is also no route in the app that reads the pack back out, including for me while signed in as admin.

The model is told to refuse extraction attempts too, but that is a second line, not the boundary. A prompt is a request, not a permission system. Anything the model can retrieve, it can eventually be talked into repeating. The retrieval layer therefore makes sure no private chunk is sent in a public model request. That rule is covered by tests because it is the part of this project that would matter most if it broke.

Talk With Jamie architecture

Where the code is

v2/ is the app. Netlify builds with v2 as the base directory. The original flat app that used to serve production was removed once the migration finished. It is still readable at the v1-final tag if you want to see what it grew out of.

Setup, the context-pack builder and the privacy detail are in v2/README.md.

What is in it

  • Guest and registered accounts, with several saved chats each
  • Signed HttpOnly, SameSite=Strict session cookies, compared in constant time
  • Passwords hashed with scrypt
  • Users, chats and rate limits in Netlify Blobs
  • Per-route rate limits, request size caps and same-origin checks
  • A private side for me: reading conversations, blocking, deleting, drafting replies
  • 36 tests, aimed mostly at the auth and the public/private context boundary

Running it

cd v2
npm ci
npm test
npx netlify dev

AI-assisted security work

I used AI tooling while working on the auth and context boundary, including signed sessions, password hashing, same-origin checks and the focused tests that verify public chat cannot retrieve private chunks. I reviewed each boundary against those tests before deploying it.

Known limitations

  • Chats are stored and I can read them. It is disclosed, but it is still the honest limitation of the whole idea
  • The message goes to a third-party model provider to get a reply, so it leaves my infrastructure
  • Guest accounts are cheap to create. Rate limits slow that down; they do not prevent it
  • No manual screen-reader testing yet; accessibility checks currently cover keyboard use and site structure

Read PRIVACY.md before touching anything to do with context.