Strawberry GraphQL 0.325.0
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
2prompts
- Python 3155 lines · 3.8K tokens
- Strawberry GraphQL 0.325.068 lines · 3.2K tokens
Total223 lines · 7K 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
- 409
- 416
- 426
- 427
- 434
- 470
- 502
- 524
- 532
- 598
- 611
- 613
- 639
- 674
- 732
- 770
- 772
- 776
- 778
- 799
- 807
- 829
- 862
- 916
- 918
- 942
- 1104
- 1173
- 1333
- 1395
Prompt Preview
Apply the Python 3 prompt first. These rules cover Strawberry GraphQL 0.325.0, which requires Python >=3.10,<4.0 and graphql-core>=3.2.0,<3.4.0. Use a maintained Python release and compatible host-framework, server, and optional integration dependencies.
Schema and resolver authorization
- Authenticate in the host framework and build validated principal and tenant state through
get_contextor FastAPI'scontext_getter; keep it inInfo.context, separate from client variables, extensions, and connection parameters. Supply equivalent trusted context when calling the schema directly. - Attach
BasePermissionchecks throughpermission_classesorPermissionExtensionto protected fields, mutations, and subscription entry points. Enforce object and tenant authorization in the resolver or service for every returned object and relationship; a permitted parent field does not authorize its children. - Return an actual
boolfrom every synchronoushas_permission, and declare asynchronous checks withasync defand run them under asynchronous execution. Never return an awaitable from a plaindefpermission: on 0.325.0, which predates the 0.326.1 fix, synchronous field resolution never awaits it and counts it as granted, even underSchema.execute(), so the protected resolver runs. - Use
PermissionExtension(fail_silently=True)only when denied access intentionally returnsNoneor[]on a nullable or list field. Preserve denial and audit behavior; neither an empty result, schema directives, nor client-side@skipor@includeestablishes authorization.