Skip to content

Content Security Policy Report Manager. Backend (REST API) written in Go using Fiber. Work in progress.

License

Notifications You must be signed in to change notification settings

AlfredoRamos/csp-reporter-backend

Repository files navigation

About

Backend for the CSP Reporter REST API using Fiber, GORM, Asynq and Sentry.

Setup

Requirements

VSCode extensions

Install dependencies

go mod tidy

Setup live-reload

go install github.com/air-verse/air@latest

Setup linters

go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
go install golang.org/x/tools/cmd/deadcode@latest

Generate key pairs

mkdir -p keys
go install github.com/go-jose/go-jose/v4/jose-util@latest

Sign (JWS)

(cd keys && jose-util generate-key --use sig --alg EdDSA && mv jwk-sig-*-priv.json signing-private.json && mv jwk-sig-*-pub.json signing-public.json)

Encrypt (JWE)

(cd keys && jose-util generate-key --use enc --alg ECDH-ES+A256KW && mv jwk-enc-*-priv.json encryption-private.json && mv jwk-enc-*-pub.json encryption-public.json)

Run app

Production

go build -ldflags='-s -w' -a -installsuffix cgo -o ./bin/csp-reporter .
chmod +x csp-reporter
csp-reporter

Development

air

Linters

golangci-lint run ./...
govulncheck -show=traces ./...
deadcode -test ./...

Redis

Enter CLI

redis-cli

List all revoked access tokens

SMEMBERS access-tokens:revoked

Manually add revoked access token

SADD access-tokens:revoked "<JTI>"

Manually remove revoked access token

SREM access-tokens:revoked "<JTI>"

For more information, refer to the official documentation for sets:

Queue

Monitoring

Web

Download latest version from releases.

./asynqmon --max-payload-length 5000

Command line

go install github.com/hibiken/asynq/tools/asynq@latest
asynq dash

About

Content Security Policy Report Manager. Backend (REST API) written in Go using Fiber. Work in progress.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published