Repository navigation
fix(workspaces): legacy resources grant at most EDIT; settings load once and revalidate - #1322
Merged
Merged
Conversation
A descriptor with no owner and no space gave every caller OWN under legacy-visibility=shared, so any user could delete, share, publish or move a pre-workspace resource, and moving it into their own space took it from everyone else. With enforcement off the same answer disclosed its grant list. The legacy contribution is now EDIT: reading, using, editing and deploying keep working after an upgrade, while the OWN acts are admin-only until an owner is assigned. Explicit grants still count in full, matching the no-descriptor fallback in ResourceAccessGuard.
WorkspaceSettings re-read the stored settings inside synchronized(this) when its 5-second cache expired, so every access check queued behind a database read with no timeout of its own. It is now stale-while-revalidate: one caller re-reads while the others are served the last values, and a write adopted meanwhile is not overwritten by the older read. Only the first read, with nothing to serve, is still waited for. A stored legacy-visibility is validated once at load instead of on every access check, where an invalid value logged a WARN per call; it is now dropped (the default applies and the settings report DEFAULT) and logged once per distinct value. PUT /workspaces/settings stamps updatedAt to the millisecond both stores keep.
Neither settings store had a test, and they encode "not set" differently (an absent key against a NULL column) while PUT /workspaces/settings relies on a write clearing an omitted field. The new parity test runs both real adapters through the same cases, including the timestamp precision each keeps. Adds the changelog fragment for the branch.
The stale-while-revalidate install compared against the snapshot seen when a read started, so a forced re-read (GET /workspaces/settings) that answered after an older access-check re-read lost its swap and left the older values served. Each store read is now numbered as it starts, and each adopted write as it lands; the higher number stays served, whichever answers first. A failed re-read keeps what is served when it fails rather than what was served when it began. The changelog fragment no longer says a resource with no descriptor gets the same level as a legacy descriptor: that fallback stops at read and use.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 16 minutes. View limit details
|
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
rolandpickl
approved these changes
Nov 11, 2026
ginccc
added a commit
that referenced
this pull request
Nov 23, 2026
…plete the release docs (#1518) * fix(workspaces): legacy resources grant at most EDIT; settings load once and revalidate (#1322) * fix(workspaces): legacy resources grant at most EDIT A descriptor with no owner and no space gave every caller OWN under legacy-visibility=shared, so any user could delete, share, publish or move a pre-workspace resource, and moving it into their own space took it from everyone else. With enforcement off the same answer disclosed its grant list. The legacy contribution is now EDIT: reading, using, editing and deploying keep working after an upgrade, while the OWN acts are admin-only until an owner is assigned. Explicit grants still count in full, matching the no-descriptor fallback in ResourceAccessGuard. * fix(workspaces): settings load once and revalidate without blocking WorkspaceSettings re-read the stored settings inside synchronized(this) when its 5-second cache expired, so every access check queued behind a database read with no timeout of its own. It is now stale-while-revalidate: one caller re-reads while the others are served the last values, and a write adopted meanwhile is not overwritten by the older read. Only the first read, with nothing to serve, is still waited for. A stored legacy-visibility is validated once at load instead of on every access check, where an invalid value logged a WARN per call; it is now dropped (the default applies and the settings report DEFAULT) and logged once per distinct value. PUT /workspaces/settings stamps updatedAt to the millisecond both stores keep. * test(workspaces): Mongo and Postgres settings store parity Neither settings store had a test, and they encode "not set" differently (an absent key against a NULL column) while PUT /workspaces/settings relies on a write clearing an omitted field. The new parity test runs both real adapters through the same cases, including the timestamp precision each keeps. Adds the changelog fragment for the branch. * fix(workspaces): order settings snapshots by when their read began The stale-while-revalidate install compared against the snapshot seen when a read started, so a forced re-read (GET /workspaces/settings) that answered after an older access-check re-read lost its swap and left the older values served. Each store read is now numbered as it starts, and each adopted write as it lands; the higher number stays served, whichever answers first. A failed re-read keeps what is served when it fails rather than what was served when it began. The changelog fragment no longer says a resource with no descriptor gets the same level as a legacy descriptor: that fallback stops at read and use. * fix(workspaces): rewrap two test comments the formatter split mid-sentence * test(workspaces): null-guard the reader threads in two finally blocks (cherry picked from commit 8176edb) * fix(ingestion): fetchable crawl URLs, bounded markdown prefixes, at-block hiding rules (#1339) * fix(ingestion): fetchable crawl URLs, bounded markdown prefixes, at-block hiding rules - WebCrawler fetched the raw abs:href, so href="my doc.html" failed in the fetcher's URI.create on every run as an inconclusive error, which also blocked deletion reconciliation. CrawlUrls.fetchable strips the fragment and encodes through the same tolerant parser as canonicalize; links and sitemap URLs use it for the fetch, the length bound and the frontier cost. - HtmlToMarkdownConverter copied every line once per enclosing blockquote or re-indented list item, so 90 nested quotes in a 236 KB mail allocated 339 MB. At most MAX_PREFIXED_NESTING = 8 such containers stack, counted on the per-conversion Walk; deeper ones are written in place. - HiddenStylesheetRules skipped every at-block, so a hiding rule inside @media screen hid text from readers and still reached the model. @layer, @supports and screen-wide @media blocks are entered in the same forward scan; viewport and device queries stay skipped. * fix(ingestion): keep the walk's prefix-nesting counter private like its other counters * fix(ingestion): state the at-block hiding rules in security.md without nested dashes (cherry picked from commit 7d65ba2) * fix(nlp): an unknown word drops * as well, so it cannot act as the wildcard A lone * typed by a user became unknown(*). Expression.equals treats * as a wildcard, so that expression matched every behavior rule written as unknown(x). Unknown now strips * together with ( ) and ,. * docs(release): complete the 6.7.1 behaviour changes and record the review additions The upgrade notes gain the workspace, ingestion, import and sync, and Helm Keycloak digest changes, the price gap for GPT-6.2 and Gemini 4, and the expression injection the unknown(...) change closes. The Vertex picker never offered gemini-2.5-*, so that claim goes. Release-notes row dated 2026-11-22. OpenAiPermitModeAuthMechanism is @SInCE 6.7.1, and the Java4ShellMitigationTest Javadoc no longer contradicts itself. * fix(ingestion,workspaces): address review of the 6.7.1 backports - WorkspaceSettings: a failed re-read keeps the sequence of the snapshot it keeps, so an earlier-started read that answers later is not refused; the fail-closed snapshot of a never-read store ranks below every read. - WebCrawler: a held document linked only through a URL too long to fetch is reported after the crawl as content unknown (recorded unreachable, not missed) instead of being skipped silently. CrawlSink.holds says which documents the source holds. - HiddenStylesheetRules: a comment in an @media prelude separates tokens, so @media only/**/screen is entered. - CrawlUrls.encodeIllegal encodes by code point: an emoji is %F0%9F%98%80, not %3F%3F. - HtmlToMarkdownConverterSalvageTest: allocation tests also assume the counters are enabled. * fix(ingestion): bound and narrow the oversized-link report - reportOversized skips documents already visited or delivered, so a page reached through a redirect is not also reported as content unknown. - At most MAX_OVERSIZED_LINKS (1,000) documents are remembered; past that, discovery is incomplete. The report runs only after a crawl that completed with discovery complete, and stops on cancellation, interruption or the time budget, leaving discovery incomplete. - Collector.holds treats a failing state-store lookup as held, so it cannot fail a finished crawl. - A sitemap URL dropped for exceeding MAX_SITEMAP_URL_LENGTH marks the sitemap incomplete, so a page listed only that way is not tombstoned. * fix(ingestion): keep the oversized-link report from failing or flooding a run - Revert the sitemap change from the previous commit: a <loc> longer than MAX_SITEMAP_URL_LENGTH is dropped silently again. The check runs before the scheme and scope checks, so any long line disabled deletion reconciliation for the source for good; it stays a known gap. - Collector.onError: a failing recordUnreachable is caught and logged at debug, as ownershipUnverified does, so it cannot fail a finished crawl. - Collector.holds: after the first failing lookup it warns once and answers "held" for the rest of the run without asking the store again. - reportOversized: the queued/visited/delivered and robots skips come first; cancellation, interruption and the time budget are checked just before each lookup. - The skip log says "discovery was incomplete" rather than "incomplete sitemap discovery", which no longer covers every cause. - Tests: RecordingSink counts holds calls; a crawl past MAX_OVERSIZED_LINKS makes none, and exactly MAX_OVERSIZED_LINKS stays complete. A pipeline test covers a failing lookup: the run completes, looks up once, and tombstones nothing. * fix(ingestion): let a failed unreachable mark fail the run again - Collector.onError: the try/catch around recordUnreachable is removed. A swallowed failure let the run end covered and reconcile, so pages that merely answered an error counted as missed and could be tombstoned. The holds once-only failure flag stays; its comment now says what happens. - reportOversized Javadoc: names the queued/visited/delivered (redirect) skips, MAX_OVERSIZED_LINKS and the cancel/deadline stop. - Test: a store that cannot record an unreachable page fails the run and tombstones nothing. - docs: the overlong-link behaviour in "Behaviour changes in 6.7.1"; the silent drop of over-long sitemap <loc> entries recorded as a known gap. * fix(ingestion): admit only unreached oversized links; ignore robots in the report - noteOversized skips ids already visited or delivered, so overlong links to redirect targets the crawl reached no longer fill MAX_OVERSIZED_LINKS and disable reconciliation. reportOversized keeps its skips for links seen before their target was reached. - reportOversized no longer consults robots.txt. It matched rules against the canonical id, which has lost the link's tracking parameters, so a held document the real link reaches could be skipped and then deleted. Reported instead, it is kept.
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.
Any user could own every pre-workspace resource
With
eddi.workspaces.enabled=trueand the defaultlegacy-visibility=shared,DescriptorAccess.effectiveLevelreturnedOWNfor any caller on a descriptor with noowner and no space, which is what every resource created before the upgrade looks like.
OWNis the gate for delete, share, revoke, visibility and move, so on an upgradeddeployment a plain
eddi-editornamed bob could:PUT .../shares/visibilitya colleague's pre-upgrade agent topublished, exposing itto anonymous callers on the production chat endpoints;
user:bob. The descriptor then has a space, so it is no longer "unowned".Bob keeps
EDITthrough the space branch and everyone else loses access;OWN, which survives a later switch toadmin-only;With enforcement off, the same answer fed
mayReadGrants' structural fallback, so anyuser could read the grant audience (principal and team names) of a legacy resource.
That contradicted the rest of the code and the docs. A resource with no descriptor at
all is already capped below
EDIT(ResourceAccessGuard.requireLegacyFallback), anddocs/workspaces.mdsays an absent owner record "must not grant authority". The commentjustifying
OWNcitedOwnershipValidator.requireOwnerOrAdmin, which has no productioncaller outside its strict variant.
The fix
DescriptorAccess: the legacy contribution is nowEDIT, notOWN. Undersharedeveryone can still read, use, edit and deploy pre-existing resources, so an upgrade hides
nothing and stops nobody's work. The
OWNacts are admin-only until an owner is assigned(
PUT /descriptorstore/descriptors/{id}/shares/owner, already admin-only). Explicit grantson a legacy resource still count in full: a user granted
OWNholds it. The access indexis unchanged, because it only decides whether a caller is admitted at all, and that
answer did not change.
The same PR fixes three smaller things in the workspace settings that every access check
reads:
WorkspaceSettingsno longer blocks access checks on a store read. When the 5-secondcache expired,
snapshot()re-read Mongo/Postgres insidesynchronized(this). Thatread has no timeout of its own, so every request whose guard asked
admitsLegacy()queued on the monitor for the whole read: at every expiry under load, and for the whole
of a database stall. It is now stale-while-revalidate, with no executor:
AtomicBooleanreads; others are served the stale snapshot at onceadopt()lands while a re-read is in flightsynchronized firstLoad): there is nothing to serve, and the defaults would open legacy datarefresh()(the forced re-read behindGET /workspaces/settings) installs the sameway, so it cannot overwrite a write adopted while it was reading, and an older
access-check re-read that answers after it cannot put the older values back. A re-read
that fails keeps what is served when it fails, not what was served when it began.
A corrupt stored
legacy-visibilityis validated once, at load.effectiveLegacyVisibility()re-validated the stored value and logged aWARNonevery call. That meant one WARN per access check per request for as long as a bad
row (only a direct DB write can create one) stayed. Now the value is checked when it is
read: a valid one is stored trimmed and lower-case, an invalid one is dropped (the
default
sharedapplies, as before). The WARN is logged once per distinct bad value, notat every 5-second re-read.
GET /workspaces/settingsnow reports such a value asDEFAULT, the value that actually applies, where it used to saySTOREDnext to aneffective
shared.PUT /workspaces/settingsstampsupdatedAtto the millisecond. The new parity testshowed Mongo keeps milliseconds and Postgres microseconds, so what this instance adopted
(
Instant.now(), sub-microsecond on Windows) differed from what any replica read back.New
WorkspaceSettingsStoreParityTest. Neither settings store had a test. The twoencode "not set" differently: Mongo drops the key in a replaced document, Postgres writes
NULLthroughON CONFLICT ... EXCLUDED.PUTrelies on a write clearing an omittedfield. The test runs both real adapters (Testcontainers, the
TenantQuotaStoreParityTestpattern) through: unknown tenant, full round trip, unset fields read back as null,
writing null clears a stored value, tenant isolation, and timestamp precision.
Decisions
EDITVIEW/USE(the no-descriptor cap)OWNacts, not in editingEDITOWN, guard eachOWNact separately@Scheduledinstall)setinrefresh()(the plan);compareAndSetagainst the snapshot seen at read startsetlets a read that began before anadopt()overwrite it; the start-time CAS let an older re-read that landed first make the settings page's newer read lose its swap. A sequence taken when each read starts orders all three cases correctlyDEFAULTis the honest reportupdatedAtat the write boundaryInstant.now()entersWhat changes for users and operators
revoke, publish (change visibility), move, or read the grants of a resource created
before ownership was recorded. The Manager already gates those buttons on
callerLevel,which now says
EDITfor such resources, so it stops offering them. Admins areunaffected. Assign owners to resources that someone other than an admin should
manage. This is written up in
docs/workspaces.md(new "Resources that predateownership" section and upgrade steps 4 and 5) and in
docs/configuration-reference.md.non-admins, matching owned resources.
/v1, properties: unchanged. No new property,no new endpoint. The Platform Operator's prompt does not cover legacy visibility, so
it needs no change and no revision bump.
Where to look hardest
WorkspaceSettings.snapshot()andinstall(): the flag and the ordering. Thefinallyresets the flag; the re-check after winning it avoids a redundant read;installkeeps whichever snapshot's read (or adopt) began last. A failed re-readkeeps the values served at the moment it fails, with a new timestamp, so an outage
retries once per TTL, from one thread.
DescriptorAccess.effectiveLevel: confirm that nothing in production relied on legacyOWNfor a non-admin.grep -rn "AccessLevel.OWN" src/main/javalists the gates:RestVersionInfodelete/requireOwnAccess,ResourceSharingServiceshare/revoke/visibility/move and cascade (
canAccess(..., OWN)), and grant disclosure.All of them should now refuse a non-admin on legacy data.
transferOwnershipis theadmin recovery path.
Verification
All runs offline, unit tests only (
-DskipUi=true):./mvnw -o -DskipUi=true test -Dtest='DescriptorAccessTest,ResourceAccessGuardTest'before the fix: 6 failures, each for the expected reason (legacy level
OWNwhereEDITis expected;requireAccess(OWN)admitted bob; bob could read legacy grantswith enforcement off). After the fix: 77 tests, 0 failures.
RuntimeWorkspaceSettingsTestagainst theorigin/mainversions ofWorkspaceSettingsandRestWorkspaces: 6 failures. The two concurrency cases hit the1-second
assertTimeoutPreemptively, the WARN count was 100 instead of 1 and 3 insteadof 2, a corrupt value was reported as stored, and
updatedAthad sub-milliseconddigits. With the fix: 19 tests, 0 failures.
compareAndSet->setinsnapshot(), the WARN dedupe disabled,legacy_visibility = EXCLUDED.legacy_visibilityremoved from the PostgresUPSERT): exactlyadoptDuringRereadWins,corruptStoredLegacyWarnsOnChangeOnlyandoverwritingWithNullClears[postgres]failed. The other 28 cases passed, including theparity cases on both backends (Docker was available locally).
./mvnw -o -DskipUi=true test -Dtest='ai/labs/eddi/engine/security/spaces/**/*Test,ListingRedactionWiringTest,ConversationReviewTest,RestVersionInfoTest,ImportStyleTest,BuildQualityGatesTest,ChangelogRotationTest,ChangelogFragmentTest,DocumentationLinksTest,DocumentationAccuracyTest,DocumentedRestPathsTest,DeploymentManifestsTest'gave 570 tests, 0 failures, 0 errors, 1 skipped (a skip insideDeploymentManifestsTest), BUILD SUCCESS. That is the wholeengine.security.spacespackage (35 report files), the other tests that build a realWorkspaceSettings, and the repo-wide guards. A surefire report was confirmed for every class named.Review pass (independent reviewer, after the three implementation commits):
olderRereadDoesNotUndoNewerOne: red against the implementation as firstcommitted (
expected finance, was engineering: the settings page's newer read lost itsswap to an older access-check read), green after
install().failedRereadKeepsLatestValues: mutation (capture the fallback snapshot at readstart) turns it red; green with the fix.
install()turnsadoptDuringRereadWinsred.best = AccessLevel.OWNinDescriptorAccessturns 6 tests redacross
DescriptorAccessTestandResourceAccessGuardTest.BUILD SUCCESS, 35 report files, a report for every named class.
Not run locally: the full unit suite,
verify, integration tests (*IT) and theManager/Chat UI suites. CI covers those. No UI code changed.
Follow-ups (out of scope)
OwnershipValidator.requireOwnerOrAdminstill treats an unowned resource as owned. Ithas no production caller outside the strict variant (tracked separately as
NEW-sec-authz-1).
EDITfor an anonymous caller. Anonymous callers cannotreach the edit endpoints (role-gated), but a later tightening could cap anonymous at
USE.