tighten internal-entity topic protection and drop dead pub api#63
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #41. The issue body claimed the four
AdminRequiredentries ($DB/_admin/#,$DB/_oauth_tokens/#,$DB/_identities/#,$DB/_identity_links/#) were redundant with Layer 2'sis_internal_entity_topicdefault-deny and thatBlockReasonwas "only logged, never pattern-matched" — that second half is wrong.topic_protection.rs:102-115, 150-163matches onBlockReason::AdminRequiredto fall through to the inner ACL check; any otherBlockReasonshort-circuits tofalse. So those four entries were not cosmetic: they enabled non-admins with explicit ACL grants to publish/subscribe on those topics.For
_admin,_oauth_tokens,_identities,_identity_linksthe ACL-grant escape hatch isn't desirable — these are admin-only by intent. This PR removes the four entries so they fall through to Layer 2 and returnInternalEntityAccess, which short-circuits without an ACL fallback. Result: non-admins are now strictly blocked regardless of ACL grants. Admins still pass through both layers as before.$DB/_verify/#stays inPROTECTED_TOPICSbecause_verifyis on Layer 2's allowlist; without the explicit rule it would fall through toOk(()).Also removes
check_entity_accessandis_internal_entityfrom the public API — both had zero external callers.Test plan
cargo make clippy— clean (pedantic, all targets + wasm)cargo test -p mqdb-agent --lib topic_rules— 22/22 pass, including updated assertions for the four affected topics (nowInternalEntityAccess) and admin-allowed paths unchanged