diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 115d88ff..a4b75594 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: - id: go-unit-tests - repo: https://github.com/golangci/golangci-lint - rev: v1.62.2 + rev: v2.11.4 hooks: - id: golangci-lint args: [--config=.golangci.yml] diff --git a/cmd/admin/handlers/post.go b/cmd/admin/handlers/post.go index 7c6477e5..78d63381 100644 --- a/cmd/admin/handlers/post.go +++ b/cmd/admin/handlers/post.go @@ -442,6 +442,11 @@ func (h *HandlersAdmin) ConfPOSTHandler(w http.ResponseWriter, r *http.Request) adminErrorResponse(w, "invalid CSRF token", http.StatusInternalServerError, nil) return } + // Check if configuration is read-only + if h.OsqueryValues.ReadOnly { + adminErrorResponse(w, "configuration is read-only", http.StatusForbidden, nil) + return + } if c.ConfigurationB64 != "" { // Base64 decode received configuration // TODO verify configuration diff --git a/cmd/admin/templates/conf.html b/cmd/admin/templates/conf.html index 1b4457fb..167052f3 100644 --- a/cmd/admin/templates/conf.html +++ b/cmd/admin/templates/conf.html @@ -98,7 +98,12 @@
- + {{ if $leftmeta.OsqueryValues.ReadOnly }} + + {{ end }} +
- + {{ if $leftmeta.OsqueryValues.ReadOnly }} + + {{ end }} +
- + {{ if $leftmeta.OsqueryValues.ReadOnly }} + + {{ end }} +
- + {{ if $leftmeta.OsqueryValues.ReadOnly }} + + {{ end }} +
- + {{ if $leftmeta.OsqueryValues.ReadOnly }} + + {{ end }} +
- + {{ if $leftmeta.OsqueryValues.ReadOnly }} + + {{ end }} +