fix(security): OWASP P0 hardening — gRPC auth, upload safety, BOLA, OAuth redirects#36
Draft
abbasajorlou1371 wants to merge 1 commit into
Draft
fix(security): OWASP P0 hardening — gRPC auth, upload safety, BOLA, OAuth redirects#36abbasajorlou1371 wants to merge 1 commit into
abbasajorlou1371 wants to merge 1 commit into
Conversation
- Require INTERNAL_SERVICE_SECRET for wallet mutation gRPC RPCs - Add gRPC auth interceptors to all services with fail-fast dial - Protect /api/upload with auth middleware; harden upload path handling - Fix UpdateProfile BOLA by binding user ID from auth context - Validate OAuth redirect origins and deliver tokens in URL fragments - Stop publishing gRPC/storage HTTP ports on Docker host Co-authored-by: abbasajorlou1371 <abbasajorlou1371@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the P0 items from the OWASP security audit. Tracked follow-ups remain open for P1/P2 work (see issues #23–#35).
Closes #17
Closes #18
Closes #19
Closes #20
Closes #21
Closes #22
Changes
1. Wallet RPC protection (#17)
shouldSkipAuthINTERNAL_SERVICE_SECRETmetadata validation for internal-only wallet mutationsGetWalletnow requires auth + ownership (or internal service credentials)2. gRPC authentication on all services (#18)
auth.UnaryServerInterceptorto auth, commercial, features, financial, support, storage, notifications, dynasty, levels, social, calendar, and training servicesLocalTokenValidator3. Upload hardening (#19)
/api/uploadnow requires authentication at grpc-gatewayupload_pathallowlist (profile,kyc,tickets,notes,reports)..traversal in paths andupload_id4. UpdateProfile BOLA fix (#20)
user_idfrom auth context (ignores client-supplieduser_id)5. OAuth redirect safety (#21)
redirect_to/back_urlagainst allowlisted origins (FRONT_END_URL,APP_URL,ALLOWED_REDIRECT_ORIGINS)6. Docker network exposure (#22)
INTERNAL_SERVICE_SECRETto docker-compose service environmentsConfiguration
Set in each environment (see
config.env.sampleupdates):Breaking changes
#token=...) instead of query (?token=...). Update the SPA to readwindow.location.hash.:8000./api/uploadrequires authentication;upload_pathmust be an allowlisted subdirectory.Tests
shared/pkg/auth— internal service auth testsservices/auth-service/internal/auth— redirect allowlist testsservices/storage-service/internal/service— upload path traversal testscommercial-service/internal/handler— existing handler tests passRelated issues (not in this PR)