Repository navigation
feat: add gateway-enforced auth for console + rps (device-management-… - #1327
Open
amarnath-ac wants to merge 1 commit into
Open
amarnath-ac wants to merge 1 commit into
amarnath-ac wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
amarnath-ac
force-pushed
the
695-gateway-enforced-auth
branch
3 times, most recently
from
October 16, 2026 13:44
50ee710 to
69e55be
Compare
…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
marked this pull request as ready for review
October 16, 2026 13:58
amarnath-ac
requested review from
madhavilosetty-intel,
rsdmike and
sudhir-intc
and
a balanced review from Copilot
October 16, 2026 13:58
Contributor
There was a problem hiding this comment.
🟡 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_ENFORCEDand 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) |
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.

…toolkit/deployment#695)