Skip to content

Option to disable following HTTP redirects #338

Open

Description

@KiSae-Lee

Version: openfga-sdk 0.10.6 (Python)

Problem
The client follows HTTP redirects returned by the OpenFGA server address, and there is no configuration option to turn this off. An authorization client should usually not follow a redirect from its OpenFGA endpoint: a misconfigured proxy or a compromised network hop can send authorization requests (including the API token) to another host.

Today the only way to stop it is to replace an internal object (OpenFgaClient._api_client / its REST client) with a subclass, which depends on private names and can break on any upgrade.

Request
One of:

  1. A configuration option, e.g. ClientConfiguration(follow_redirects=False), applied to both the sync and async clients; or
  2. A supported way to pass our own HTTP session / transport, so callers can set redirect behaviour themselves.

With redirects disabled, a 3xx answer would be surfaced as an error (for example an ApiException with the status code) instead of being followed.

Workaround we use
Subclassing the internal REST client to set allow_redirects=False, plus a regression test that fails if the internal attribute changes.

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