Repository navigation
feat(chat): read-only data gateway under the user's session, tool schemas, untrusted-data labelling, rate limit - #227
Merged
Conversation
|
Deployment failed for project okara-alternative with the following error: Learn More: https://vercel.com/kumar2421s-projects?upgradeToPro=build-rate-limit |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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