phase 1 core platform
Milestone 1.1.3: Auth Token Validation — complete.
Milestone 1.1.3: Auth Token Validation
Status: Complete
Goal: 1.1 Persistence and auth data plane
Summary
Implement auth service token validation: lookup PAT by prefix/hash, Argon2id verify, return permission bitmap and org context via gRPC. Fail closed on all errors.
Branch
feature/m1-1-3-auth-validate-token (merged)
PR title (example)
feat(auth): validate PAT against Postgres (m1.1.3)
Estimated effort
4–5 days
Prerequisites
Tasks
- Add gRPC server to
services/auth(internal/grpc/) - Config: gRPC listen port, Postgres pool
- Repository layer:
tokenslookup by prefix (never log raw token) - Service layer: Argon2id verify; map to
ValidateTokenResponse - Lookup uses
app.is_service_accountper ADR-0007 (org context returned in response, not set on session during validate) - Wire gRPC + HTTP on shared process
- Unit tests: hash verify, invalid token, revoked token
- Integration tests: seed two orgs; cross-tenant cases
- Update
services/auth/README.mdwith run instructions and grpcurl examples - Metrics: validate latency histogram, error counter (low cardinality)
Files affected
| Path | Action |
|---|---|
services/auth/internal/config/ | Extend |
services/auth/internal/repository/ | Add |
services/auth/internal/token/ | Add |
services/auth/internal/grpc/ | Add |
services/auth/cmd/auth/main.go | Wire gRPC |
services/auth/.env.example | gRPC port, pool size |
go.mod | gRPC, pq, argon2, uuid |
docs/ENVIRONMENT_VARIABLES.md | Auth service vars |
docs/adr/ADR-0007-auth-token-validation.md | Add |
Testing requirements
- Unit: Argon2id, permission mapping, error codes
- Integration: real Postgres + migrations; cross-tenant
- Contract: proto round-trip via integration + existing proto-contract CI
Documentation updates
- services/auth/README.md
- ENVIRONMENT_VARIABLES.md
- ADR-0007
Definition of done
-
ValidateTokenreturns success for valid seeded token in dev DB - Invalid/revoked/missing token returns unauthenticated without leaking existence
- No raw tokens in logs
-
go test ./services/auth/...passes including integration -
/healthand/readystill correct
Merge
Squash merge PR #16 → main at 5691dd8.
Risks
| Risk | Mitigation |
|---|---|
| Timing attacks on verify | Use library primitives; no custom crypto |
| Connection pool without org context | Service-account lookup only in v1; org_id in gRPC response for consumers |
Edit on GitHub
Last updated on