Skip to content

Conversation

metachris
Copy link
Contributor

📝 Summary

This PR adds mandatory authentication to Admin API.

It can be disabled with --disable-admin-auth.

New flags / env vars:

&cli.StringFlag{
Name: "admin-basic-user",
Value: "admin",
Usage: "username for admin Basic Auth",
EnvVars: []string{"ADMIN_BASIC_USER"},
},
&cli.StringFlag{
Name: "admin-basic-password-bcrypt",
Value: "",
Usage: "bcrypt hash of admin password (required to enable admin API, generate with `htpasswd -nbBC 12 admin 'secret' | cut -d: -f2`)",
EnvVars: []string{"ADMIN_BASIC_PASSWORD_BCRYPT"},
},
&cli.BoolFlag{
Name: "disable-admin-auth",
Usage: "disable admin Basic Auth (local development only)",
EnvVars: []string{"DISABLE_ADMIN_AUTH"},
},
&cli.Int64Flag{

Note

This code has been generated by OpenAI Codex with only minimal support. The changes were working mostly on first attempt, just the htpasswd example was initially wrong.


✅ I have run these commands

  • make lint
  • make test
  • go mod tidy

@metachris metachris requested review from Copilot, TymKh and ilyaluk and removed request for Copilot September 4, 2025 10:17
Copy link
Contributor

@Copilot 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 implements mandatory HTTP Basic Authentication for the Admin API to enhance security. The authentication can be disabled for local development using a flag.

  • Adds HTTP Basic Auth middleware with bcrypt password verification
  • Provides configuration flags for username, password hash, and auth disabling
  • Updates documentation and development tools to support authenticated API calls

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
httpserver/server.go Implements basic auth middleware with bcrypt password verification
httpserver/auth_middleware_test.go Comprehensive test suite for authentication middleware
cmd/httpserver/main.go Adds CLI flags and configuration for admin authentication
docker/docker-compose.yaml Disables auth for local development environment
README.md Documents authentication setup and usage examples
Makefile Updates curl commands to support authenticated requests
adapters/database/service.go Minor cleanup of database connection configuration
AGENTS.md New development guidelines document
.golangci.yaml Updates linter configuration
.github/workflows/checks.yml Updates golangci-lint version

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@metachris metachris requested a review from shashial September 4, 2025 16:30
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