Repository navigation
feat(ratelimit): add authentication rate limiting #8
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
Changes from all commits
c83b7e7
e60c4e9
354eef1
4afd40c
14bd7b0
c4ce57a
3049597
845f96c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ tasks/ | |
| .pi/ | ||
| .scannerwork/ | ||
| auth-go | ||
| coverage/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,15 +8,21 @@ MIGRATE_DIR ?= migrations | |
| MIGRATE ?= migrate | ||
| SWAG_VERSION ?= v1.16.6 | ||
| REDOCLY_VERSION ?= v2.43.1 | ||
| COVERAGE_DIR ?= coverage | ||
| COVERAGE_FILE ?= $(COVERAGE_DIR)/coverage.out | ||
|
Comment on lines
+11
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Create the parent directory for
Create the configured file's parent directory before running Proposed fix coverage: migrate-up
- mkdir -p "$(COVERAGE_DIR)"
+ mkdir -p "$(COVERAGE_DIR)" "$(dir $(COVERAGE_FILE))"
go test -tags=integration ./... -covermode=atomic -coverprofile="$(COVERAGE_FILE)"Also applies to: 22-24 🤖 Prompt for AI Agents |
||
|
|
||
| .PHONY: build test integration vet run sqlc swagger swagger-validate migrate-up migrate-down migrate-down-1 fmt | ||
| .PHONY: build test coverage integration vet run sqlc swagger swagger-validate migrate-up migrate-down migrate-down-1 fmt | ||
|
|
||
| build: | ||
| go build ./cmd/auth-go | ||
|
|
||
| test: | ||
| go test ./... | ||
|
|
||
| coverage: migrate-up | ||
| mkdir -p "$(COVERAGE_DIR)" | ||
| go test -tags=integration ./... -covermode=atomic -coverprofile="$(COVERAGE_FILE)" | ||
|
|
||
| integration: | ||
| $(MAKE) migrate-up | ||
| go test -tags=integration ./... | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,15 @@ services: | |||||||||||||||||||||||||||||||||||||
| timeout: 3s | ||||||||||||||||||||||||||||||||||||||
| retries: 5 | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| redis: | ||||||||||||||||||||||||||||||||||||||
| image: redis:7-alpine | ||||||||||||||||||||||||||||||||||||||
| container_name: auth-go-redis | ||||||||||||||||||||||||||||||||||||||
| healthcheck: | ||||||||||||||||||||||||||||||||||||||
| test: ["CMD", "redis-cli", "ping"] | ||||||||||||||||||||||||||||||||||||||
| interval: 3s | ||||||||||||||||||||||||||||||||||||||
| timeout: 3s | ||||||||||||||||||||||||||||||||||||||
| retries: 5 | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+17
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win Expose Redis for host-side integration tests.
Proposed fix redis:
image: redis:7-alpine
container_name: auth-go-redis
+ ports:
+ - "6379:6379"
healthcheck:📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| auth-go: | ||||||||||||||||||||||||||||||||||||||
| image: auth-go:tidy | ||||||||||||||||||||||||||||||||||||||
| container_name: auth-go | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -24,10 +33,10 @@ services: | |||||||||||||||||||||||||||||||||||||
| - "8080:8080" | ||||||||||||||||||||||||||||||||||||||
| env_file: | ||||||||||||||||||||||||||||||||||||||
| - .env.prod | ||||||||||||||||||||||||||||||||||||||
| environment: | ||||||||||||||||||||||||||||||||||||||
| DATABASE_URL: postgres://postgres:postgres@db:5432/auth_go?sslmode=disable | ||||||||||||||||||||||||||||||||||||||
| extra_hosts: | ||||||||||||||||||||||||||||||||||||||
| - "host.docker.internal:host-gateway" | ||||||||||||||||||||||||||||||||||||||
| depends_on: | ||||||||||||||||||||||||||||||||||||||
| db: | ||||||||||||||||||||||||||||||||||||||
| condition: service_healthy | ||||||||||||||||||||||||||||||||||||||
| redis: | ||||||||||||||||||||||||||||||||||||||
| condition: service_healthy | ||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: Jonathan0823/auth-go
Length of output: 7039
🏁 Script executed:
Repository: Jonathan0823/auth-go
Length of output: 249
🏁 Script executed:
Repository: Jonathan0823/auth-go
Length of output: 5230
🏁 Script executed:
Repository: Jonathan0823/auth-go
Length of output: 7537
Reject the placeholder rate-limit HMAC key in production.
RATE_LIMIT_KEYis loaded as-is and only fails validation when empty, sochange-me-rate-limit-keycan pass startup validation if copied into production. Add a production validation rule that rejects the placeholder and requires a deployment-specific random value.🤖 Prompt for AI Agents