Declarative GraphQL in a Cloud-Native Gateway

Rate this content
Bookmark

We’ve all heard the buzz around pushing application security into the hands of developers, but if you’re like most companies, it has been hard to actually make this a reality. You aren’t alone – putting the culture, processes, and tooling in place to make this happen is tough – especially for sophisticated applications like those backed by GraphQL.


In this hands-on technical session, StackHawk Lead Engineer Topher Lamey will walk through how to protect your GraphQL APIs from vulnerabilities using automated security testing. Get ready to roll-up your sleeves for automated AppSec testing.

This workshop has been presented at GraphQL Galaxy 2022, check out the latest edition of this Tech Conference.

FAQ

Schema stitching in GraphQL is the process of combining multiple GraphQL schemas into a single schema. This allows for querying data from multiple sources using a unified GraphQL API.

GraphQL is a schema query language for APIs, similar to SQL for databases. It allows clients to request specific data and only the data they need, reducing unnecessary information transfer.

GraphQL provides a more efficient way to query data compared to REST APIs. In REST, multiple endpoints may need to be queried to get the required data, whereas GraphQL allows clients to request exactly what they need in a single query, reducing unnecessary data transfer and multiple API calls.

GlueEdge is a product that acts as an API gateway and integrates GraphQL within it. It does not require a separate GraphQL server as GlueEdge has it built-in. This feature is part of the enterprise version of GlueEdge.

Automatic schema generation in GlueEdge allows for the automatic creation of GraphQL schemas from existing REST and gRPC services. This feature simplifies the process of setting up GraphQL APIs by generating the necessary schema definitions automatically.

The special types in GraphQL are 'Query' and 'Mutation.' The 'Query' type is used for fetching data, while the 'Mutation' type is used for creating, updating, and deleting data.

A GraphQL API in GlueEdge can be secured using various authentication mechanisms such as API keys, OIDC, OPA, LDAP, and basic authentication. These can be configured in the auth config and attached to the virtual service to enforce security.

The virtual service in GlueEdge acts as an entry point for incoming requests. It defines how requests are routed to the appropriate upstream services, effectively managing the traffic and ensuring that the correct backend service is accessed.

GlueEdge handles data loss prevention by allowing users to mask sensitive data in the responses. This can be configured using regular expressions to identify sensitive data fields and replace them with masked characters, ensuring that sensitive information is not exposed.

In GraphQL, a resolver is a function that resolves a value for a type or field in the schema. It connects the schema fields to the underlying data sources, enabling the execution of queries and mutations.

Leon Nunes
Leon Nunes
48 min
01 Dec, 2022

Comments

Sign in or register to post your comment.
Video Summary and Transcription
This workshop provides an overview of GraphQL, a schema query language that allows you to request exactly what you need from the server. BlueEdge integrates GraphQL as an API gateway for microservices. The workshop covers topics such as installing BlueEdge, creating virtual services, generating schemas, and running queries. It also explores the benefits of GraphQL aggregation, schema stitching, and securing GraphQL APIs with external authentication.

1. Introduction to GraphQL

Short description:

I am a technical support specialist with a background in DevOps and Linux administration. I am learning about Kubernetes and cloud native technologies. GraphQL is a schema query language that solves the problem of unnecessary calls and filtering in REST APIs. It allows you to request exactly what you need from the server. This workshop is self-contained and provides an overview of GraphQL.

Hello, everyone. So about me, I am a technical support specialist in solo, and I have recently joined a month or so. I have a background in DevOps and Linux administration. And yeah, this is a this. This is a whole new thing for me.

Kubernetes and all these cloud native things, but I'm learning as I go. So when you open the link, you will be shown this sort of page and you can just click on this. So once you click the start track option, it will take around two minutes to create the environment. And meanwhile, you can watch the video that is that has an overview of GraphQL.

So what exactly is GraphQL? So GraphQL is like a schema query language. So if you heard of SQL, the famous SQL database, MySQL, PostgreSQL. So it's something similar. But this time it is for REST APIs. So then you have a bunch of REST APIs. You know, most of the times you have to query one and then you get a lot of information from it and you have to filter information from it. So this can get a bit cumbersome considering you know, you want for example, just a name of a user, but due to REST being REST you get a bunch of details like their phone numbers and the other details like address, etc. And then you have to filter it. So this causes unnecessary calls. And if you have, say, a shopping cart or something like that or some shopping query, like you know, give multiple REST API calls just to get a little bit of data, then you know, in that terms, REST becomes a bit cumbersome. And you have to have multiple calls to just get some information from the back end. Whereas in GraphQL, what happens is you have a server on the back end. And this server is like, a sort of a Uber to your, Uber chat we would say, to your application. And you just tell the server in a schema definition language, like what you want exactly and how you want it. For example, if you want, if you have a pet store application, and you know, you have a pet, and you have a store. So if you want to have pet names, all the pet names in the store, you could just tell graphql, like give me that and graphql will give you only that. So you get what you ask basically, and not all the noise that is unnecessary and not required.

