[release] v0.21.0-unstable91

This commit is contained in:
Yann Stepienik
2026-02-18 17:15:35 +00:00
parent fc9d69baa8
commit 313c9d78b7
6 changed files with 37 additions and 7 deletions
+5
View File
@@ -23,6 +23,11 @@ function getContainerLogs(containerId, searchQuery, limit, lastReceivedLogs, err
if(limit < 50) limit = 50;
// remove starting / from containerId
if(containerId.startsWith('/')) {
containerId = containerId.substring(1);
}
const queryParams = new URLSearchParams({
search: searchQuery || "",
limit: limit || "",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cosmos-server",
"version": "0.21.0-unstable9",
"version": "0.21.0-unstable91",
"description": "",
"main": "test-server.js",
"bugs": {
+1
View File
@@ -6,6 +6,7 @@ import (
)
var NebulaStarted = false
var NebulaHasStarted = false
var CachedDeviceNames = map[string]string{}
var CachedDevices = map[string]utils.ConstellationDevice{}
var needToSyncCA = false
+6 -3
View File
@@ -138,15 +138,18 @@ func startNebula() error {
if err != nil {
utils.Error("failed to create nebula instance, need to restart the process", err)
// TODO: need a way to avoid restart loops (check if Nebula ever started?)
// We need a full restart
// utils.RestartServer(1)
// Nebula restart failure, we need to kill the process for OS cleanup
// Check that Nebula has ever started to avoid restart loop
if NebulaHasStarted {
utils.RestartServer(1)
}
}
// Actually start the nebula service (brings up TUN interface)
control.Start()
NebulaStarted = true
NebulaHasStarted = true
utils.Log("Constellation: nebula started successfully")
return nil
+22 -1
View File
@@ -20,6 +20,7 @@ import (
"os"
"net"
"strings"
"path"
"github.com/go-chi/httprate"
"crypto/tls"
"github.com/foomo/tlsconfig"
@@ -446,6 +447,23 @@ func InitServer() *mux.Router {
router := mux.NewRouter().StrictSlash(true).SkipClean(true)
// Clean paths for API routes before mux routing.
// SkipClean(true) is needed for proxy routes, but API routes use exact
// segment matching so double slashes cause 404s.
// router.Use runs after the main router matches but before subrouters match,
// so this cleans the path in time for API subrouter matching.
router.Use(func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if strings.HasPrefix(r.URL.Path, "/cosmos/") || strings.HasPrefix(r.URL.Path, "/cosmos-ui/") {
cleaned := path.Clean(r.URL.Path)
if cleaned != r.URL.Path {
r.URL.Path = cleaned
}
}
next.ServeHTTP(w, r)
})
})
router.Use(utils.ClientRealIP)
router.Use(utils.BlockBannedIPs)
@@ -474,7 +492,6 @@ func InitServer() *mux.Router {
srapiStrict := router.PathPrefix("/cosmos").Subrouter()
srapiStrict.Use(utils.ContentTypeMiddleware("application/json"))
srapiStrict.HandleFunc("/api/login", user.UserLogin)
srapiStrict.HandleFunc("/api/sudo", user.UserSudo)
@@ -636,6 +653,10 @@ func InitServer() *mux.Router {
}
srapiAdmin.Use(utils.Restrictions(config.AdminConstellationOnly, config.AdminWhitelistIPs))
srapi.Use(proxy.CleanPathMiddleware)
srapiStrict.Use(proxy.CleanPathMiddleware)
srapiAdmin.Use(proxy.CleanPathMiddleware)
srapi.Use(utils.SetSecurityHeaders)
srapiStrict.Use(utils.SetSecurityHeaders)
+2 -2
View File
@@ -17,7 +17,7 @@ import (
)
// Borrowed from the net/http package. (Thanks mux!)
func cleanPathMiddleware(next http.Handler) http.Handler {
func CleanPathMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
p := r.URL.Path
if p == "" {
@@ -234,7 +234,7 @@ func RouterGen(route utils.ProxyRouteConfig, router *mux.Router, destination htt
destination = tokenMiddleware(route)(utils.SetCosmosHeader(destination))
if !route.SkipURLClean {
destination = cleanPathMiddleware(destination)
destination = CleanPathMiddleware(destination)
}
origin.Handler(destination)