Skip to content

Enforce identity from Legion::Identity::Process on all writes and reads#24

Merged
Esity merged 1 commit into
mainfrom
feature/identity-scope-enforcement
May 19, 2026
Merged

Enforce identity from Legion::Identity::Process on all writes and reads#24
Esity merged 1 commit into
mainfrom
feature/identity-scope-enforcement

Conversation

@Esity

@Esity Esity commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • handle_ingest now derives identity (principal_id, identity_id, canonical_name) from Legion::Identity::Process instead of accepting via kwargs — prevents privilege escalation through tools/AMQP
  • handle_query and retrieve_relevant auto-inject requesting_principal_id from Legion::Identity::Process when not explicitly provided
  • Existing access_scope SQL filtering in graph_query.rb now activates by default

Context

Core fix for the Apollo knowledge leak between users. Identity kwargs were never trusted (tools/actors could spoof them). Now identity is always derived from the authenticated process.

Related: LegionIO/legion-apollo PR #35, LegionIO/lex-knowledge, LegionIO/legion-llm PR #127.

Test plan

  • 335 specs passing, 0 failures
  • 0 rubocop offenses
  • Spec coverage for identity enforcement (ignores caller-provided identity kwargs)
  • Verify identity columns populated on running daemon

Writes: handle_ingest now derives identity_principal_id, identity_id,
and identity_canonical_name from Legion::Identity::Process instead of
accepting them via kwargs. This prevents privilege escalation through
tool calls or AMQP messages that could spoof identity.

Reads: handle_query and retrieve_relevant auto-inject
requesting_principal_id from Legion::Identity::Process when not
explicitly provided, enabling access_scope filtering by default.
@Esity Esity requested a review from a team as a code owner May 19, 2026 04:46
@Esity Esity merged commit 6f4aac8 into main May 19, 2026
11 checks passed
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