skip to content

How does an ingestion connector turn a source's inherited space, folder and share-link permissions into chunk access lists, and catch permission changes that never bump the modified time?

level: seniorimportance: must knowfreq 54%

answer

  1. effective access, not the page's own
  2. principals, not expanded users
  3. the link nobody is listed on
  4. a parent changes, children stay silent
  5. hash the access list, compare it

basics

~20 s

Compute each document's effective access from its ancestors and restrictions, store it as user and group identifiers on every chunk, fail closed when unreadable, and catch permission-only changes with permission events and a sweep comparing access-list hashes.

solid answer

~50 s

Many sources grant access mostly on containers, a wiki space or a drive folder, inherited below unless a page or file adds a restriction. So at ingest I compute each document's **effective access list** by walking its ancestors, and copy it onto every chunk as **principal identifiers** (users, groups, an organisation-wide principal), not as expanded users. An 'anyone with the link' grant names nobody, so most teams index such documents only for their explicit principals. If permissions cannot be read, the document stays unretrievable and is reported. The hard part is change: a share edit often leaves the modified time alone, a parent's restriction changes every descendant without touching any of them, and group membership lives in the identity directory. So I use permission events where they exist, recompute the subtree when a container changes, sync groups separately, and run a scheduled sweep comparing a hash of each effective list, updating chunk metadata without re-embedding.

code

pseudocode · 6 lines
pseudocode
for doc in source.list_permissions_only():
    acl = effective_access(doc)          # ancestors, restrictions, links
    h = hash(sorted(acl.principals), acl.link_policy)
    if h != stored_access_hash(doc.id):
        update_chunk_access(doc.id, acl)  # metadata only, no re-embedding
        store_access_hash(doc.id, h)

go deeper

for a junior

Recall that every chunk carries its source document's access list, and that sources grant access on spaces and folders that documents inherit.

for a middle

Explain computing effective access by walking ancestors, storing group identifiers rather than expanded users, and failing closed when permissions cannot be read.

for a senior

Show how permission-only changes escape a modified-time poll, and design the catch: permission events, subtree recompute on a container change, group sync and a hashed access-list sweep that updates metadata without re-embedding.

for a principal

Own the share-link and external-guest policy with the source owners and security, since it decides who the assistant can show a document to, and set how often the permission sweep must run.

## Where source permissions actually live Document sources rarely store a full permission list on each document. They grant access on **containers** and let it flow down: - a wiki grants a team access to a **space**, and every page in its page tree inherits it; - a shared drive grants access on a **folder**, inherited by its subfolders and files; - a ticket tracker grants access per **project** or queue, often with internal notes hidden from the requester; - a page or file can add an **explicit restriction** that narrows what it inherited, and some sources also let a child widen it; - a **share link** grants access to whoever holds the link, or to anyone in the organisation, without naming them. The access that matters for retrieval is the **effective access list**: who can read this document right now, after inheritance, restrictions and links are combined. Computing it is the connector's job, because only the connector sees the source's model. ## Mapping the model onto chunks 1. **Walk the ancestors.** Start from the container's grants, apply each level's restrictions down to the document. 2. **Store principals, not people.** Keep user and group identifiers as the source reports them, plus special principals such as "everyone in the organisation". Expanding groups into users at ingest means a single membership change can rewrite thousands of chunks. 3. **Map identities.** The source's user identifiers must match the identity the assistant's users log in with, usually through the organisation's identity provider; an unmapped principal is a gap to report, not to guess. 4. **Copy the list onto every chunk.** A chunk inherits its document's access list unchanged; the vectors themselves do not change. 5. **Fail closed.** If the connector's own access is too narrow to read a document's permissions, the document is not made retrievable, and the gap is reported. ```json { "doc_id": "wiki:page:48213", "access": { "allow": ["group:support-eng", "user:u-1932"], "inherited_from": "wiki:space:SUP", "link_sharing": "organisation", "has_page_restriction": true }, "access_hash": "illustrative-hash-value", "access_checked_at": "2026-10-14T03:10:00Z" } ``` Field names above are invented for illustration. How the query side enforces this list, and what happens between a revocation in the source and its arrival on the chunks, are retrieval-filtering and freshness concerns; the connector's job is to make the list correct and keep it current. ## Share links need a policy | Link type | What it names | Common mapping | |---|---|---| | Specific people | Users or groups | Their principals, like any grant | | Anyone in the organisation | No one in particular | An "all employees" principal | | Anyone with the link | No one at all | Usually ignored for retrieval: only explicit principals see it | | External guests | Users outside the tenant | Their own principals, or excluded by policy | Treating "anyone with the link" as public would let every assistant user read a document they could not find in the source without the link. The safer default is to honour only the named grants. ## Why permission changes are invisible - **No modified-time bump.** In many sources, sharing a document or removing a member changes its permissions without changing its modified time, so a modified-since poll never sees it. - **No feed event.** Some change feeds report content edits only; permission edits appear elsewhere, if anywhere. - **Inheritance fan-out.** Restricting one space changes the effective access of every page below it, while those pages often report no change of their own. - **Group membership.** Adding someone to a group changes what they can read without touching any document; that change lives in the identity directory. ## Catching them - **Permission or audit events.** Where the source emits them, subscribe and treat a container's change as a trigger to recompute its whole subtree. - **Permission sweep.** On a schedule, fetch only permissions (cheaper than content), recompute each effective list and compare a **hash of the list** with the stored hash. On a mismatch, rewrite the access metadata on that document's chunks; no re-parsing or re-embedding is needed. - **Group sync.** Mirror group membership separately, so a user added to a group gains access without any chunk changing. - **Connector scope checks.** Alert when the connector itself loses access to a container; otherwise its permissions silently stop updating. A permission-only change is small in bytes and large in consequence, so it should not wait behind content edits; how it is prioritised against the rest of the queue is a freshness question.

  • A space's restriction is removed, widening access. Is that as urgent as a narrowing?
    Less urgent for safety, since a stale narrower list only hides content from people now allowed to see it, but still worth propagating: users will ask why the assistant cannot find a page they can open. The sweep and the subtree recompute handle both directions the same way.
  • Why compare a hash of the access list rather than the source's permission version number?
    Not every source exposes a version for permissions, and where one exists it may cover only the document's own grants, not what it inherits. A hash of the computed effective list changes exactly when the access that matters changes, whatever caused it.
  • Should the connector index documents whose only grant is 'anyone with the link'?
    Usually not for broad retrieval. The link names nobody, so mapping it to everyone exposes the document to users who could not find it in the source. Index it only for its explicit principals, or not at all if it has none.

  • Copy the document's own permission field; inheritance is the source's concern.
  • Expand every group into its member users when indexing.
  • Treat 'anyone with the link' documents as public to all assistant users.
  • A permission change bumps the modified time, so the normal poll catches it.
  • If permissions cannot be read, index the document and let query filters sort it out.
  • Re-embed a document whenever its permissions change.