carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1//go:build linux
2
3package hostbox
4
5import (
6 "errors"
7 "path/filepath"
8 "testing"
9)
10
11// Use the reviewer's exact expression. The larger CHECK regression separately
12// proves the allowlist runs before SQLite can evaluate any such expression.
13func TestPlan9Fix2MigrationRefusesReviewerCheck(t *testing.T) {
14 service, _, in := journalFixture(t)
15 legacy := plan9Fix1Legacy(t, in)
16 plan9Fix2Schema(t, filepath.Join(legacy, "launches.db"), "UPDATE sqlite_schema SET sql='CREATE TABLE launches (identity TEXT PRIMARY KEY, body BLOB NOT NULL, CHECK(length(hex(zeroblob(150000000)))>0))' WHERE name='launches'")
17 if err := service.MigrateLegacy(t.Context(), legacy, "box", "enrollment", plan9Fix1Freeze, plan9Fix1Accept); !errors.Is(err, ErrTypedJournal) {
18 t.Fatalf("reviewer CHECK was not refused: %v", err)
19 }
20}
21