Plan independent BFF and adapt selected Sendico foundations (#34)
This commit is contained in:
1 parent
1e191fca42
commit
45666d33fc
17 files changed
+854
-15
No files matched your search
@@ -0,0 +1,18 @@
|
||||
package evidence
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestKeyConfinement(t *testing.T) {
|
||||
for _, ref := range []string{"", ".", "..", "../other", "/other", "a/../../other", "a\\..\\other", "%2e%2e/other", "bad\x00key"} {
|
||||
if _, err := JoinKey("customer/documents", ref); err == nil {
|
||||
t.Errorf("accepted %q", ref)
|
||||
}
|
||||
if _, err := JoinKey(ref, "document"); err == nil {
|
||||
t.Errorf("accepted prefix %q", ref)
|
||||
}
|
||||
}
|
||||
got, err := JoinKey("customer/documents/", "passport/front")
|
||||
if err != nil || got != "customer/documents/passport/front" {
|
||||
t.Fatalf("got %q, %v", got, err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user