ci: expand CI checks and make consumer sync opt-in
- Add Go, npm, Python, and Java validation to CI - Run Go tests against PostgreSQL - Record performance fixes in the report
This commit is contained in:
1 parent
199a5efaef
commit
22887fef03
100 files changed
+9740
-429
No files matched your search
@@ -181,3 +181,58 @@ func TestThumbnailIDsCannotEscapeTheThumbnailsDirectory(t *testing.T) {
|
||||
t.Fatalf("invalid thumbnail ids reached CarrierNode: %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
// TestPushAndDeleteNamesCannotEscapeTheirDirectory checks that the push and delete helpers refuse
|
||||
// names that are "." or ".." or contain a separator before any request reaches CarrierNode.
|
||||
func TestPushAndDeleteNamesCannotEscapeTheirDirectory(t *testing.T) {
|
||||
client, node := newThumbnailTestClient(t, nil)
|
||||
ctx := context.Background()
|
||||
local := filepath.Join(t.TempDir(), "payload.bin")
|
||||
if err := os.WriteFile(local, []byte("x"), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, name := range []string{"", ".", "..", "../escape", `..\escape`, "nested/name"} {
|
||||
if _, err := client.PushThumbnail(ctx, name, local); err == nil {
|
||||
t.Errorf("PushThumbnail accepted name %q", name)
|
||||
}
|
||||
if err := client.DeleteThumbnail(ctx, name); err == nil {
|
||||
t.Errorf("DeleteThumbnail accepted name %q", name)
|
||||
}
|
||||
}
|
||||
// Outputs, inputs and copies may nest, but no segment may climb out of its directory.
|
||||
for _, name := range []string{"", ".", "..", "../escape", `..\escape`, "/abs", "a//b", "a/../b", "a/./b", "a/"} {
|
||||
if _, err := client.PushOutput(ctx, name, local); err == nil {
|
||||
t.Errorf("PushOutput accepted name %q", name)
|
||||
}
|
||||
if _, err := client.PushInput(ctx, name, local); err == nil {
|
||||
t.Errorf("PushInput accepted name %q", name)
|
||||
}
|
||||
if _, err := client.PushCopy(ctx, name, local); err == nil {
|
||||
t.Errorf("PushCopy accepted name %q", name)
|
||||
}
|
||||
}
|
||||
if got := node.seen(); len(got) != 0 {
|
||||
t.Fatalf("invalid names reached CarrierNode: %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
// TestNestedOutputNamesAreAccepted checks that CraftStudio-style nested output names pass the
|
||||
// relative-name check, so generator outputs keep their CarrierNode path.
|
||||
func TestNestedOutputNamesAreAccepted(t *testing.T) {
|
||||
for _, name := range []string{"CraftStudio/alice/flux/out.png", "a/b.txt"} {
|
||||
if err := validRelativeName(name); err != nil {
|
||||
t.Errorf("validRelativeName(%q) = %v, want nil", name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestValidNamesAreNotRefused checks that ordinary names, including ones with spaces or query
|
||||
// characters, pass the name check; the path escaping in MountPath and the push helpers handles them.
|
||||
func TestValidNamesAreNotRefused(t *testing.T) {
|
||||
for _, name := range []string{"clip.mp4", "my clip?.mp4", "a#b", "v1.2.final"} {
|
||||
if err := validName(name); err != nil {
|
||||
t.Errorf("validName(%q) = %v, want nil", name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user