Skip to content

Move authentication from UI to service layer with selective gRPC protection#50

Merged
dkrizic merged 5 commits intomainfrom
copilot/improve-authentication-service
Jan 26, 2026
Merged

Move authentication from UI to service layer with selective gRPC protection#50
dkrizic merged 5 commits intomainfrom
copilot/improve-authentication-service

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 26, 2026

Authentication was UI-only. Now implemented at service layer with selective protection: Feature and Workload services require auth, Health and Meta remain public.

Implementation

gRPC Authentication

  • Basic Auth via metadata (username:password base64-encoded in authorization header)
  • Selective unary interceptor protects only Feature/Workload services
  • Meta service extended with authenticationRequired boolean field

UI Changes

  • Login credentials now dual-purpose: UI session + backend gRPC auth
  • Queries Meta service on startup to auto-enable login if backend requires it
  • Credentials stored per-session, attached to outgoing gRPC contexts via PerRPCCredentials

CLI Changes

  • USERNAME and PASSWORD flags/env vars added
  • Auto-injects Basic Auth metadata when credentials provided

Helm Configuration

  • Moved authentication from ui.authentication to service.authentication
  • Service secret created for password (auto-generates 24-char alphanumeric if empty)
  • CLI inherits credentials from service config via shared secret mount

Example Usage

# values.yaml
service:
  authentication:
    enabled: true
    username: admin
    password: ""  # auto-generated on first install
# CLI usage
USERNAME=admin PASSWORD=secret feature-cli get mykey
// gRPC metadata structure (service-side validation)
md, _ := metadata.FromIncomingContext(ctx)
authHeaders := md.Get("authorization")  // ["Basic YWRtaW46c2VjcmV0"]

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • invalid
    • Triggering command: /tmp/go-build3808816188/b430/delete.test /tmp/go-build3808816188/b430/delete.test -test.testlogfile=/tmp/go-build3808816188/b430/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build696783221/b064/vet.cfg /sdk@v1.39.0/tra-errorsas mpile ux-amd64/pkg/tool/linux_amd64/vet -I d/authorization/-atomic -I ux-amd64/pkg/too-buildtags 7272�� g_.a pi@v0.35.0/autho-ifaceassert ux-amd64/pkg/tool/linux_amd64/vet --gdwarf-5 ce/internal/obse-atomic mpile ux-amd64/pkg/too-buildtags (dns block)
    • Triggering command: /tmp/go-build3808816188/b433/get.test /tmp/go-build3808816188/b433/get.test -test.testlogfile=/tmp/go-build3808816188/b433/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build696783221/b311/vet.cfg /sdk@v1.39.0/tra-errorsas /sdk@v1.39.0/tra-ifaceassert ux-amd64/pkg/tool/linux_amd64/vet -c ions/meta/v1 /tmp/go-build367-bool ux-amd64/pkg/too-buildtags -I g_.a pi@v0.35.0/certi-ifaceassert ux-amd64/pkg/tool/linux_amd64/vet --gdwarf-5 --64 mpile ux-amd64/pkg/too-buildtags (dns block)
    • Triggering command: /tmp/go-build3808816188/b436/getall.test /tmp/go-build3808816188/b436/getall.test -test.testlogfile=/tmp/go-build3808816188/b436/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build696783221/b339/vet.cfg o/otlp@v1.9.0/co-errorsas o/otlp@v1.9.0/co-ifaceassert ux-amd64/pkg/tool/linux_amd64/vet . ions/admissionre-atomic --64 ux-amd64/pkg/too-buildtags pkg/�� g_.a pi@v0.35.0/coord-ifaceassert ux-amd64/pkg/tool/linux_amd64/vet --gdwarf-5 ce/service/persi-atomic m ux-amd64/pkg/too-buildtags (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve authentication</issue_title>
<issue_description>Currently the authentication is only on the /ui part of the application. I would prefer to have the /service do the actual authentication. In the Helm chart I would like to set username and password on the /service part like this:

service:
  authentication:
    enabled: false # Enable authentication
    username: admin
    password: "" # If empty, a random password will be generated

So basically moving from UI to service. Only the grpc services

  • Feature
  • Workload

are password protected, the others like Health and meta not. The UI should receive two new parameters:

  • username (USERNAME)
  • password (PASSWORD)

In case of a Helm deployment those values should be repopulated in the configmap (USERNAME) and a new secret (PASSWORD). The UI should optimally stay the same. Each request from /cli and /ui to the backend then contains the username and password. I don't know hot to optimally forward this information when using gRPC, either some metadata or the proto should be extended. I would prefer not to touch proto.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits January 26, 2026 11:21
Co-authored-by: dkrizic <1181349+dkrizic@users.noreply.github.com>
Co-authored-by: dkrizic <1181349+dkrizic@users.noreply.github.com>
Co-authored-by: dkrizic <1181349+dkrizic@users.noreply.github.com>
…hing

Co-authored-by: dkrizic <1181349+dkrizic@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve authentication by moving it to service layer Move authentication from UI to service layer with selective gRPC protection Jan 26, 2026
Copilot AI requested a review from dkrizic January 26, 2026 11:30
@dkrizic dkrizic marked this pull request as ready for review January 26, 2026 11:37
@dkrizic dkrizic merged commit 98ef666 into main Jan 26, 2026
3 checks passed
@dkrizic dkrizic deleted the copilot/improve-authentication-service branch January 26, 2026 11:37
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.

Improve authentication

2 participants