Skip to content

feat: add gateway-enforced auth for console + rps (device-management-… - #1327

Open
amarnath-ac wants to merge 1 commit into
mainfrom
695-gateway-enforced-auth
Open

amarnath-ac wants to merge 1 commit into
mainfrom
695-gateway-enforced-auth

Conversation

@amarnath-ac

Copy link
Copy Markdown
Contributor

…toolkit/deployment#695)

  • Add auth.gatewayEnforced (AUTH_GATEWAY_ENFORCED): keeps login/relay auth but skips Console's own /api JWT check, for deployments where a gateway verifies it
  • Reject auth.disabled + auth.gatewayEnforced together; the gateway needs Console to still sign login tokens
  • Default is false, so standalone Console's auth behavior is unchanged

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.69%. Comparing base (59c10e0) to head (69e55be).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1327      +/-   ##
==========================================
+ Coverage   62.17%   62.69%   +0.52%     
==========================================
  Files         159      159              
  Lines       13414    13419       +5     
==========================================
+ Hits         8340     8413      +73     
+ Misses       5074     5006      -68     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@amarnath-ac
amarnath-ac force-pushed the 695-gateway-enforced-auth branch 3 times, most recently from 50ee710 to 69e55be Compare October 16, 2026 13:44
…toolkit/deployment#695)

- Add auth.gatewayEnforced (AUTH_GATEWAY_ENFORCED): keeps login/relay auth but
  skips Console's own /api JWT check, for deployments where a gateway verifies it
- Reject auth.disabled + auth.gatewayEnforced together; the gateway needs
  Console to still sign login tokens
- Default is false, so standalone Console's auth behavior is unchanged
@amarnath-ac
amarnath-ac marked this pull request as ready for review October 16, 2026 13:58
@amarnath-ac
amarnath-ac requested a review from a team as a code owner October 16, 2026 13:58
@amarnath-ac
amarnath-ac requested review from madhavilosetty-intel, rsdmike and sudhir-intc and a balanced review from Copilot October 16, 2026 13:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

HTTP tests must verify protected-route access in gateway mode and rejection without credentials in default mode.

1 open finding
What changed in this PR

Adds opt-in gateway-managed API authentication while preserving Console’s login and relay authentication and standalone defaults.

Changes:

  • Adds AUTH_GATEWAY_ENFORCED and rejects combining it with disabled authentication.
  • Skips API JWT verification in gateway mode and logs a direct-access warning.
  • Adds configuration and HTTP tests.
File Description
internal/​controller/​httpapi/​router.go Selects API JWT enforcement by authentication mode.
internal/​controller/​httpapi/​router_test.go Adds gateway and default-mode router tests.
internal/​app/​app_test.go Adds gateway-mode handler coverage.
config/​config.yml Defaults gateway enforcement to false.
config/​config.go Adds configuration, validation, and enforcement helper.
config/​config_test.go Tests validation and authentication modes.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +33 to +47
engine.ServeHTTP(w, httptest.NewRequest(http.MethodGet, "/healthz", http.NoBody))
require.Equal(t, http.StatusOK, w.Code)
}

//nolint:paralleltest // mutates the shared config.ConsoleConfig global
func TestNewRouterDefaultChecksJWT(t *testing.T) {
cfg := &config.Config{}

prev := config.ConsoleConfig

t.Cleanup(func() { config.ConsoleConfig = prev })

config.ConsoleConfig = cfg

NewRouter(gin.New(), logger.New("error"), usecase.Usecases{}, cfg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants