Skip to content

feat(chat): read-only data gateway under the user's session, tool schemas, untrusted-data labelling, rate limit - #227

Merged
Kumar2421 merged 5 commits into
mainfrom
feat/assistant-data-gateway
Oct 23, 2026
Merged

Kumar2421 merged 5 commits into
mainfrom
feat/assistant-data-gateway

Conversation

@Kumar2421

Copy link
Copy Markdown
Owner

Security boundary for the AI CMO chat: MODEL -> named tools only -> ONE read-only gateway -> database under the user's own identity. Hosted chat reads now use the signed-in user's session client so Postgres RLS enforces tenancy (all 10 tables the chat reads have owner policies, verified against the live database); the service-role client is removed from the chat DATA path (kept only for credentials/vault/credits and the entitlement usage count, documented). Gateway functions take a mandatory {userId, projectId} scope, have no generic query and no writes, re-check every returned row against the scope, and verify project ownership once per turn. Tool args validated by a dependency-free schema helper (unknown keys dropped, enums, bounded strings, clamped numbers, UUID ids re-checked for ownership). Untrusted crawled/lead text is stripped, defanged and wrapped as data; TOOL_SYSTEM_RULES says results are data, never instructions. Audit trail = structured log lines (event assistant.tool_call: user, project, tool, args HASH, ok, ms; platform_audit_log does not exist). Per-user rate limit 12 chat requests/min (per instance), separate from the 402 body. Lead tool never returns emails. Dead AgentsChatPanel deleted. Static guard tests fail the build if tools/toolLoop/gateway import getDb, createServiceClient, the vault or 'service_role'. 1977 tests pass. Not verified live: behaviour of the user client under RLS in the chat route (confirm after deploy that chat still sees findings); previews unavailable (Vercel build rate limit).

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown

Deployment failed for project okara-alternative with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/kumar2421s-projects?upgradeToPro=build-rate-limit

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-23T12:35:48.535578Z
We couldn’t complete this review. Comment @codex review to try again.
22f776d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@Kumar2421
Kumar2421 merged commit 1ae7d63 into main Oct 23, 2026
2 of 3 checks passed
@Kumar2421
Kumar2421 deleted the feat/assistant-data-gateway branch October 23, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant