Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rename-repo): Rename repository to graphql-protect #43

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
armor.yml
protect.yml
operations.json
TODO.md

Expand Down
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ ARG BUILD_DATE
ARG VERSION
ARG REVISION

LABEL org.opencontainers.image.title=go-graphql-armor \
LABEL org.opencontainers.image.title=graphql-protect \
org.opencontainers.image.description="A dead-simple yet highly customizable security sidecar compatible with any HTTP GraphQL Server or Gateway." \
org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.authors=ldebruijn \
org.opencontainers.image.url=https://github.com/ldebruijn/go-graphql-armor \
org.opencontainers.image.documentation=https://github.com/ldebruijn/go-graphql-armor \
org.opencontainers.image.source=https://github.com/ldebruijn/go-graphql-armor \
org.opencontainers.image.url=https://github.com/ldebruijn/graphql-protect \
org.opencontainers.image.documentation=https://github.com/ldebruijn/graphql-protect \
org.opencontainers.image.source=https://github.com/ldebruijn/graphql-protect \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.revision=$REVISION \
org.opencontainers.image.licenses=MIT \
Expand All @@ -26,9 +26,9 @@ USER go

WORKDIR /app

COPY main /app/go-graphql-armor
COPY main /app/graphql-protect

EXPOSE 8080

ENTRYPOINT ["/app/go-graphql-armor"]
ENTRYPOINT ["/app/graphql-protect"]
CMD ["serve"]
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Go GraphQL Armor 🛡️
# GraphQL Protect 🛡️

Go GraphQL Armor is dead-simple yet highly customizable security sidecar compatible with any HTTP GraphQL Server or Gateway.
GraphQL Protect is dead-simple yet highly customizable security sidecar compatible with any HTTP GraphQL Server or Gateway.

![Go GraphQL Armor Banner](docs/assets/banner.jpeg?raw=true)
![GraphQL Protect Banner](docs/assets/banner.jpeg?raw=true)

[![Go](https://github.com/ldebruijn/go-graphql-armor/actions/workflows/go.yml/badge.svg)](https://github.com/ldebruijn/go-graphql-armor/actions/workflows/go.yml)
[![Go](https://github.com/ldebruijn/graphql-protect/actions/workflows/go.yml/badge.svg)](https://github.com/ldebruijn/graphql-protect/actions/workflows/go.yml)

_This is repository inspired by the great work of the similarly named Javascript [GraphQL Armor](https://github.com/Escape-Technologies/graphql-armor) middleware._
_This is repository inspired by the great work of the similarly named Javascript [GraphQL Protect](https://github.com/Escape-Technologies/graphql-armor) middleware._

<!-- TOC -->

Expand All @@ -28,15 +28,15 @@ Curious why you need these features? Check out this [Excellent talk on GraphQL s

## As Container
```shell
docker pull ghcr.io/ldebruijn/go-graphql-armor:latest
docker run -p 8080:8080 -v $(pwd)/armor.yml:/app/armor.yml ghcr.io/ldebruijn/go-graphql-armor:latest
docker pull ghcr.io/ldebruijn/graphql-protect:latest
docker run -p 8080:8080 -v $(pwd)/protect.yml:/app/protect.yml ghcr.io/ldebruijn/graphql-protect:latest
```
Make sure to portforward the right ports for your supplied configuration

## Source code

```shell
git clone [email protected]:ldebruijn/go-graphql-armor.git
git clone [email protected]:ldebruijn/graphql-protect.git
```

Build & Test
Expand All @@ -56,20 +56,20 @@ Run Container

## Configuration

We recommend configuring the binary using a yaml file, place a file called `armor.yml` in the same directory as you're running the binary.
We recommend configuring the binary using a yaml file, place a file called `protect.yml` in the same directory as you're running the binary.

For all the configuration options check out the [Configuration Documentation](docs/configuration.md)

Alternatively go-graphql-armor can be configured using environment variables or command line arguments.
Alternatively graphql-protect can be configured using environment variables or command line arguments.

## Contributing

Ensure you have read the [Contributing Guide](https://github.com/ldebruijn/go-graphql-armor/blob/main/CONTRIBUTING.md) before contributing.
Ensure you have read the [Contributing Guide](https://github.com/ldebruijn/graphql-protect/blob/main/CONTRIBUTING.md) before contributing.

To set up your project, make sure you run the `make dev.setup` script.

```bash
git clone [email protected]:ldebruijn/go-graphql-armor.git
cd go-graphql-armor
git clone [email protected]:ldebruijn/graphql-protect.git
cd graphql-protect
make dev.setup
```
34 changes: 17 additions & 17 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import (
"flag"
"fmt"
"github.com/ardanlabs/conf/v3"
"github.com/ldebruijn/go-graphql-armor/internal/app/config"
"github.com/ldebruijn/go-graphql-armor/internal/business/aliases"
"github.com/ldebruijn/go-graphql-armor/internal/business/batch"
"github.com/ldebruijn/go-graphql-armor/internal/business/block_field_suggestions"
"github.com/ldebruijn/go-graphql-armor/internal/business/enforce_post"
"github.com/ldebruijn/go-graphql-armor/internal/business/gql"
"github.com/ldebruijn/go-graphql-armor/internal/business/max_depth"
middleware2 "github.com/ldebruijn/go-graphql-armor/internal/business/middleware"
"github.com/ldebruijn/go-graphql-armor/internal/business/persisted_operations"
"github.com/ldebruijn/go-graphql-armor/internal/business/proxy"
"github.com/ldebruijn/go-graphql-armor/internal/business/readiness"
"github.com/ldebruijn/go-graphql-armor/internal/business/schema"
"github.com/ldebruijn/go-graphql-armor/internal/business/tokens"
"github.com/ldebruijn/graphql-protect/internal/app/config"
"github.com/ldebruijn/graphql-protect/internal/business/aliases"
"github.com/ldebruijn/graphql-protect/internal/business/batch"
"github.com/ldebruijn/graphql-protect/internal/business/block_field_suggestions"
"github.com/ldebruijn/graphql-protect/internal/business/enforce_post"
"github.com/ldebruijn/graphql-protect/internal/business/gql"
"github.com/ldebruijn/graphql-protect/internal/business/max_depth"
middleware2 "github.com/ldebruijn/graphql-protect/internal/business/middleware"
"github.com/ldebruijn/graphql-protect/internal/business/persisted_operations"
"github.com/ldebruijn/graphql-protect/internal/business/proxy"
"github.com/ldebruijn/graphql-protect/internal/business/readiness"
"github.com/ldebruijn/graphql-protect/internal/business/schema"
"github.com/ldebruijn/graphql-protect/internal/business/tokens"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/vektah/gqlparser/v2/ast"
Expand All @@ -43,7 +43,7 @@ var (
configPath = ""

httpDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "go_graphql_armor",
Namespace: "graphql_protect",
Subsystem: "http",
Name: "duration",
Help: "HTTP duration",
Expand All @@ -52,7 +52,7 @@ var (
)

appInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "go_graphql_armor",
Namespace: "graphql_protect",
Subsystem: "app",
Name: "info",
Help: "Application information",
Expand All @@ -67,7 +67,7 @@ func init() {
}

func main() {
flag.StringVar(&configPath, "f", "./armor.yml", "Defines the path at which the configuration file can be found")
flag.StringVar(&configPath, "f", "./protect.yml", "Defines the path at which the configuration file can be found")
flag.Parse()

log := slog.Default()
Expand Down Expand Up @@ -147,7 +147,7 @@ func run(log *slog.Logger, cfg *config.Config, shutdown chan os.Signal) error {
serverErrors := make(chan error, 1)

go func() {
log.Info("startup", "status", "go-graphql-armor started", "host", api.Addr)
log.Info("startup", "status", "graphql-protect started", "host", api.Addr)

serverErrors <- api.ListenAndServe()
}()
Expand Down
2 changes: 1 addition & 1 deletion cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/ldebruijn/go-graphql-armor/internal/app/config"
"github.com/ldebruijn/graphql-protect/internal/app/config"
"github.com/stretchr/testify/assert"
"io"
log2 "log"
Expand Down
4 changes: 2 additions & 2 deletions docs/block_field_suggestions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Disabling field suggestions prevent the discovery of your GraphQL schema even wh

## Configuration

You can configure `go-graphql-armor` to remove field suggestions from your API.
You can configure `graphql-protect` to remove field suggestions from your API.

```yaml
block_field_suggestions:
Expand All @@ -30,7 +30,7 @@ We scan each `errors[].message` field in the responses and replace the message w
This rule produces metrics to help you gain insights into the behavior of the rule.

```
go_graphql_armor_block_field_suggestions_results{result}
graphql_protect_block_field_suggestions_results{result}
```

| `result` | Description |
Expand Down
18 changes: 9 additions & 9 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Configuration

go-graphql-armor can be configured in various ways, though we recommend configuring it via a `armor.yml`. file
graphql-protect can be configured in various ways, though we recommend configuring it via a `protect.yml`. file

<!-- TOC -->

# armor.yml
# protect.yml

The best way to configure `go-graphql-armor` is by specifying a `armor.yml` in the same directory as you're running the binary.
The best way to configure `graphql-protect` is by specifying a `protect.yml` in the same directory as you're running the binary.

The following outlines the structure of the yaml

Expand Down Expand Up @@ -36,7 +36,7 @@ schema:
# The interval in which the schema file should be reloaded
interval: 5m

# Configures whether we obfuscate graphql-armor validation errors such as max_aliases/max_tokens
# Configures whether we obfuscate graphql-protect validation errors such as max_aliases/max_tokens
# Recommended to set it to 'true' for public environments
obfuscate_validation_errors: false

Expand All @@ -45,7 +45,7 @@ persisted_operations:
enabled: true
# Fail unknown operations, disable this feature to allow unknown operations to reach your GraphQL API
reject_on_failure: true
# Store is the location on local disk where go-graphql-armor can find the persisted operations, it loads any `*.json` files on disk
# Store is the location on local disk where graphql-protect can find the persisted operations, it loads any `*.json` files on disk
store: "./store"
reload:
enabled: true
Expand Down Expand Up @@ -102,7 +102,7 @@ For a more in-depth view of each option visit the accompanying documentation pag

## Environment Variables

If so desired `go-graphql-armor` _can_ be configured using environment variables. write out the full configuration path for each value.
If so desired `graphql-protect` _can_ be configured using environment variables. write out the full configuration path for each value.

For example:

Expand All @@ -114,17 +114,17 @@ PERSISTED_OPERATIONS_STORE_GCP_BUCKET: gs://my-bucket

## Command line arguments

Usage: go-graphql-armor [options] [arguments]
Usage: graphql-protect [options] [arguments]

Examples:

```bash
go-graphql-armor \
graphql-protect \
--persisted-operations-enabled=true \
--web-path=/graphql \
--persisted-operations-store-gcp-bucket=gs://my-bucket
```

## Which configuration is applied?

During startup `go-graphql-armor` will output its applied configuration. It will do this in command line argument format, though it will apply and output configuration from any of these sources.
During startup `graphql-protect` will output its applied configuration. It will do this in command line argument format, though it will apply and output configuration from any of these sources.
4 changes: 2 additions & 2 deletions docs/enforce_post.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A rule that enforces the use of HTTP POST method when sending operations to the upstream GraphQL API.

The rule will block requests with non-POST HTTP methods **only** if the requests contain GraphQL operations. If no operation is found it will still forward the request to the upstream. This is useful for accessing GraphiQL for example through Go GraphQL Armor.
The rule will block requests with non-POST HTTP methods **only** if the requests contain GraphQL operations. If no operation is found it will still forward the request to the upstream. This is useful for accessing GraphiQL for example through GraphQL Protect.


<!-- TOC -->
Expand All @@ -20,7 +20,7 @@ enforce_post:
This rule produces metrics to help you gain insights into the behavior of the rule.

```
go_graphql_armor_enforce_post_count{}
graphql_protect_enforce_post_count{}
```

No metrics are produced when the rule is disabled or never encounters operations through a non-POST request.
4 changes: 2 additions & 2 deletions docs/max_aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Or even worse, uploading a 1 MB image with 1000 aliases in 1 request using the s

## Configuration

You can configure `go-graphql-armor` to limit the maximum number of aliases allowed on an operation.
You can configure `graphql-protect` to limit the maximum number of aliases allowed on an operation.

```yaml
max_aliases:
Expand All @@ -26,7 +26,7 @@ max_aliases:
This rule produces metrics to help you gain insights into the behavior of the rule.

```
go_graphql_armor_max_aliases_results{result}
graphql_protect_max_aliases_results{result}
```


Expand Down
4 changes: 2 additions & 2 deletions docs/max_batch.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This can be useful to prevent DDoS attacks, Heap Overflows or Server overload.

## Configuration

You can configure `go-graphql-armor` to limit the maximum number of operations allowed inside a batch request.
You can configure `graphql-protect` to limit the maximum number of operations allowed inside a batch request.

```yaml
max_batch:
Expand All @@ -24,7 +24,7 @@ max_batch:
This rule produces metrics to help you gain insights into the behavior of the rule.

```
go_graphql_armor_max_batch_results{result}
graphql_protect_max_batch_results{result}
```


Expand Down
4 changes: 2 additions & 2 deletions docs/max_depth.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Restricting the maximum depth of operations that are allowed within a single ope

## Configuration

You can configure `go-graphql-armor` to limit the maximum depth on an operation.
You can configure `graphql-protect` to limit the maximum depth on an operation.

```yaml
max_depth:
Expand All @@ -23,7 +23,7 @@ max_depth:
This rule produces metrics to help you gain insights into the behavior of the rule.

```
go_graphql_armor_max_depth_results{result}
graphql_protect_max_depth_results{result}
```


Expand Down
4 changes: 2 additions & 2 deletions docs/max_tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This can be useful to prevent DDoS attacks, Heap Overflows or Server overload.

## Configuration

You can configure `go-graphql-armor` to limit the maximum number of tokens allowed on an operation.
You can configure `graphql-protect` to limit the maximum number of tokens allowed on an operation.

```yaml
max_tokens:
Expand All @@ -24,7 +24,7 @@ max_tokens:
This rule produces metrics to help you gain insights into the behavior of the rule.

```
go_graphql_armor_max_tokens_results{result}
graphql_protect_max_tokens_results{result}
```


Expand Down
Loading
Loading