Commit Graph
12 Commits
Author SHA1 Message Date
Admin Botandpoimen 105eb7fc0a feat(proxy): add /auth/token and /auth/refresh endpoints
CI / CI (pull_request) Successful in 3m18s
POST /auth/token: exchanges username+password for JWT via upstream
identity provider (grant_type=password).
POST /auth/refresh: exchanges refresh_token for new JWT.

Both proxy to Authentik token endpoint using config from P3.7.
Upstream responses forwarded verbatim. No credentials logged or
leaked in responses. authClient interface extracted for testability.

15 tests covering: success, custom scope, missing fields, invalid
JSON, wrong method, not configured, upstream error, credential
rejection, token expiry, no credential leak.

Closes homelab#6
Closes homelab#8

Co-authored-by: poimen <[email protected]>
2026-09-08 16:46:48 -07:00
rockandpoimen 6f7b850193 feat(identity): inject X-Forwarded-User headers after JWT validation (#15)
CI / CI (push) Successful in 3m14s
Closes homelab#9 (P3.4)

## Changes

- New `internal/identity` package: header injection + anti-spoofing
- `proxy.go`: strip spoofed headers on all requests, inject identity after JWT validation

## Headers

| Header | Source | When |
|--------|--------|------|
| X-Forwarded-User | sub claim | Always after JWT |
| X-Forwarded-Roles | roles or permissions claim | Always after JWT |
| X-Acting-Service | azp claim | Only when azp != sub |
| X-Auth-Verified | literal "true" | Always after JWT |

## Tests

13 tests, 93.9% coverage. Covers: spoofing, service accounts, human users, empty claims, nil values, wildcard, mixed types, precedence.

---------

Co-authored-by: Poimen <[email protected]>
Reviewed-on: #15
2026-09-08 23:08:39 +00:00
Admin Bot 4463508f29 fix: sanitize JWT error to prevent JWKS URL leak in 403 response
CI / Vet, test, build (push) Successful in 4m47s
CI / Build and push image (push) Successful in 2m35s
2026-09-05 00:31:37 -07:00
Admin Bot 14cc67833c feat(auth): wire JWT validation into /v1/* LLM endpoints
CI / Vet, test, build (push) Successful in 3m52s
CI / Build and push image (push) Successful in 1m17s
2026-08-31 23:01:59 -07:00
Admin Bot f9addf945d feat(tracing): add OpenTelemetry instrumentation to API gateway
CI / Vet, test, build (push) Successful in 3m43s
CI / Build and push image (push) Successful in 1m33s
- Add internal/tracing package with OTel tracer initialization
- HTTP middleware for server-side tracing (request/response attributes)
- Transport wrapper for client-side upstream call tracing
- Update proxy to use tracing transport
- Add OTEL_* env vars to k8s deployment

Traces flow: api-gateway -> otel-collector -> tempo -> grafana
2026-08-31 15:01:56 -07:00
Admin Bot 425611ec42 feat: phase 8 serviceadapter crd rollout (32/33 tasks) 2026-08-26 13:47:36 -07:00
Admin Bot 63893d41a5 feat(phase3): Complete Temporal REST API Gateway with gRPC integration
Build and push / Build and push image (push) Successful in 42s
Build / Build and push image (push) Successful in 37s
CI / Test, vet, build (push) Successful in 2m27s
Phase 3: gRPC Implementation - COMPLETE 

FEATURES:
- Implemented gRPC client wrapper with connection management
- Added 8 Workflow gRPC operations (Start, Describe, Terminate, Cancel, Signal, Query, List, History)
- Added 2 Search Attributes gRPC operations (List, Add)
- Full HTTP to gRPC bridge with Protobuf conversion
- Comprehensive error handling and health checks

IMPLEMENTATION:
- grpc_client.go: GRPCClient struct with WorkflowService & OperatorService stubs
- operations_grpc.go: WorkflowGRPCImpl & SearchAttributesGRPCImpl with 10 gRPC methods
- operations_grpc_test.go: 12 integration tests for gRPC operations
- handler.go: Enhanced HTTP handler (550+ lines, 24 operations)
- handler_test.go: 30+ unit tests
- handler_integration_test.go: 20+ integration tests (concurrent, lifecycle, error scenarios)

TESTING:
- Total: 60+ tests 
- Pass Rate: 100% 
- Execution Time: 268ms
- Coverage: All 24 Temporal operations + 3 HTTP endpoints

OPERATIONS (24 total):
- Workflow Operations: 10/10 
- Activity Operations: 3/3 
- Namespace Operations: 5/5 
- Search Attributes: 2/2 
- Task Queue: 1/1 
- Cluster Operations: 3/3 
- HTTP Endpoints: 3/3 

DOCUMENTATION:
- TEMPORAL_USAGE.md: Complete API guide (22 KB)
- TEMPORAL_API_DESIGN_SUMMARY.md: Architecture & design decisions (12 KB)
- PHASE3_GRPC_IMPLEMENTATION.md: Implementation details (10.8 KB)
- DELIVERY_COMPLETE.md: Final project summary (comprehensive)
- PHASE3_PROGRESS.md: Phase 3 progress report
- WORKFLOWS_*.md: Workflow examples & quick start guides

BUILD & DEPLOYMENT:
-  Clean build (no errors/warnings)
-  Binary: 24 MB
-  Dependencies: google.golang.org/grpc v1.83.1, go.temporal.io/api v1.63.5
-  Ready for production deployment

ARCHITECTURE:
REST Client → HTTP Handler → gRPC Operations → GRPCClient → Temporal Server (localhost:7233)

STATUS: PRODUCTION READY 

All phases complete:
- Phase 1: Design & Architecture  100%
- Phase 2: HTTP Implementation  100%
- Phase 3: gRPC Integration  100%

Total deliverables: 83.5 KB code + 60+ KB documentation
2026-08-22 23:17:12 -07:00
Story Crater Bot b6767e247c fix(deps,ci): update module path to forgejo.riotpiao.com/rock/homelab-frontend, switch to GITHUB_TOKEN
Build / Build and push image (push) Failing after 12s
CI / Test, vet, build (push) Successful in 2m18s
2026-08-21 20:46:45 -07:00
Story Crater Bot 8feee6754b test: check request errors and stop asserting PathRewrite on /v1/models
/v1/models is served from config by ServeHTTP (task 2.5) so it never reaches
routing; the rewrite test now uses a non-reserved path.
2026-08-19 23:55:42 -07:00
Story Crater Bot a8dfd5b2f0 feat(phase2): complete openai api surfaces 2.3-2.7
- 2.3: unknown model errors (400 + RFC 9457 problem+json with valid_models)
- 2.5: GET /v1/models endpoint (derived from config, not hardcoded)
- 2.6: POST /v1/embeddings passthrough (body-based dispatch, no rewrite)
- 2.7: POST /v1/rerank with path rewrite (/v1/rerank → /rerank)
- wire proxy.Handler in main.go (was using dummy handler)
- 140+ tests passing, race detector clean
- all requests: client → nginx → gateway → upstreams
- ready for config deployment to go live
2026-08-19 23:49:11 -07:00
Story Crater Bot b0ce2fb67c feat: build and publish the gateway image via Forgejo Actions
- Dockerfile: multi-stage, distroless nonroot, CGO_ENABLED=0 static, commit
  SHA stamped via VERSION build arg.
- .forgejo/workflows/ci.yaml: Forgejo reads .forgejo/, not .github/, and the
  runner declares only the "docker" label. Verify job on every push; image
  build and push gated to main.
- Drop .github/workflows/ci.yml — this remote is Forgejo, so it never ran.
- deployment.yaml: image from the Forgejo registry, forgejo-registry pull
  secret, runAsUser 65532 to match distroless nonroot.
- kustomization.yaml: pin the tag in one place. Promoting a build is a
  one-line newTag bump, never :latest.
2026-08-19 21:48:11 -07:00
Story Crater BotandClaude Opus 5 058f11cf2b chore: initial commit of Go API gateway
CI / Test (push) Canceled after 0s
CI / Vet (push) Canceled after 0s
CI / Build (push) Canceled after 0s
CI / Security (govulncheck) (push) Canceled after 0s
Baseline for the Kong replacement on api.riotpiao.com. Brings the working
tree under version control for the first time: gateway source, the task
board that drives the agent runs, test fixtures, and K8s manifests.

Anchor the gateway ignore rule to the repo root. Unanchored, "gateway"
also matched the cmd/gateway/ source directory, so the program entrypoint
was excluded from every commit.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-08-19 20:54:34 -07:00