Repository navigation
fix(store): org users search reports a value that is not a uuid as bad input - #1942
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: raystack/frontier/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 SummarySummary by CodeRabbit
Walkthrough
ChangesOrganization user UUID errors
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to No merge-blocking issue is established for the organization-user UUID error handling. Merge after normal checks. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 35972691802Coverage increased (+0.03%) to 51.676%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: raystack/frontier/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID: ca8868a4-d718-4a43-942f-e1bbfe58af99
📒 Files selected for processing (3)
internal/api/v1beta1connect/organization_users.gointernal/store/postgres/org_users_repository.gointernal/store/postgres/org_users_repository_pg_test.go
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review.
7edb4c6 to
fa2681c
Compare
fa46090 to
023ea25
Compare
…d input Search maps the database type error to ErrBadInput, so the search and export handlers answer with invalid argument instead of internal.
023ea25 to
2522d8f
Compare
Covers the three error paths of ExportOrganizationUsers against the service mock, so removing the mapping fails a test.
Stacked on #1941.
Summary
A
role_idsfilter value or an org id that is not a uuid made the org users search return an internal error with the raw database message. It now returns invalid argument.Changes
OrgUsersRepository.Searchruns the query error throughcheckPostgresErrorand returnsErrBadInputfor the uuid type error.ExportOrganizationUsersmapsErrBadInputtoCodeInvalidArgument, the same asSearchOrganizationUsersalready does.ErrBadInput.Technical Details
The filter value and the org id are bound as text against uuid columns, and Postgres raises
SQLSTATE 22P02for a value that does not parse. The request validation only checks that the org id is at least three characters long.Test Plan
go test -run 'TestOrgUsersRepository' ./internal/store/postgres/passesinvalid input syntax for type uuidin the error chaingolangci-lint runon the store and connect packages reports no issuesSQL Safety
?placeholders,goqu.Ex{}, orgoqu.Record{}— neverfmt.Sprintfor+building a query that gets executed.ToSQL()callers capture and forward params. Neverquery, _, err := ….?placeholders inside single-quoted SQL literals ingoqu.L.//nolint:forbidigoor// #nosec G20xannotations.