Repository navigation
fix(api): a governed graph source honors its model's override control - #2455
Merged
Merged
Conversation
A graph source registered with a model ledger presents a policy config synthesized from its registration: the model's default graph as its policy and schema source, and the registration's default-allow. Its override control was always the default, so a request could replace the source's policy defaults (an identity, a policy class, an inline policy, default-allow) whatever the model's owner configured, where a native ledger's own f:overrideControl would refuse it. The synthesized config now takes the override control of the model ledger's resolved policy defaults, read at the model's head, so a model with f:OverrideNone or f:IdentityRestricted governs request overrides of its sources as a native ledger governs its own; merge_policy_opts applies it unchanged, server-verified identity check included. Every graph-source kind resolves its view through the one function that builds this config. A model that sets no override control keeps the default (overrides allowed), and no other setting of the model's config is taken.
…l, as its native twin does
…el ledger's config
…l-override-control
bplatz
approved these changes
Nov 19, 2026
bplatz
left a comment
Contributor
There was a problem hiding this comment.
Approving. Please review the inline comments before merging.
| model.as_deref(), | ||
| config.as_mut().and_then(|c| c.policy.as_mut()), | ||
| ) { | ||
| policy.override_control = Box::pin(self.model_override_control(model)).await?; |
Contributor
There was a problem hiding this comment.
Optional: this reads the model at its head during view resolution, while wrap_policy reads the model's rules at the head its ResolveCtx captures later. Seeding the view's cross_ledger_resolved_heads with the head read here would keep both on one version.
…s its class f:OverrideNone stops a request's policy-class, inline policy and default-allow from replacing a governed source's defaults, but its identity still selects the class the model assigns it, as on a native ledger.
bplatz
added a commit
that referenced
this pull request
Nov 21, 2026
Brings #2453 (a GRAPH scope's columns leave as they are when nothing decodes), #2455 (a governed graph source honors its model's override control), #2467 (R2RML scan join emit; iceberg top-k read budget) and #2468 (vector identity follow-up: the whole-graph distinct-object count counts vectors by value, a cold identity-table build fetches its arena in one round, and the build stops on cancellation). Conflicts: - fast_count.rs: main's vector count on next's lead walk. count_distinct_lead_groups_inner tallies vector-only leaflets apart from the rest, and the NumBig liveness helpers take an ArenaRange (a store's NumBig o_types, or the vector o_type alone), so they serve count_distinct_vector_objects as main's generalized helpers do. count_distinct_objects_for_predicate takes next's tracker and main's cancellation, as do its callers in fast_predicate_scalar_agg.rs and fast_whole_graph_agg.rs. - fast_group_count_firsts.rs: next's pooled-graph guard with main's answer_or_decline. - o_type.rs: next's NumBig wording plus main's paragraph on arena contents. - fluree_ext.rs: next's SourcePolicy and model-instance check, with main's async config and the model's override control. - core lib.rs: main's MemoryCharge re-export; annotation_index has no home on next. - Cargo.toml, regression-budget.json: both benches. Ports: - vector.rs: register_missing asks ContentStore::get_local whether a shard is resident; next has no resolve_cached_bytes, and a shard's cid is not optional. - Tests: the residency vector arena stores its shards through write_test_shard_in, and BinaryIndexStore::empty() takes no directory.
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
A graph source registered with a model ledger (Iceberg, SQL or Delta,
--model/"model") isgoverned by the policies in that model. Its policy configuration is built from the source's
registration: the model's default graph is its policy source and schema source, and the
registration supplies
default_allow. That configuration always carried the default overridecontrol, which allows overrides. So whatever the model's owner configured, a request could replace the source's policy
defaults with its own identity, policy class, inline policy, or
default-allow. A native ledger's ownf:overrideControlrefuses exactly those overrides.A governed graph source now honors its model's override control. The configuration a source
presents takes the override control of the model ledger's resolved
f:policyDefaults, read atthe model's head the same way a query of the model resolves it.
merge_policy_optsthen applies it with nospecial-casing, so
f:OverrideNoneandf:IdentityRestrictedgovern request overrides of asource exactly as they govern a native ledger. That includes the server-verified identity check.
This matters because of an existing rule that applies to native ledgers and sources alike: a
request identity to which the policy rules assign no
f:policyClassselects no rules, anddefault-allowalone then decides what it reads. A native ledger owner can stop a request fromchoosing that with
f:overrideControl. Until now, a model owner could not do the same for thesources the model governs.
Behaviour
f:overrideControl: behaves exactly as before. Overrides are allowed (thedefault), and the test pins every cell of that column.
f:OverrideNone: a request's identity, policy class, inline policy ordefault-allow: trueno longer replaces the source's policy defaults. The source keeps itsregistered
default_allow(fail-closed when unset), as a native ledger keeps its own.f:IdentityRestricted: only a server-verified identity inf:allowedIdentitiesmay override, as on a native ledger.
f:policyClassthe model assigns, and the root policy context,read the same under every override control.
taken (field table below).
source's policies can't be read from a missing model either, so a governed request fails there
as before. Any other error reading the model's config fails the request.
Policy defaults: what a source takes from its model
PolicyDefaultsfieldoverride_control(f:overrideControl)default_allow(f:defaultAllow)default-allowunset, and would override a registration'sdefault_allow. Not taken.policy_class(f:policyClass)f:AccessPolicybaseline, and an identity with no class would get them instead of its own assignment. Not taken.policy_source(f:policySource)Breaking changes for embedders
f:overrideControlonf:policyDefaultsnowenforces it. Requests that relied on overriding such a source's policy defaults (an identity,
policy class, inline policy, or
default-allow) get the source's defaults instead, unless theoverride control permits the server-verified identity. Models without
f:overrideControlareunaffected.
ledger config read). An error reading an existing model's config fails the request instead of
being ignored.
Tests
In
fluree-db-api/tests/it_iceberg_policy.rs:a_governed_source_honors_its_model_override_control. The model holds a deny onex:Person(anf:AccessPolicy), a grant ofex:nametoex:ReaderPolicy, and an identityassigned that class. It is tested with three override controls. Sources are Iceberg and SQL;
surfaces are JSON-LD and SPARQL, each direct and as a named graph (
from-named/FROM NAMED). Rows (of 5):f:OverrideNonef:IdentityRestricted(admin)default-allow: truedefault-allow: truedefault-allow: true, server identity admindefault-allow: truea_governed_source_and_its_native_twin_agree_under_override_control. For every requestthat carries an identity, each source answers as a native ledger that holds the same
policies and identity, under the same override control in its own config. Requests without
an identity are not compared: a native ledger selects no stored policy for them, while a
model applies its access policies, and that difference predates this change.
Non-vacuous. With the inheritance reverted, both tests fail on exactly the bold cells:
the source returns 5 rows where the native twin and the expectation give 0.
Gates
At
abe405c54(this branch merged with main at0824793ba), on a dedicated Linux box:cargo nextest run --workspace --all-features --no-fail-fast --locked: 16477 run, 16477 passed, 46 skipped. The first attempt was stopped by the linker running out of memory, not by a test; the counts are from the re-run with--build-jobs 12 --test-threads 16.cargo test --workspace --all-features --doc --locked: pass.it_iceberg_policy(26/26, the 2 new tests included) andgrp_policy(148/148), iceberg+sql+native.harness_coverage(2/2).fluree-sql-bridge: fmt, clippy andcargo testagainst MySQL 8 and Postgres 16. The live-bridge lane passed:it_sql_pushdown_lane,it_sql_graph_sourceandit_sql_set_semantics(live_bridge), each over SQLite, Postgres and MySQL bridges.cargo clippy --workspace --all-features --all-targets -- -D warningsandcargo clippy --all-targets -- -D warnings: clean.cargo testand clippy pass.cargo fmt --all -- --checkin all three workspaces (root, testsuite-sparql, fluree-sql-bridge): clean.