[pitboss] phase 17: Track L.15 — Gin / Echo / Fiber / Chi adapters + Axum / Actix / Rocket / Warp adapters

This commit is contained in:
pitboss 2026-05-20 12:24:31 -05:00
parent 5393fe22f2
commit 2b96c6005b
33 changed files with 3247 additions and 27 deletions

View file

@ -0,0 +1,24 @@
// Phase 17 (Track L.15) — chi benign control fixture.
package main
import (
"net/http"
"os/exec"
"github.com/go-chi/chi/v5"
)
func Run(w http.ResponseWriter, r *http.Request) {
cmd := r.URL.Query().Get("cmd")
allow := map[string]string{"ls": "ls", "ps": "ps"}
if safe, ok := allow[cmd]; ok {
_ = exec.Command(safe).Run()
}
_, _ = w.Write([]byte("ok"))
}
func main() {
r := chi.NewRouter()
r.Get("/run", Run)
_ = r
}

View file

@ -0,0 +1,25 @@
// Phase 17 (Track L.15) — chi CMDI vuln fixture.
//
// The /run route forwards a `cmd` query parameter straight into
// `os/exec.Command`. Adapter binding: `r.Get("/run", Run)` with
// `cmd` flowing through the request query.
package main
import (
"net/http"
"os/exec"
"github.com/go-chi/chi/v5"
)
func Run(w http.ResponseWriter, r *http.Request) {
cmd := r.URL.Query().Get("cmd")
_ = exec.Command("sh", "-c", cmd).Run()
_, _ = w.Write([]byte("ok"))
}
func main() {
r := chi.NewRouter()
r.Get("/run", Run)
_ = r
}