Skip to content

test(2.2): refuse a fallback write to a table with no known columns (CIP-5204) - #495

Merged
freshtonic merged 1 commit into
release/2.2from
james/cip-5204-22-test-that-a-fallback-write-to-a-table-with-no-known
Oct 26, 2026
Merged

freshtonic merged 1 commit into
release/2.2from
james/cip-5204-22-test-that-a-fallback-write-to-a-table-with-no-known

Conversation

@freshtonic

Copy link
Copy Markdown
Contributor

A follow-up to #493 (CIP-5168), for CIP-5204. It adds the test that I named as S1 in my review of #493: #493 (review)

The base is #493's branch. When #493 merges, GitHub changes the base of this PR to release/2.2.

Gap

Frontend::writes_encrypted refuses a write that fails the type check when Proxy knows the target table but does not know its columns (table.columns.is_empty()). An example is a table created with CREATE TABLE ... AS on the same connection. No test covered this condition. When I removed it, all 11 type_check_fallback tests still passed, and Proxy forwarded a plaintext write to such a table unchanged.

Changes

  • Add a_write_to_a_table_with_no_known_columns_that_fails_type_checking_is_refused to postgresql::tests::type_check_fallback. It sends CREATE TABLE staging AS SELECT * FROM users, then an INSERT or an UPDATE on staging that fails the type check (id = ANY(ARRAY[...])). It checks that Proxy refuses each one and forwards no plaintext.
  • Tests only. No production code changes, so there is no CHANGELOG entry.

Tests

  • cargo test -p cipherstash-proxy --lib type_check_fallback: 12 of 12 pass.
  • With the table.columns.is_empty() condition removed, the new test fails. I ran each case alone, and each case fails.
  • cargo fmt --check and cargo clippy -p cipherstash-proxy --all-targets -- -D warnings pass.

Acknowledgment

By submitting this pull request, I confirm that CipherStash can use, modify, copy, and redistribute this contribution, under the terms of CipherStash's choice.

🤖 Generated with Claude Code

…CIP-5204)

A write that fails type checking is refused when Proxy knows the target
table but not its columns, as with CREATE TABLE ... AS. No test covered
this: removing the table.columns.is_empty() condition left every
type_check_fallback test passing.
@freshtonic freshtonic self-assigned this Oct 26, 2026
@freshtonic
freshtonic requested a review from tobyhede October 26, 2026 23:02
Base automatically changed from claude/project-thread-ljyrlz to release/2.2 October 26, 2026 23:49
@freshtonic
freshtonic merged commit 5f99d7e into release/2.2 Oct 26, 2026
4 checks passed
@freshtonic
freshtonic deleted the james/cip-5204-22-test-that-a-fallback-write-to-a-table-with-no-known branch October 26, 2026 23:50
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.

2 participants