Add OpenFGC Portal Backend#39
Merged
hasithakn merged 163 commits intoJul 6, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 32 out of 33 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
.github/workflows/portal-backend-ci.yml:45
- The workflow pins
golangci-lint-actionto installversion: v2.12.2. If that golangci-lint version doesn’t exist, CI will fail at linting. Consider using a known golangci-lint release (and matching the version used inportal/backend/Taskfile.yml).
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
working-directory: portal/backend
version: v2.12.2
portal/backend/internal/proxy/service.go:325
setTrustedHeadersalways injectsorg-id/TPP-client-idfrom placeholder config when present, even when placeholder identity mode is disabled. This makes it easy to accidentally run with static trusted headers (including in production if misconfigured), undermining the header-trust boundary. Consider only setting these placeholder headers when placeholder mode is enabled (or when an authenticated identity context is available).
func (s *Service) setTrustedHeaders(incoming *http.Request, outgoing *http.Request, trustedClientID string) {
if s.cfg.PlaceholderOrgID != "" {
outgoing.Header.Set("org-id", s.cfg.PlaceholderOrgID)
}
if trustedClientID != "" {
outgoing.Header.Set("TPP-client-id", trustedClientID)
} else if s.cfg.PlaceholderClientID != "" {
outgoing.Header.Set("TPP-client-id", s.cfg.PlaceholderClientID)
}
- Correlation ID fallback now uses UnixNano + pid + atomic - Client-supplied forwarding headers are stripped - CORS allowed origins now reject path, query string, and fragment.
- handler.go: MeConsentApprove now routes ErrUpstreamResponseTooLarge through writeProxyError, so it returns the proper 502 UPSTREAM_RESPONSE_TOO_LARGE instead of 400 INVALID_PAYLOAD. - service.go: proxy header filtering now strips Cookie and Authorization.
- Moved `golangci-lint` before tests in `.github/workflows/portal-backend-ci.yml`. - Added a comment explaining the `time.Sleep(50 * time.Millisecond)` in `portal/backend/cmd/server/main.go`. - Changed upstream timeout mapping from `503` to `504` in `portal/backend/internal/proxy/handler.go`. - Added Phase 3 TODO comments for missing ownership enforcement in: - `MeConsentByID` - `MeConsentApprove` - `MeConsentRevoke` - Consolidated duplicated correlation ID generation into shared code under `portal/backend/internal/correlation/`. - Added TODO notes documenting the sequential metadata enrichment limitation in `portal/backend/internal/proxy/handler.go`. - Updated docs/tests that depended on the timeout status change. - Updated buildRevokePayload in [handler.go (line 585)](/abs/path/portal/backend/internal/proxy/handler.go:585) to initialize payload as an empty map and keep the final actionBy assignment as the source of truth.
- Added path escaping when forwarding `consentId`. - Added invalid-consent-ID integration coverage. - Updated integration fixtures to use valid UUID consent IDs.
rashmithachamikara
force-pushed
the
feature/portal-backend
branch
from
July 2, 2026 05:51
6eb44e5 to
88a73c1
Compare
VimukthiRajapaksha
approved these changes
Jul 2, 2026
hasithakn
reviewed
Jul 6, 2026
hasithakn
reviewed
Jul 6, 2026
hasithakn
reviewed
Jul 6, 2026
hasithakn
approved these changes
Jul 6, 2026
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.
Purpose
Bootstrap and initialize the OpenFGC Portal backend BFF (Backend-For-Frontend) with API proxying, security hardening, and backend infrastructure.
Goals
Approach
User stories
Documentation
portal/backendportal/backend/openapi/bff.yamlAutomation tests
Security checks
✓ Followed secure coding standards in WSO2 Secure Engineering Guidelines
✓ Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets