Skip to content

Commit

Permalink
test: add HTTP path traversal test
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed May 6, 2022
1 parent 3c90668 commit 24b4bbd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions server/http_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package server_test

import (
"testing"

"github.com/charmbracelet/charm/testserver"
)

func TestHTTPAccess(t *testing.T) {
cl := testserver.SetupTestServer(t)
_, err := cl.Auth()
if err != nil {
t.Fatalf("auth error: %s", err)
}

_, err = cl.AuthedRawRequest("GET", "/v1/fs/../../db/charm_sqlite.db")
if err == nil {
t.Fatalf("expected access error, got nil")
}
}

0 comments on commit 24b4bbd

Please sign in to comment.