Okay, so a little bit about Instruct. This is a self contained workshop. Everything that you require is inside this workshop, you do not have to switch over to your local machine or anything as such, you can just run everything in this lab inside this web browser, you will have these UI buttons that you can click on sometimes, in case you're not loading or anything as well as the refresh button here on the right hand side, you will see this, this bar which can be resized in case the text is too small. So you can go through the details at the workshop provides will give you a basic overview of what graph QL is and how it works and all.

2. Integration of GraphQL in BlueEdge

Short description:

GraphQL is integrated within our BlueEdge product, serving as an API gateway for microservices. Unlike typical GraphQL deployments, we have integrated it within our product. This enterprise feature is not available in the open source version. Contact us for a trial license to test and explore its capabilities.

So it's very useful in terms of microservices, where you have multiple rest API's. So we have a product called BlueEdge, that is sort of a entry point to your application. It's like an API gateway, say, and everything passes to that. So we have integrated graph QL within this product. So it has its own. So there is no separate graph QL server that is running or as such. When you have when you usually deploy graph QL, you have to deploy it with the server. Mostly there is a Apollo graph QL and there are various servers that are available that you can deploy and sort of use. But we have it integrated within our product. Also this is an enterprise feature. So the open source version does not have this. In case you would like to try it out, you can always reach out to us or me and we will help you with a trial license which you can use to test this and do your testing on that.

Watch more workshops on topic

Build with SvelteKit and GraphQL
GraphQL Galaxy 2021GraphQL Galaxy 2021
140 min
Build with SvelteKit and GraphQL
Top Content
Featured WorkshopFree
Scott Spence
Scott Spence
Have you ever thought about building something that doesn't require a lot of boilerplate with a tiny bundle size? In this workshop, Scott Spence will go from hello world to covering routing and using endpoints in SvelteKit. You'll set up a backend GraphQL API then use GraphQL queries with SvelteKit to display the GraphQL API data. You'll build a fast secure project that uses SvelteKit's features, then deploy it as a fully static site. This course is for the Svelte curious who haven't had extensive experience with SvelteKit and want a deeper understanding of how to use it in practical applications.

Table of contents:
- Kick-off and Svelte introduction
- Initialise frontend project
- Tour of the SvelteKit skeleton project
- Configure backend project
- Query Data with GraphQL
- Fetching data to the frontend with GraphQL
- Styling
- Svelte directives
- Routing in SvelteKit
- Endpoints in SvelteKit
- Deploying to Netlify
- Navigation
- Mutations in GraphCMS
- Sending GraphQL Mutations via SvelteKit
- Q&A
Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Featured Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.
End-To-End Type Safety with React, GraphQL & Prisma
React Advanced 2022React Advanced 2022
95 min
End-To-End Type Safety with React, GraphQL & Prisma
Featured WorkshopFree
Sabin Adams
Sabin Adams
In this workshop, you will get a first-hand look at what end-to-end type safety is and why it is important. To accomplish this, you’ll be building a GraphQL API using modern, relevant tools which will be consumed by a React client.
Prerequisites: - Node.js installed on your machine (12.2.X / 14.X)- It is recommended (but not required) to use VS Code for the practical tasks- An IDE installed (VSCode recommended)- (Good to have)*A basic understanding of Node.js, React, and TypeScript
GraphQL for React Developers
GraphQL Galaxy 2022GraphQL Galaxy 2022
112 min
GraphQL for React Developers
Featured Workshop
Roy Derks
Roy Derks
There are many advantages to using GraphQL as a datasource for frontend development, compared to REST APIs. We developers in example need to write a lot of imperative code to retrieve data to display in our applications and handle state. With GraphQL you cannot only decrease the amount of code needed around data fetching and state-management you'll also get increased flexibility, better performance and most of all an improved developer experience. In this workshop you'll learn how GraphQL can improve your work as a frontend developer and how to handle GraphQL in your frontend React application.
Build a Headless WordPress App with Next.js and WPGraphQL
React Summit 2022React Summit 2022
173 min
Build a Headless WordPress App with Next.js and WPGraphQL
Top Content
WorkshopFree
Kellen Mace
Kellen Mace
In this workshop, you’ll learn how to build a Next.js app that uses Apollo Client to fetch data from a headless WordPress backend and use it to render the pages of your app. You’ll learn when you should consider a headless WordPress architecture, how to turn a WordPress backend into a GraphQL server, how to compose queries using the GraphiQL IDE, how to colocate GraphQL fragments with your components, and more.
Relational Database Modeling for GraphQL
GraphQL Galaxy 2020GraphQL Galaxy 2020
106 min
Relational Database Modeling for GraphQL
Top Content
WorkshopFree
Adron Hall
Adron Hall
In this workshop we'll dig deeper into data modeling. We'll start with a discussion about various database types and how they map to GraphQL. Once that groundwork is laid out, the focus will shift to specific types of databases and how to build data models that work best for GraphQL within various scenarios.
Table of contentsPart 1 - Hour 1      a. Relational Database Data Modeling      b. Comparing Relational and NoSQL Databases      c. GraphQL with the Database in mindPart 2 - Hour 2      a. Designing Relational Data Models      b. Relationship, Building MultijoinsTables      c. GraphQL & Relational Data Modeling Query Complexities
Prerequisites      a. Data modeling tool. The trainer will be using dbdiagram      b. Postgres, albeit no need to install this locally, as I'll be using a Postgres Dicker image, from Docker Hub for all examples      c. Hasura

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

From GraphQL Zero to GraphQL Hero with RedwoodJS
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
From GraphQL Zero to GraphQL Hero with RedwoodJS
Top Content
Tom Pressenwurter introduces Redwood.js, a full stack app framework for building GraphQL APIs easily and maintainably. He demonstrates a Redwood.js application with a React-based front end and a Node.js API. Redwood.js offers a simplified folder structure and schema for organizing the application. It provides easy data manipulation and CRUD operations through GraphQL functions. Redwood.js allows for easy implementation of new queries and directives, including authentication and limiting access to data. It is a stable and production-ready framework that integrates well with other front-end technologies.
Local State and Server Cache: Finding a Balance
Vue.js London Live 2021Vue.js London Live 2021
24 min
Local State and Server Cache: Finding a Balance
Top Content
This Talk discusses handling local state in software development, particularly when dealing with asynchronous behavior and API requests. It explores the challenges of managing global state and the need for actions when handling server data. The Talk also highlights the issue of fetching data not in Vuex and the challenges of keeping data up-to-date in Vuex. It mentions alternative tools like Apollo Client and React Query for handling local state. The Talk concludes with a discussion on GitLab going public and the celebration that followed.
Batteries Included Reimagined - The Revival of GraphQL Yoga
GraphQL Galaxy 2021GraphQL Galaxy 2021
33 min
Batteries Included Reimagined - The Revival of GraphQL Yoga
Envelope is a powerful GraphQL plugin system that simplifies server development and allows for powerful plugin integration. It provides conformity for large corporations with multiple GraphQL servers and can be used with various frameworks. Envelope acts as the Babel of GraphQL, allowing the use of non-spec features. The Guild offers GraphQL Hive, a service similar to Apollo Studio, and encourages collaboration with other frameworks and languages.
Rock Solid React and GraphQL Apps for People in a Hurry
GraphQL Galaxy 2022GraphQL Galaxy 2022
29 min
Rock Solid React and GraphQL Apps for People in a Hurry
The Talk discusses the challenges and advancements in using GraphQL and React together. It introduces RedwoodJS, a framework that simplifies frontend-backend integration and provides features like code generation, scaffolding, and authentication. The Talk demonstrates how to set up a Redwood project, generate layouts and models, and perform CRUD operations. Redwood automates many GraphQL parts and provides an easy way for developers to get started with GraphQL. It also highlights the benefits of Redwood and suggests checking out RedwoodJS.com for more information.
Adopting GraphQL in an Enterprise
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
Adopting GraphQL in an Enterprise
Today's Talk is about adopting GraphQL in an enterprise. It discusses the challenges of using REST APIs and the benefits of GraphQL. The Talk explores different approaches to adopting GraphQL, including coexistence with REST APIs. It emphasizes the power of GraphQL and provides tips for successful adoption. Overall, the Talk highlights the advantages of GraphQL in terms of efficiency, collaboration, and control over APIs.
Step aside resolvers: a new approach to GraphQL execution
GraphQL Galaxy 2022GraphQL Galaxy 2022
16 min
Step aside resolvers: a new approach to GraphQL execution
GraphQL has made a huge impact in the way we build client applications, websites, and mobile apps. Despite the dominance of resolvers, the GraphQL specification does not mandate their use. Introducing Graphast, a new project that compiles GraphQL operations into execution and output plans, providing advanced optimizations. In GraphFast, instead of resolvers, we have plan resolvers that deal with future data. Graphfast plan resolvers are short and efficient, supporting all features of modern GraphQL.