Skip to main content

graphene-disable-introspection - Middleware for Python Graphene to disable introspection

Project description

Graphene Middleware to Disable Introspection

This middleware for Python's Graphene library disables introspection queries, enhancing the security of your GraphQL API by preventing clients from discovering the schema.

Installation

To install the middleware, you can use pip:

pip install graphene-introspection-middleware

Usage

To use the middleware in your Graphene project, you need to add it to your GraphQL schema.

Example

Python Usage

Import the middleware and add it to your schema.

GraphqlView.as_view(middleware=[DisableIntrospectionMiddleware()])

Django Usage

Add the middleware to your Django settings.

GRAPHENE = {
    ...
    "MIDDLEWARE": [
        "graphene_introspection_middleware.DisableIntrospectionMiddleware",
        ...
    ],
}

Alternatively, you can deactivate Graphene Introspection for the Production System only.

if os.environ.get("APP_SETTINGS") == "production":
    GRAPHENE["MIDDLEWARE"].insert(0, "graphene_introspection_middleware.DisableIntrospectionMiddleware")

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphene_disable_introspection-0.1.tar.gz (14.8 kB view details)

Uploaded Source

File details

Details for the file graphene_disable_introspection-0.1.tar.gz.

File metadata

File hashes

Hashes for graphene_disable_introspection-0.1.tar.gz
Algorithm Hash digest
SHA256 efc89e498f254c6116bc574f4593b8d740d911e726a413fdea11f8285513a6d1
MD5 257230ba37d2aa323c94adfe378a2d53
BLAKE2b-256 1f267d1243845980aff205c340434af8a9f00bf7885d4caa71bcf9d030309dbf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page