Every start connects to Postgres; pin the signing key's read refusal
Soul pass 3 (R1, R4). With GC_ACCESS_APPLY_SCHEMA_ON_STARTUP=0, startup never opened a connection, so a misbound database URL surfaced only in a request's error answer. createStore now connects on every Postgres start: it applies the schema when asked and otherwise runs `SELECT 1`, and either failure is the same fixed message naming GC_ACCESS_DATABASE_URL_FILE and a code. The entrypoint harness gains that case with the canary in the host. The harness also pins the signing key's read-failure branch with a key file of mode 000. Root reads such a file, so the case runs the entrypoint as a user a mode can refuse: the test process itself when it is not root, or else the checkout's owner. It is skipped, with the reason in its title, on Windows or as root in a root-owned checkout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
33afcbf364
commit
0f5ffd9e69
3 changed files with 79 additions and 22 deletions
|
|
@ -291,6 +291,11 @@ export class PostgresStore implements HeimdallStore {
|
|||
await this.pool.query(CREATE_SCHEMA_SQL);
|
||||
}
|
||||
|
||||
/** Opens a connection and runs a trivial query, so a start that does not apply the schema still proves the URL. */
|
||||
async checkConnection(): Promise<void> {
|
||||
await this.pool.query("SELECT 1");
|
||||
}
|
||||
|
||||
async close(): Promise<void> {
|
||||
await this.pool.end();
|
||||
}
|
||||
|
|
@ -791,7 +796,7 @@ export class PostgresStore implements HeimdallStore {
|
|||
}
|
||||
}
|
||||
|
||||
export function createPostgresStore(databaseUrl: string): HeimdallStore {
|
||||
export function createPostgresStore(databaseUrl: string): PostgresStore {
|
||||
const pool = new Pool({
|
||||
connectionString: databaseUrl,
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue