fix(security): harden BFF auth endpoints and federated CSS - #25
Merged
Conversation
This was referenced Aug 7, 2026
Owner
|
Thanks — four of these I want to keep: CSS deletion, dev mode token fix, terminal basePath, and the Drop the rate limiter, HTTPS enforcement, workspace validation, and CORS credentials header. Our BFF is relay-only (ADR 0002) — no OIDC endpoints. The genai BFF doesn't have rate limiting or HTTPS enforcement either; that belongs at the ingress layer. One thing on the CSS: replace the inline |
5 tasks
gmenher
added a commit
to gmenher/openshell-dashboard
that referenced
this pull request
Aug 10, 2026
Address Gage's feedback on PR Gkrumbach07#25: 1. writeGrpcError: Replace status.FromError with errors.As + GRPCStatus() interface. Extracts the original clean gateway message directly, fixing all 64 handler call sites that returned 500 due to grpc-go v1.82+ wrapping the fmt.Errorf chain into the message. 2. CSS: Delete SandboxCard.css and SandboxEgressSummary.css (broke PF theming in Module Federation). Replace with PF component props (flex, grow) and utility classes (pf-v6-u-flex-shrink-0, pf-v6-u-text-color-subtle, pf-v6-u-py-sm, etc.). Remaining style={{}} only for minWidth:0 (no PF equivalent) and dynamic icon color. 3. Terminal: Use getApiBasePath() for WebSocket URL so federated mode connects to /openshell/api/v1/.../terminal correctly. 4. Tests: TestWriteGrpcErrorWrapped covers 6 real-world wrapped error scenarios (short messages, double-wrapped, Unavailable).
gmenher
force-pushed
the
fix/security-hardening
branch
from
August 10, 2026 09:56
9f78b81 to
775db53
Compare
gmenher
added a commit
to gmenher/openshell-dashboard
that referenced
this pull request
Aug 10, 2026
Address Gage's feedback on PR Gkrumbach07#25: 1. writeGrpcError: Replace status.FromError with errors.As + GRPCStatus() interface. Extracts the original clean gateway message directly, fixing all 64 handler call sites that returned 500 due to grpc-go v1.82+ wrapping the fmt.Errorf chain into the message. 2. CSS: Delete SandboxCard.css and SandboxEgressSummary.css (broke PF theming in Module Federation). Replace with PF component props (flex, grow) and utility classes (pf-v6-u-flex-shrink-0, pf-v6-u-text-color-subtle, pf-v6-u-py-sm, etc.). Remaining style={{}} only for minWidth:0 (no PF equivalent) and dynamic icon color. 3. Terminal: Use getApiBasePath() for WebSocket URL so federated mode connects to /openshell/api/v1/.../terminal correctly. 4. Tests: TestWriteGrpcErrorWrapped covers 6 real-world wrapped error scenarios (short messages, double-wrapped, Unavailable).
gmenher
force-pushed
the
fix/security-hardening
branch
from
August 10, 2026 15:30
775db53 to
b5397fd
Compare
Address Gage's feedback on PR Gkrumbach07#25: 1. writeGrpcError: Replace status.FromError with errors.As + GRPCStatus() interface. Extracts the original clean gateway message directly, fixing all 64 handler call sites that returned 500 due to grpc-go v1.82+ wrapping the fmt.Errorf chain into the message. 2. CSS: Delete SandboxCard.css and SandboxEgressSummary.css (broke PF theming in Module Federation). Replace with PF component props (flex, grow) and utility classes (pf-v6-u-flex-shrink-0, pf-v6-u-text-color-subtle, pf-v6-u-py-sm, etc.). Remaining style={{}} only for minWidth:0 (no PF equivalent) and dynamic icon color. 3. Terminal: Use getApiBasePath() for WebSocket URL so federated mode connects to /openshell/api/v1/.../terminal correctly. 4. Tests: TestWriteGrpcErrorWrapped covers 6 real-world wrapped error scenarios (short messages, double-wrapped, Unavailable).
gmenher
force-pushed
the
fix/security-hardening
branch
from
August 11, 2026 16:09
b5397fd to
8e7af2b
Compare
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.
Jira: RHOAIENG-83129
Summary
Security hardening for the openshell-dashboard BFF, addressing findings from an initial security review. Also removes local CSS files that broke PatternFly theming in Module Federation consumption.
Changes
Security (backend)
Rate-limit auth endpoints — Token exchange and refresh are now throttled at 10 req/min/IP to prevent brute-force refresh token abuse and IdP amplification. Only trusts
X-Forwarded-Forfrom loopback connections; direct clients are identified byRemoteAddr. Returns429withRetry-After: 60.OIDC issuer + token_endpoint HTTPS enforcement — Rejects non-HTTPS issuer URLs and token endpoints to prevent MITM on token exchange. Plaintext HTTP is only permitted for exact
localhost/127.0.0.1development addresses (with port separator to blocklocalhost.evil.comvariants).Stop forwarding stale tokens in dev mode — When
AUTH_DISABLED=true, the auth middleware no longer reads or forwards tokens from request headers. Prevents "invalid token" errors when the gateway is configured withallowUnauthenticatedUsers=true.Workspace URL param validation — Adds
validateURLParam("workspace")middleware that rejects paths not matching DNS-1123 before they reach the gateway.WebSocket origin relaxed in dev mode —
checkWebSocketOriginaccepts all origins when auth is disabled, simplifying local development with proxied frontends.Frontend
Terminal WebSocket URL — Uses
getApiBasePath()so the terminal connects to the correct path in federated mode (/openshell/api/v1/.../terminal).CSS removal — Deletes
SandboxCard.cssandSandboxEgressSummary.cssthat broke PatternFly theming in federated consumption. Replaced with inline styles using PF design tokens.Testing
go build ./...— passgo vet ./...— passgo test ./...— 4 packages, all pass (includes new tests for rate-limiter, input validation, OIDC enforcement, clientIP trust logic)Known limitations
{name},{provider}params not yet validated (follow-up)feat/cookie-session-authbranch addresses this separatelyDepends on
PR #18 should merge first (shared base commit
516da0c).