Skip to content

Responses with wrong field types are coerced instead of rejected #339

Open

Description

@KiSae-Lee

Version: openfga-sdk 0.10.6 (Python)

Problem
When a 200 response does not match the documented shape, the client converts values instead of raising an error. Examples we reproduced against a stub server:

Response body Result
check → {"allowed": "false"} allowed is True
check → {"allowed": 1} allowed is True
check → 200 with a body that is not JSON allowed is False, no error
list_objects → {"objects": "doc:1"} returns the characters of the string as objects

A real OpenFGA server does not send these bodies, but a proxy or faulty server in front of it can. For an authorization client, treating "false" as allowed is a fail-open result.

Expected
A 200 response whose fields do not have the documented types (e.g. allowed is not a boolean, objects is not a list of strings, the body is not JSON) raises a validation error instead of returning a value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions