feat(BL-P2-091): Glance FR1 — ScopedItem for Image + with_audit + refilter#87
Merged
Conversation
…ilter BL-P2-085 deferred Glance FR1 because image-visibility semantics (public/private/shared/community) need richer handling than `tenant_id` alone. This change wires the same defense-in-depth refilter as Neutron/Nova/Cinder for the `owner` check (FR1 contract), closing the "FR1+FR2+FR3+FR4 layered defense" asymmetry of the atomic security PR. - `impl ScopedItem for Image` in scope_refilter.rs maps `Image.owner: Option<String>` → `tenant_id()` (Glance v2 uses `owner` rather than `tenant_id` on the wire) and `Image.id: String` → `resource_id()`. - `GlanceAuditCtx` type alias + `AdapterAuditConfig.glance` field + `build_audit_config` slot tagged `service = "glance"`. - `GlanceHttpAdapter::with_audit` builder + `refilter_response<T>` helper mirror the Neutron pattern exactly (correlation_id=0; list_* are not bound to a worker dispatch — epoch propagation is a separate cycle). - `list_images` wraps the `paginated_list` result through `refilter_response(_, filter.all_tenants, "FetchImages", "image")` so cross-project rows surface as `AdapterFilterViolation` events. - `registry::new_http` consumes `audit.glance` and chains it onto the adapter, parallel to neutron/nova/cinder. Out of scope (BL-P2-091 spec): richer visibility semantics — shared/community images surfacing without a matching `owner` under strict scoping drop fail-safe (caller can opt out with `all_tenants=true`). Tests: 4 spec-required tests + existing audit_config tests assert the `glance` slot is None at default and populated with service tag when logger is Some. cargo test = 1498 passed (1494 → +4). clippy clean. fmt clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ilter Codex review P1: Strict refilter dropped public/community/shared images under non-admin tokens because their `owner` is routinely a different project (or absent). That broke the standard `list_images` flow — users lost visibility into the public Ubuntu image, distro AMIs, etc., and `all_tenants=true` is not a viable normal-user fallback. `ScopedItem` now exposes `is_globally_accessible() -> bool` (default `false` preserves Neutron/Nova/Cinder behaviour where `tenant_id` equality is the only authoritative scope test). `Image` overrides: - `public` / `community` / `shared` → true (visibility marker IS the access decision; bypass owner refilter). - `private` and any unrecognized value → false (positive allowlist so a new Glance visibility variant doesn't silently relax the check). `refilter_by_scope` short-circuits keep for any globally-accessible row, so those rows neither hit `dropped` nor emit AdapterFilterViolation events (no false-positive leak signal). The FR1 leak signal we still catch: `visibility == "private"` AND `owner != active` Tests: 6 new (4 visibility-marker tests covering the three globally- accessible variants + fail-safe for unknown values, 1 cross-project mix test asserting public bypass + private cross-project drop, 1 sanity re-assertion on the default sample_image). cargo test = 1504 passed (1498 → +6). clippy clean. fmt clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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 / 요약
What changed
Asymmetry rationale (preserved from BL-P2-085 spec)
Glance v2's image visibility model (`public`/`private`/`shared`/`community`) means `owner` alone may not capture cross-project access intent for `shared`/`community` rows. This BL implements the owner-equality FR1 check — same contract as Neutron/Nova/Cinder. Rows surfaced under strict scoping with non-matching or absent `owner` drop fail-safe; callers wanting global visibility opt in via `filter.all_tenants = true` (already supported by `build_image_query`).
TDD trail
Verification
Out of scope (registered follow-ups)
Test plan
Refs: cargo-review branch-full report 2026-05-12 (Correctness #1, Suggestions #4). Parent: PR #85 (BL-P2-085 atomic security).
🤖 Generated with Claude Code