Fix unauthenticated Ogham generate-report AI cost abuse and readings IDOR - #45
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Unauthenticated POST /api/tools/ogham/generate-report called Groq and read/wrote Admin oghamReadings by body userId. Gate the HTTP route to the signed-in owner and run Stage B in-process so generation still works. Co-authored-by: ANDY OLIVER ROZARIO <AndyOliverR@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What changed
POST /api/tools/ogham/generate-reportnow requires a Firebase Bearer token and rejectsuserIdthat is not the signed-in user, before any Groq call or AdminoghamReadingsread/write.oghamIntelligence.generateReadingin-process instead of HTTP-looping the public route (so adding auth does not break catalog generation).Why this change is safe
POST{ userId, userProfile }and burn Groq (llama-3.3-70b-versatile, 2000 tokens, 2 attempts) plus read/overwriteusers/{userId}/oghamReadingsvia the Admin SDK.{ report, generatedAt }.useToolReport); it does not call this HTTP route.Verification
pnpm exec eslinton touched files (0 errors)pnpm test— 62 suites / 326 tests passed, includingtests/integration/ogham-generate-report-auth.test.tspnpm run lint:securitypassedRegression prevention
{ report, generatedAt }payload without depending on an open HTTP hole.Release checklist (solo-friendly)
main