Conversation
The embedded OpenFGA server was built without WithListObjectsMaxResults / WithListUsersMaxResults, so OpenFGA v1.22.1's defaults (1000) applied per call. That equals service.maxFgaListResults, so a single (type, relation) pair with more than 1000 matches came back as exactly 1000 and the service never saw a 1001st result: list_permissions returned truncated=false while silently dropping results. Set both engine caps to maxListResults = 1001 (service cap + 1) so the service-side cap is the one that bites and truncated is reported. Regression tests: engine-level ListObjects/ListUsers above the cap, and an integration test asserting list_permissions returns 1000 with truncated=true for 1050 grants (fails without the fix).
For a delegated caller, list_permissions enumerates each subject (agent and user) separately and intersects the results. Each per-subject slice is capped by the engine before the intersection, and OpenFGA returns objects unordered, so two capped slices of large sets overlap far less than the true intersection. The folded result could fall under the service cap and be reported as truncated=false while most reachable objects were dropped. Mark the response truncated when any raw per-subject slice exceeds maxFgaListResults (i.e. the engine hit its maxFgaListResults+1 cap), before intersecting. Aggregation still stops at the service cap. Regression test: user grants on 3000 documents, agent on 3000 with a 2000-document overlap; truncated must be true (failed 3/3 before).
Merged
lakhansamani
added a commit
that referenced
this pull request
Nov 27, 2026
Black-box, against the real binary: - GHSA-p7g3-2258-8wmp: org A's SCIM PATCH of a shared user's userName, emails, phoneNumbers (and a mixed PatchOp) is refused with 400/mutability and writes nothing; the reset cannot reach the attacker's mailbox; case-only and single-org changes still sync. - #904: RS256/ES256 tokens carry a kid equal to the RFC 7638 thumbprint of a JWKS key that verifies them, including a pre-rotation token after a primary-to-secondary rotation; HS256 tokens have no kid. - #913: client_id on access tokens and azp == aud on ID tokens from the authorization_code, refresh_token and client_credentials grants. - #903: list_permissions with cap+1 grants returns cap results and truncated=true on GraphQL, REST and gRPC; under the cap, false.
lakhansamani
added a commit
that referenced
this pull request
Nov 27, 2026
* test(e2e): smoke coverage for 2.4.9 fixes Black-box release smoke tests against the real binary for the 2.4.9 fixes: - GHSA-rpv7-grw6-r2jv: a wrong-password login to an unverified account arms an MFA session that skip_mfa_setup, lock_mfa, totp/email OTP setup and webauthn registration options must all reject on GraphQL, REST and gRPC; the emailed OTP (read from an in-test SMTP sink) still completes login via verify_otp. - #922: restart on the same DB with a role removed from --roles; login, validate_jwt_token on an old token and the refresh grant stop honouring it. - #924/#932: a fake Redis that errors after the startup PING; revoke returns a masked internal error with an error_id on every surface, and that id is logged next to the original error. - #927: admin users sort/filter return identical ordered results on GraphQL, REST and gRPC. startServer gains a startServerWithLog variant that returns the log path. * test(e2e): smoke coverage for 2.4.7 and 2.4.8 fixes Black-box, against the real binary: - GHSA-p7g3-2258-8wmp: org A's SCIM PATCH of a shared user's userName, emails, phoneNumbers (and a mixed PatchOp) is refused with 400/mutability and writes nothing; the reset cannot reach the attacker's mailbox; case-only and single-org changes still sync. - #904: RS256/ES256 tokens carry a kid equal to the RFC 7638 thumbprint of a JWKS key that verifies them, including a pre-rotation token after a primary-to-secondary rotation; HS256 tokens have no kid. - #913: client_id on access tokens and azp == aud on ID tokens from the authorization_code, refresh_token and client_credentials grants. - #903: list_permissions with cap+1 grants returns cap results and truncated=true on GraphQL, REST and gRPC; under the cap, false. * test(e2e): opt-in make smoke-db for SereneDB, SurrealDB and SQL Server `make smoke-db DB=serenedb|surrealdb|sqlserver` starts the database in Docker and runs TestReleaseSmokeDB against the real binary: signup, login, session, refresh grant, admin users list, forgot_password and resend_verify_email twice with the superseding link redeemed, and MFA enrollment twice plus a concurrent burst. The repeated forgot_password fails with INTERNAL on SQL Server without the 2.4.7 conflict-target fix. Skipped unless SMOKE_DB_ARGS is set, so `make smoke` stays SQLite-only and needs no Docker. * test(e2e): build the smoke binary once; unique smoke-db run ids; review nits
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.
Problem
The embedded OpenFGA server is built without
WithListObjectsMaxResults/WithListUsersMaxResults, so OpenFGA v1.22.1'sDefaultListObjectsMaxResults/DefaultListUsersMaxResults(both 1000) apply per call. That equalsservice.maxFgaListResults(1000).A single
(type, relation)pair with, say, 5,000 matches came back from the engine as exactly 1000.ListPermissionsappended all 1000, never saw a 1001st, and returnedtruncated: false, so results were dropped with no signal to the caller.Fix
internal/authorization/engine/openfga/openfga.go: configure the server withWithListObjectsMaxResults(maxListResults)andWithListUsersMaxResults(maxListResults), wheremaxListResults = 1001(service cap + 1). The service-side cap is now the one that applies, sotruncatedis set correctly. Kept as a literal likemaxBatchCheckSize, so the engine doesn't importservice; a comment documents the coupling.Delegated callers (second commit)
For an RFC 8693 delegated caller,
ListPermissionsenumerates the agent and the user separately and intersects the results. Each per-subject slice is capped by the engine before the intersection, and OpenFGA returns objects unordered, so two capped slices of large sets overlap far less than the true intersection. The folded result could fall under the cap and be reported astruncated: falsewhile most reachable objects were dropped. This was already the case before this PR.internal/service/list_permissions.go: mark the response truncated when any raw per-subject slice exceedsmaxFgaListResults(meaning the engine hit itsmaxFgaListResults + 1cap), before intersecting. Aggregation still stops at the service cap.Tests
TestOpenFGAEngine_ListAboveServiceCap: 1,050 grants;ListObjectsandListUsersmust each return 1001 (both returned 1000 before).TestFGAListPermissionsTruncated: end-to-endlist_permissionswith 1,050 grants on one pair → 1000 permissions,truncated: true. Verified failing without the fix.TestAgentIntersectionListPermissionsTruncated: delegated token; user grants ondocument:0..2999, agent ondocument:1000..3999(true intersection 2000).truncatedmust be true. Failed 3/3 runs before the second commit.go build ./...,go vet ./...,make test,make lint-gopass locally.Not covered (follow-ups)
No pagination upstream: OpenFGA v1.22.1 (latest) has no continuation token on ListObjects/ListUsers, and maintainers have said paging is not planned (openfga#2828). A truncated response is an arbitrary 1000 objects, not the first 1000.
Deadline truncation:
DefaultListObjectsDeadline(3s) returns partial results with no error, sotruncatedcan still be a false negative on slow queries._fga_list_users: its 1000 cap now actually applies, but the response has notruncatedfield, so callers can't detect truncation (needs a GraphQL + proto schema change).