fixes
This commit is contained in:
1 parent
6586722652
commit
1e7c7bbfbb
65 files changed
+1345
-640
No files matched your search
@@ -11,6 +11,27 @@ import (
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
func TestV1OpenAPIYAMLDoesNotPublishAdminRoutes(t *testing.T) {
|
||||
t.Parallel()
|
||||
root := mustParseOpenAPIRoot(t, v1OpenAPIYAML)
|
||||
paths, ok := root["paths"].(map[string]any)
|
||||
if !ok {
|
||||
t.Fatal("missing paths map")
|
||||
}
|
||||
for path := range paths {
|
||||
if strings.HasPrefix(path, "/admin/") || strings.HasPrefix(path, "/team/") {
|
||||
t.Fatalf("non-public dashboard path leaked: %s", path)
|
||||
}
|
||||
}
|
||||
schemes := root["components"].(map[string]any)["securitySchemes"].(map[string]any)
|
||||
if _, ok := schemes["SessionCookie"]; ok {
|
||||
t.Fatal("session-cookie authentication leaked into public docs")
|
||||
}
|
||||
if _, ok := schemes["CSRFHeader"]; ok {
|
||||
t.Fatal("CSRF authentication leaked into public docs")
|
||||
}
|
||||
}
|
||||
|
||||
func TestV1OpenAPIYAMLParses(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in new issue
Block a user