fix(security): insufficient access controls#6191
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens “Reader” access controls across the UI and server to prevent unauthorized SPA navigation and to enforce read-only query execution for both InfluxQL and Flux.
Changes:
- Added UI route restrictions for Reader users (dashboard-only navigation) and role-gated access to
/logsand/sources/new. - Implemented server-side enforcement for Reader SPA route allowlisting and read-only query guards for InfluxQL and Flux.
- Refactored principal-to-user resolution logic to share between auth middleware and the new SPA route guard, and updated docs/tests accordingly.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/test/CheckSource.test.tsx | Adds unit tests to validate Reader dashboard-only redirects in CheckSources. |
| ui/src/index.tsx | Adds role-gated route wrappers for /logs and /sources/new. |
| ui/src/CheckSources.tsx | Enforces Reader redirects to dashboards when navigating to non-dashboard source routes. |
| server/reader_spa_guard.go | Introduces server-side Reader SPA allowlist guard for HTML navigations. |
| server/reader_spa_guard_test.go | Adds coverage for allowed/denied SPA navigation and basepath behavior. |
| server/queries.go | Enforces Reader InfluxQL read-only checks on the Queries analysis endpoint. |
| server/queries_test.go | Adds a test ensuring Readers are forbidden from unsafe InfluxQL via /queries. |
| server/influx.go | Enforces Reader InfluxQL read-only checks on the Influx proxy endpoint. |
| server/influx_test.go | Adds a test ensuring Readers are forbidden from unsafe InfluxQL via /proxy. |
| server/influxql_reader_guard.go | Adds parser-based InfluxQL statement allowlisting for Reader role. |
| server/flux.go | Enforces Reader Flux read-only checks on the Flux proxy endpoint. |
| server/flux_reader_guard.go | Adds Flux AST-based detection to block write-capable Flux calls for Readers. |
| server/flux_reader_guard_test.go | Adds tests for Reader Flux restrictions (including to() and parse errors). |
| server/principal_users.go | Adds shared principal→user resolution helper used by multiple middlewares. |
| server/auth.go | Refactors auth middleware to use shared principal→user resolution helper. |
| server/mux.go | Wires the Reader SPA guard into the server middleware chain. |
| README.md | Documents updated Reader behavior (dashboard focus + read-only query enforcement). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Coding finished. Going through manual tests. |
66b3ddc to
d08aee0
Compare
|
Manual functional testing shows improve enforcement of authorization rules. It also shows no obvious regression issues. All roles seem to work as before while Reader authorization breaches have been fixed. |
karel-rehor
left a comment
There was a problem hiding this comment.
Changes all make sense. Looks good to me. 🚴 🏁
/sources/<datasource>/dashboards. This removes normal in-app access to pages like Data Explorer, Logs, and Manage Sources for Reader users.SELECT ... INTO ...Hardening:
/and/sources/:id/dashboards*), making the frontend restriction robust against manual URL bypass.Manual tests:
Run in browser DevTools (eg F12 -> Console):
[1]
[2]
[3]
[4]