Files
KantSites/tests/TestSchema.php
T
kantarciandClaude Opus 5.5 ad7c333215 Harden KantSites after the security review
- The installer only opens with a per-installation key that install.php
  creates and shows; the key is deleted with the first account.
- Lock files keep .env, the database, backups and logs out of reach when a
  domain points at the project folder instead of public/.
- Linked sections render by their own schema version, so an old section
  cannot carry unfiltered HTML into a newer page.
- Editors no longer move, trash or change areas and post data of published
  pages; a scheduled publication goes live with the revision that was
  scheduled (migration 20261012000100).
- Form stamps are bound to their form, IPv6 senders count per /64, and a
  flood per form or overall stops storing with a visible message.
- The consent redirect rejects control characters, update targets must look
  like 1.2.3, and own CSS cannot reach outside its block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 14:38:25 +02:00

73 lines
2.7 KiB
PHP

<?php
namespace App\Tests;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Schema;
use DoctrineMigrations\Version20260912000100;
use DoctrineMigrations\Version20260912000200;
use DoctrineMigrations\Version20260912000300;
use DoctrineMigrations\Version20260912000400;
use DoctrineMigrations\Version20260912000500;
use DoctrineMigrations\Version20260912000600;
use DoctrineMigrations\Version20260912000700;
use DoctrineMigrations\Version20260912000800;
use DoctrineMigrations\Version20260912000900;
use DoctrineMigrations\Version20260912001000;
use DoctrineMigrations\Version20260912001100;
use DoctrineMigrations\Version20260912001200;
use DoctrineMigrations\Version20260912001300;
use DoctrineMigrations\Version20260913000100;
use DoctrineMigrations\Version20260914000100;
use DoctrineMigrations\Version20260915000100;
use DoctrineMigrations\Version20260916000100;
use DoctrineMigrations\Version20260917000100;
use DoctrineMigrations\Version20261009000100;
use DoctrineMigrations\Version20261012000100;
use Psr\Log\NullLogger;
/**
* The schema a migrated installation has, built for a fresh test database.
*
* The list used to stand in three places, so a new migration was three edits and the fixtures
* drifted apart. It stands here once. Indexes come from the same postUp() helpers the migrations
* use, because on SQLite an index added the ordinary way rebuilds the table.
*/
final class TestSchema
{
public static function build(Connection $db): void
{
$schema = new Schema();
foreach ([
Version20260912000100::class,
Version20260912000200::class,
Version20260912000300::class,
Version20260912000400::class,
Version20260912000500::class,
Version20260912000600::class,
Version20260912000700::class,
Version20260912000800::class,
Version20260912000900::class,
Version20260912001000::class,
Version20260912001100::class,
Version20260912001200::class,
Version20260912001300::class,
Version20260913000100::class,
Version20260914000100::class,
Version20260915000100::class,
Version20260916000100::class,
Version20260917000100::class,
Version20261009000100::class,
Version20261012000100::class,
] as $migration) {
(new $migration($db, new NullLogger()))->up($schema);
}
foreach ($schema->toSql($db->getDatabasePlatform()) as $sql) {
$db->executeStatement($sql);
}
Version20260912000400::applyIndexes($db);
Version20260912000600::applyIndexes($db);
Version20260912000900::applyIndexes($db);
}
}