Skip to content

fix(agent): make sessions cluster truncation UTF-8 safe Refs #1734#878

Merged
AlexMikhalev merged 6 commits into
mainfrom
task/1734-sessions-cluster-utf8
May 18, 2026
Merged

fix(agent): make sessions cluster truncation UTF-8 safe Refs #1734#878
AlexMikhalev merged 6 commits into
mainfrom
task/1734-sessions-cluster-utf8

Conversation

@AlexMikhalev
Copy link
Copy Markdown
Contributor

Summary

Replace byte-index slicing with char-boundary-safe truncation in sessions cluster command handler.

Refs terraphim/terraphim-ai#1734 (Gitea)

Alex and others added 6 commits May 18, 2026 14:10
…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.
Replace byte-index slicing ([..40], [..35]) with char-boundary-safe
truncation using char_indices().take(n). Prevents panic on multibyte
UTF-8 session titles and concept labels.
@AlexMikhalev AlexMikhalev merged commit 960ab45 into main May 18, 2026
@AlexMikhalev AlexMikhalev deleted the task/1734-sessions-cluster-utf8 branch May 18, 2026 13:40
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