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

Update crypto lib and pre commit hook #26

Merged
merged 6 commits into from
Dec 23, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ todo.md
hasura/hasura
hasura/hasura.exe
img/
.venv
68 changes: 7 additions & 61 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-merge-conflict
- id: check-added-large-files

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
hooks:
- id: markdownlint

- repo: https://github.com/Agilicus/pre-commit-hook-k8svalidate.git
rev: v0.2.0
Expand All @@ -21,64 +15,16 @@ repos:
args: [--exclude, '**/*.patch.yaml']
files: .yml$

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt

- repo: https://github.com/tekwizely/pre-commit-golang
rev: master
rev: v1.0.0-rc.1
hooks:
- id: go-build-mod
- id: go-build-pkg
- id: go-build-repo-mod
- id: go-build-repo-pkg
- id: go-mod-tidy
- id: go-mod-tidy-repo
- id: go-sec-mod
- id: go-sec-pkg
- id: go-sec-repo-mod
- id: go-sec-repo-pkg
- id: go-staticcheck-mod
- id: go-staticcheck-pkg
- id: go-staticcheck-repo-mod
- id: go-staticcheck-repo-pkg
- id: go-structslop-mod
- id: go-structslop-pkg
- id: go-structslop-repo-mod
- id: go-structslop-repo-pkg
- id: go-fmt
- id: go-fmt-repo
- id: go-fumpt # replaces go-fmt
- id: go-fumpt-repo # replaces go-fmt-repo
- id: go-imports # replaces go-fmt
- id: go-imports-repo # replaces go-fmt-repo
- id: go-returns # replaces go-imports & go-fmt
- id: go-returns-repo # replaces go-imports-repo & go-fmt-repo
#
# Style Checkers
#
- id: go-lint
- id: go-critic
#
# GolangCI-Lint
# - Fast Multi-Linter
# - Can be configured to replace MOST other hooks
# - Supports repo config file for configuration
# - https://github.com/golangci/golangci-lint
#
- id: golangci-lint
- id: golangci-lint-mod
- id: golangci-lint-pkg
- id: golangci-lint-repo-mod
- id: golangci-lint-repo-pkg
#
# Invoking Custom Go Tools
# - Configured *entirely* through the `args` attribute, ie:
# args: [ go, test, ./... ]
# - Use arg `--hook:error-on-output` to indicate that any output from the tool
# should be treated as an error.
# - Use the `name` attribute to provide better messaging when the hook runs
# - Use the `alias` attribute to be able to invoke your hook via `pre-commit run`
#
- id: my-cmd
- id: my-cmd-mod
- id: my-cmd-pkg
- id: my-cmd-repo
- id: my-cmd-repo-mod
- id: my-cmd-repo-pkg
48 changes: 48 additions & 0 deletions dev_compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---

services:
postgres:
image: postgres
restart: no
ports:
- 5432:5432
volumes:
- hasura_ci_db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgrespassword

graphql-engine:
image: hasura/graphql-engine:v2.36.1
restart: no
ports:
- 8080:8080
depends_on:
- postgres
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
HASURA_GRAPHQL_ENABLE_CONSOLE: 'true'
HASURA_GRAPHQL_ADMIN_SECRET: my-secret
HASURA_GRAPHQL_JWT_SECRET: '{ "type": "HS256", "key": "this-is-a-generic-HS256-secret-key-and-you-should-really-change-it" }'
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: anonymous
JWT_URL: http://hasura-jwt:3000

hasura-jwt:
build:
context: ./src
dockerfile: Dockerfile
restart: no
ports:
- 3000:3000
environment:
JWT_KEY: this-is-a-generic-HS256-secret-key-and-you-should-really-change-it
HASURA_SECRET: my-secret
APP_URL: http://localhost:3000
EMAIL_VERIFICATION: true
SMTP_HOST: mail.example.com
SMTP_PORT: '587'
SMTP_USER: user@example.com
SMTP_PASSWORD: user_password


volumes:
hasura_ci_db_data:
1 change: 0 additions & 1 deletion hasura/metadata/actions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ type CreateUserOutput {
type JsonWebToken {
Token: String!
}

2 changes: 1 addition & 1 deletion hasura/migrations/default/1707348091521_init/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SET check_function_bodies = false;
CREATE FUNCTION public.create_assigned_user_role() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
BEGIN
INSERT INTO assigned_user_roles (user_id, user_role_name)
VALUES (NEW.id, 'user');
RETURN NEW;
Expand Down
2 changes: 1 addition & 1 deletion src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module hasura-jwt

go 1.23.0

require golang.org/x/crypto v0.26.0
require golang.org/x/crypto v0.31.0

require github.com/golang-jwt/jwt/v5 v5.2.1
4 changes: 2 additions & 2 deletions src/go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
Loading