Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Main config file (YAML):
- `coordinator` - max concurrent tests, retention
- `web` - server host/port, API/frontend toggles
- `web.frontend.pprof` mounts Go pprof on `/debug/pprof/`. With an `authProviderUrl` it needs the login: a bearer header (tools) or the `assertoor_debug_token` cookie, which the SPA's gate page (`web-ui/src/pages/DebugLogin.tsx`) sets from the session for a browser. Profile downloads are logged with the user; the index page is not.
- Features (`pkg/web/auth/handler.go`): `write` (schedule, cancel and delete test runs, edit the dashboard config, start AI chats), `test_registry` (register, delete and reschedule tests) and `pprof` need an explicit `assertoor:<feature>` grant in the token's services claim; basic access is read-only. A token without the claim (an authenticatoor without grants) keeps every feature.
- `endpoints` - array of {name, executionUrl, consensusUrl}
- `validatorNames` - inventory for mapping validator indices to names
- `globalVars` - variables available to all tests
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/ethereum/go-ethereum v1.17.4
github.com/ethpandaops/ethwallclock v0.4.0
github.com/ethpandaops/go-eth2-client v0.1.6
github.com/ethpandaops/service-authenticatoor v0.0.2
github.com/ethpandaops/service-authenticatoor v0.0.4-0.20261116121942-b69364b3c7ff
github.com/ethpandaops/spamoor v1.2.2
github.com/glebarez/go-sqlite v1.22.0
github.com/golang-jwt/jwt/v5 v5.3.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ github.com/ethpandaops/ethwallclock v0.4.0 h1:+sgnhf4pk6hLPukP076VxkiLloE4L0Yk1y
github.com/ethpandaops/ethwallclock v0.4.0/go.mod h1:y0Cu+mhGLlem19vnAV2x0hpFS5KZ7oOi2SWYayv9l24=
github.com/ethpandaops/go-eth2-client v0.1.6 h1:lG7Xz767YQQ+mN1ldzqJlj9Klg6zOElcemjXbCgJV5o=
github.com/ethpandaops/go-eth2-client v0.1.6/go.mod h1:97Oq3omOQSGPPYgrbsOIIw2Pc4T5Ph21f8ZRyHJQBHU=
github.com/ethpandaops/service-authenticatoor v0.0.2 h1:0rqHA2Rw64+NG0HVGRfqVhJEkRZRzH3qhX2SkBr2u+w=
github.com/ethpandaops/service-authenticatoor v0.0.2/go.mod h1:nIInMlq5O7YQDLVCL5gf0TeVAvVd9Q50k3sm3abTeG0=
github.com/ethpandaops/service-authenticatoor v0.0.4-0.20261116121942-b69364b3c7ff h1:eqnByos7MzNpDEf2djrnicQDfSlAlQllCYJEiGT4eKM=
github.com/ethpandaops/service-authenticatoor v0.0.4-0.20261116121942-b69364b3c7ff/go.mod h1:dPfMbnEE1VNUkD74mP2ad4C323jisbGdYK3R6srD7Xo=
github.com/ethpandaops/spamoor v1.2.2 h1:hkTVJA8jRTWsR0IvH1WsQcq5cWOui4ikOya7mYZ7B6g=
github.com/ethpandaops/spamoor v1.2.2/go.mod h1:gnsi2XbsfQNtRq7Je/lV46Y37gTssPU/ZoJ4qxgezd0=
github.com/ferranbt/fastssz v0.1.4 h1:OCDB+dYDEQDvAgtAGnTSidK1Pe2tW3nFV40XyMkTeDY=
Expand Down
7 changes: 6 additions & 1 deletion pkg/web/api/ai_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,14 @@ type AIChatStartResponse struct {
func (h *AIHandler) Chat(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", contentTypeJSON)

if !h.checkAuth(r) {
switch h.authHandler.FeatureStatus(r, auth.FeatureWrite) {
case http.StatusOK:
case http.StatusUnauthorized:
h.sendUnauthorizedResponse(w, "/api/v1/ai/chat")
return
default:
h.sendErrorResponse(w, "/api/v1/ai/chat", "forbidden: this login lacks the assertoor feature "+auth.FeatureWrite, http.StatusForbidden)
return
}

if h.client == nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/web/api/dashboard_config_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net/http"

"github.com/ethpandaops/assertoor/pkg/web/auth"
"github.com/jmoiron/sqlx"
)

Expand Down Expand Up @@ -68,14 +69,13 @@ func (ah *APIHandler) GetDashboardConfig(w http.ResponseWriter, r *http.Request)
// @Success 200 {object} Response "Saved"
// @Failure 400 {object} Response "Bad Request"
// @Failure 401 {object} Response "Unauthorized"
// @Failure 403 {object} Response "Login lacks the write feature"
// @Failure 500 {object} Response "Server Error"
// @Router /api/v1/dashboard_config [put]
func (ah *APIHandler) PutDashboardConfig(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", contentTypeJSON)

if !ah.checkAuth(r) {
ah.sendUnauthorizedResponse(w, r.URL.String())

if !ah.requireFeature(w, r, auth.FeatureWrite) {
return
}

Expand Down
84 changes: 84 additions & 0 deletions pkg/web/api/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ const docTemplate = `{
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the write feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -662,6 +668,12 @@ const docTemplate = `{
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the test_registry feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"404": {
"description": "Test not found",
"schema": {
Expand Down Expand Up @@ -884,6 +896,18 @@ const docTemplate = `{
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the write feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -1296,6 +1320,18 @@ const docTemplate = `{
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the write feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -1352,6 +1388,18 @@ const docTemplate = `{
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the write feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -1460,6 +1508,18 @@ const docTemplate = `{
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the test_registry feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -1520,6 +1580,18 @@ const docTemplate = `{
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the test_registry feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -1579,6 +1651,18 @@ const docTemplate = `{
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the test_registry feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down
84 changes: 84 additions & 0 deletions pkg/web/api/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the write feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -654,6 +660,12 @@
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the test_registry feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"404": {
"description": "Test not found",
"schema": {
Expand Down Expand Up @@ -876,6 +888,18 @@
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the write feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -1288,6 +1312,18 @@
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the write feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -1344,6 +1380,18 @@
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the write feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -1452,6 +1500,18 @@
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the test_registry feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -1512,6 +1572,18 @@
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the test_registry feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down Expand Up @@ -1571,6 +1643,18 @@
"$ref": "#/definitions/web_api.Response"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"403": {
"description": "Login lacks the test_registry feature",
"schema": {
"$ref": "#/definitions/web_api.Response"
}
},
"500": {
"description": "Server Error",
"schema": {
Expand Down
Loading
Loading