ci: expand shared package validation and test coverage
Lint / Lint (push) Successful in 32s
Docker / Docker Build & Push (push) Failing after 2m22s
Tests / Go backend (push) Failing after 1m2s
Tests / Dashboard checks (push) Failing after 35s

- Add lint, formatting, vet, and publish workflow checks
- Run Go database tests with PostgreSQL and add Java tests
- Make consumer sync opt-in; update docs and Go dependency
This commit is contained in:
Gabriel20xx committed 2026-10-19 21:46:52 +00:00
1 parent 937f51b4fb
commit 0ff94f9b10
107 files changed
+10124 -410

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)
}
}
}