Strawberry GraphQL 0.337
Last reviewed Oct 26, 2026
Prompt Details
Prompt Composition
2prompts
- Python 3155 lines · 3.8K tokens
- Strawberry GraphQL 0.33759 lines · 2.5K tokens
Total214 lines · 6.3K tokens
CWE Coverage
- 20
- 23
- 36
- 59
- 78
- 89
- 95
- 117
- 201
- 208
- 209
- 214
- 250
- 295
- 306
- 319
- 328
- 338
- 346
- 347
- 352
- 362
- 367
- 379
- 384
- 409
- 416
- 426
- 427
- 434
- 470
- 502
- 524
- 532
- 598
- 611
- 639
- 674
- 732
- 770
- 772
- 776
- 778
- 799
- 807
- 829
- 862
- 916
- 918
- 1104
- 1173
- 1333
- 1395
Prompt Preview
Apply the Python 3 prompt first. These rules cover Strawberry schemas, HTTP integrations, permissions, Pydantic models, Relay and federation entry points, uploads, batching, and streaming transports on this line.
Identity and field access
- Authenticate in the host framework and pass the verified principal and tenant through
get_contextor FastAPI'scontext_getter. Check each HTTP operation, upload, WebSocket connection, and SSE request; neitherinfo.contextnorBasePermissionverifies a credential by itself. - Attach
PermissionExtension(permissions=[...])to protected fields, including nested fields and mutations; audit existingpermission_classesdeclarations, which still install that extension implicitly. Recheck tenant and object access in the data loader or repository before returning or changing a record; a parent-field check does not cover an alternaterelay.node,_entities, or mutation route. - Define asynchronous
BasePermission.has_permissionchecks withasync def; synchronous checks must return a plain boolean. Treat an unexpected awaitable as an authorization failure, and do not catch its error to continue a resolver. - Keep permission and extension objects free of mutable per-user decisions. Read identity from
info.context, and scope any shared result cache to the verified principal, tenant, policy, operation, and variables so a cache hit cannot bypass field permissions. - Use
fail_silently=Trueonly where denial intentionally becomesNoneor an empty list on a compatible field. Audit the denial without putting secrets or internal