Skip to content

Replace ScopedStateStore __getattr__ with explicit allow-list#18

Merged
sebastientaggart merged 1 commit intomainfrom
feature/scoped-state-store-allowlist
Apr 8, 2026
Merged

Replace ScopedStateStore __getattr__ with explicit allow-list#18
sebastientaggart merged 1 commit intomainfrom
feature/scoped-state-store-allowlist

Conversation

@sebastientaggart
Copy link
Copy Markdown
Member

Removes the __getattr__ catch-all on ScopedStateStore that delegated unknown attribute access to the underlying StateStore. The wrapper now exposes only an explicit allow-list of proxied methods (list_state, entry_count, get_state, is_writable, set_state, clear_state), so any future write-capable method added to StateStore (e.g. bulk_set, purge) is invisible to plugins until explicitly proxied with the correct capability check.

Audit of the current StateStore surface confirmed nothing was leaking today — all public methods were already explicitly proxied, and the prior name.startswith("_") guard blocked private attributes. This change closes the latent defense-in-depth gap flagged on PR #13.

Added a regression test that injects a hypothetical bulk_set onto the underlying store and asserts it is not reachable through the scoped wrapper.

Closes #14

@sebastientaggart
Copy link
Copy Markdown
Member Author

Review Summary

Verdict: APPROVE

Findings

  • [NOTE] The new test mutates plugin_registry.state by attaching a bulk_set attribute; if the plugin_registry fixture is shared across tests this could leak state, so consider scoping the fixture to function level if not already.

@sebastientaggart sebastientaggart merged commit 5876ed1 into main Apr 8, 2026
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.

Investigate: ScopedStateStore.__getattr__ catch-all may leak future StateStore write methods

1 participant