Skip to content

fix(security): enforce trust boundary before UMLS deserialize_unchecked Refs #1733#876

Merged
AlexMikhalev merged 1 commit into
mainfrom
task/1733-umls-permission-hard-error
May 18, 2026
Merged

fix(security): enforce trust boundary before UMLS deserialize_unchecked Refs #1733#876
AlexMikhalev merged 1 commit into
mainfrom
task/1733-umls-permission-hard-error

Conversation

@AlexMikhalev
Copy link
Copy Markdown
Contributor

Summary

Converts the advisory permission warning for UMLS artifacts to a hard error. An attacker who can write the artifact file can forge both bytes and checksums, rendering the SHA-256 gate useless without permission enforcement.

Changes

  • medical_artifact.rs: World-writable and group-writable artifacts now anyhow::bail! before any data is read (Unix only).
  • sharded_extractor.rs: SAFETY comment updated to list both enforced gates — permission check AND checksum verification.
  • Tests: Replaced test_world_writable_artifact_loads_ok (which expected permissive behavior) with three new tests:
    • test_world_writable_artifact_rejected
    • test_group_writable_artifact_rejected
    • test_secure_permissions_artifact_loads_ok

Verification

  • cargo test -p terraphim_automata --lib: 76 passed
  • cargo fmt, cargo clippy, cargo build, cargo test: clean
  • UBS: no critical issues

Refs terraphim/terraphim-ai#1733 (Gitea)

…ed Refs #1733

Convert advisory permission warning to hard error. An attacker
who can write the artifact file can forge both bytes and checksums
together, making the checksum gate useless for integrity.

Changes:
- medical_artifact.rs: world-writable and group-writable artifacts
  now bail before any data is read on Unix.
- sharded_extractor.rs: update SAFETY comment to list both
  enforced gates (permission check + checksum verification).
- Tests: replace advisory-success test with rejection tests for
  world-writable and group-writable, add secure-permissions test.
@AlexMikhalev AlexMikhalev merged commit 1053b84 into main May 18, 2026
18 of 22 checks passed
@AlexMikhalev AlexMikhalev deleted the task/1733-umls-permission-hard-error branch May 18, 2026 13:14
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