Skip to content

feat: Enhance gin security and configuration options#18

Merged
timokoessler merged 5 commits intomainfrom
gin-security
Mar 22, 2026
Merged

feat: Enhance gin security and configuration options#18
timokoessler merged 5 commits intomainfrom
gin-security

Conversation

@timokoessler
Copy link
Member

Type of change

  • 🐛 Bug fix
  • 🚀 New feature
  • ❓ Other (please specify)

Description

  • The following config options are added: APP_URL, HOST (optional), TRUSTED_PROXIES
  • Adds security headers and disables search indexing
  • Implements a CSRF protection based on the origin header
  • Fixes the Justfile not working on Windows

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces additional runtime configuration and security hardening for the Gin-based Hub server, while also preventing search indexing and improving Windows compatibility for backend build tooling.

Changes:

  • Add new Hub config options (APP_URL, HOST, TRUSTED_PROXIES) and wire them into server startup.
  • Add security-related middleware (security headers + Origin-based CSRF protection).
  • Disable search indexing (robots + headers) and update the backend Justfile for Windows support.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
frontend/public/robots.txt Blocks crawlers via Disallow (and adds a nonstandard Noindex directive).
backend/internal/hub/url.go Adds APP_URL parsing/validation used for Origin checks.
backend/internal/hub/server.go Extends Hub config and applies trusted proxies + new security middleware.
backend/internal/hub/middleware/security.go Adds common security headers (CSP, clickjacking protection, etc.).
backend/internal/hub/middleware/csrf.go Adds Origin validation middleware for non-safe HTTP methods.
backend/cmd/hub/main.go Updates CLI to handle DefaultConfig() errors.
backend/Justfile Adds Windows shell support and refactors env var handling for CGO.
.gitignore Ignores a local Claude settings file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@timokoessler timokoessler merged commit 0ccbbbd into main Mar 22, 2026
2 checks passed
@timokoessler timokoessler deleted the gin-security branch March 22, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants