Skip to content

Add the integrity migration helper, roles and guide - #81

Open
WiktorB2004 wants to merge 11 commits into
add-integrity-checkpointsfrom
add-integrity-migration-and-guide
Open

WiktorB2004 wants to merge 11 commits into
add-integrity-checkpointsfrom
add-integrity-migration-and-guide

Conversation

@WiktorB2004

Copy link
Copy Markdown
Owner

Summary

Closes #73. This completes #68. It builds on #80 (checkpoints, signing and forks) and should be merged after it.

The tamper-evidence feature becomes public:

  • audit_trail.integrity lists its public API in __all__: Integrity, verify / averify, acknowledge / aacknowledge, the report types and enums, Signer / SignatureVerifier, Checkpoint, export_checkpoint, ReplicationError, declare_fork and the sealer's result types. Names load on first use, so a writer imports neither the verifier nor sqlalchemy.ext.asyncio. Integrity is also exported from audit_trail.
  • The Ed25519 reference is audit_trail.integrity.ed25519, importable only with the integrity extra.
  • audit.maintenance.verify() / averify() / acknowledge() / aacknowledge() pass the trail's system_severity, so an erasure whose receipt was retired is reported correctly without extra arguments.
  • examples/roles.sql:
    • the application loses its table-wide INSERT and gets a column INSERT without id and xid;
    • the scrub-only role gets column-level UPDATE (breaking, noted in the CHANGELOG);
    • new sealer and verifier roles. The sealer gets SELECT on the identity sequences (read by every seal after a fork with an id window) and pg_monitor (for export_checkpoint(require_replicated=True)).
  • Docs:
    • a tamper evidence guide: tiers, setup and upgrade, the sealer, verify and acknowledge, retention, checkpoints (with their incarnation), replication (FIRST n / ANY n, the short wait for a reconnecting standby, and the NO_SYNC_STANDBY / NOT_REPLICATED / CHECK_FAILED reasons of ReplicationError), restores and forks (which checkpoints a signed fork explains, and the FORKED_UNSIGNED note), the ALTER stall;
    • the threat table and the accepted risks in Limitations, including that the post-fork count check runs only while the sequence is near the id floor and weakens as retention drops rows;
    • salts in backups and WAL in the privacy guide;
    • the role matrix in the permissions guide;
    • the API page.
  • Every "private for now" docstring is replaced.

Test plan

  • Tests added or updated: unit tests for the public surface; a role test against PostgreSQL that upgrades a 0.3 install and tries what each role may and may not do. Each grant was also broken one at a time, and the test failed for each.
  • uv run pytest passes locally, including the PostgreSQL tests in tests/db
  • Schema, SQL or partition changes checked on PostgreSQL 14 (AUDIT_TEST_PG_IMAGE=postgres:14) as well as the default image
  • ruff check, ruff format --check and mypy pass
  • Docs and docstrings updated if the public API changed (mkdocs build --strict passes)
  • CHANGELOG.md Unreleased bullet if callers should notice

audit_trail.integrity lists its public names in __all__ and loads them on
first use, so writers import neither the verifier nor asyncio. The Ed25519
reference is audit_trail.integrity.ed25519, which needs the integrity extra.
PartitionManager gains verify, averify, acknowledge and aacknowledge, which
pass the trail's system_severity.
The application inserts every column except id and xid, after a REVOKE of
its table-wide INSERT. The scrub-only role gets UPDATE of the erased
columns only. New sealer and verifier roles. A role test upgrades a 0.3
install and tries what each role may and may not do.
A guide covering the tiers, the upgrade, the sealer, verify, retention,
checkpoints and restores; the threat table and accepted risks in
Limitations; salts in backups in the privacy guide; the role matrix.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant