Git Product home page Git Product logo

graphqlschema2payload's Introduction

graphqlschema2payload

This little piece of software helps to recreate GraphQL payloads from a GraphQL Schema. It works by visiting the Schema and resolving all types. Its main purpose is to create tests that can be used for QA or pentesting.

Install

npm install 

Server Version

The server version integrates GraphiQL interface and populates the editor with an automatically generate template from the schema.

  1. Launch the server: npm start

  2. Visit http://localhost:4000/

  3. Add the remote URL and optional Headers (Ie. Authorization Bearer) separated by lines (eg. https://bahnql.herokuapp.com/graphql). image

  4. Click Continue in order to let GraphiQL fetch the Schema via the local server. Local server also instantiates GSchema which automatically extracts templates from gqlSchema.

  5. Use the dropdown menus Query and Mutations to populate the editor with a specific template.

image

  1. Edit the template with the arguments.

  2. Execute the query and get the response from the remote URL.

image

CLI Version Usage:

The CLI version helps exploring the GQL Schema.

Usage: node ./index.js [-r] [-q] [-m] [-a] [-f filename_schema]|[[-p] -u http://URL [-H 'NAME1=VALUE1|NAME2=VALUE2']] [action_name]
  -q : prints all queries
  -m : prints all mutations
  -f : schema path 
  -a : print all actions
  -u : url to download grapql schema
  -H : Header to add. Use format like NAME1=VALUE1|NAME2=VALUE2 for multiple pairs
  -p : print downloaded schema [to save it somewhere use redirection >/output_schema.json ]
  -r : prints the POST payload to be used as template for testing - NB: No Arguments Value Given. user needs to add them by hand -

eg. download one of https://github.com/APIs-guru/graphql-voyager/tree/master/demo/presets/

node index.js -f ./sample_schemas/graphbrainz.json.json -a

eg. Download Schema using introspection and print all query names:

node index.js -u 'https://api.github.com/graphql' -H 'Authorization= bearer TOKEN' -q

Examples

http://apis.guru/graphql-apis/

TODO

  • add compatibility to previous graphql versions. EG. :
https://pokeapi-graphiql.herokuapp.com/

graphqlschema2payload's People

Contributors

wisec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

graphqlschema2payload's Issues

NPM Install what?

The installation procedure says npm install but doesn't say what we are installing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.