> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/guides-and-quickstarts/knowledge-and-retrieval/source-permissions.md).

# Source permissions

Source permissions restrict retrieval according to access in the connected source service. Use them when a shared knowledge base contains documents with different access requirements.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FZcUb0zdehTM52XHfIXxk%2FG041.mp4?alt=media&token=f2bb4dd7-7a01-4c3b-9a01-6e735ac03ba9>" %}

## Before you start

Use a connected knowledge base with a supported provider and an **Admin** role on that base. Current supported source providers are **Google Drive**, **OneDrive**, and **SharePoint**. OneDrive and SharePoint imports can use delegated OAuth or application credentials, but each reader still needs their own delegated OAuth account for permission checks. Website and mixed website/source knowledge bases do not support this setting.

Each reader needs knowledge-base access and a connected provider account that can read the intended files. The check uses the authenticated reader's provider authorization, not the importing account's permissions. A missing verified reader or unavailable provider check does not grant access. See [Create and manage connections](https://docs.stackai.com/guides-and-quickstarts/using-tools-and-actions/create-and-manage-connections.md) and [End user connections](https://docs.stackai.com/guides-and-quickstarts/using-tools-and-actions/end-user-connections.md) for account authorization.

Use users with different source access to check enforcement. Identify a document both users can read and one restricted to only one user. Verify these permissions directly in the provider before checking access in StackAI.

## Enable source permission checks

Open **More Options → Update Settings** and enable **Enforce source permissions**. If the control is absent, confirm that you are an Admin on the base and that its connected provider supports source checks; ask the knowledge-base owner to review the configuration.

![Source permission enforcement setting](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/CUmjjWDp3kgB1AnexE5e/assets/g041-g041-01-enabled.png)

Users need the required knowledge-base access as well as access to the underlying source files.

## Review access for an authorized user

Sign in as the user who can read the restricted source and query a source that account is authorized to read. If prompted to connect the source account, complete the authorization with that user’s own Google or Microsoft account, then rerun the query.

![Authorized source retrieval results](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/kKZuUGwwp3xJxZSV67vd/assets/g041-g041-02-owner.png)

Inspect the returned passage and filename to confirm the source is indexed and retrievable for that account.

## Review another user’s permitted sources

Use a separate browser profile or signed-out session for the user with more limited source access. Authorize that user's own provider account and query the document both users can read.

![Permitted source retrieval results](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/dZfgrjd3JLXvyxT6DYly/assets/g041-g041-03-common.png)

Confirm that accessible sources still return relevant passages when permission checks are enabled.

## Check restricted sources

With the same account, query information in a source the user cannot access.

![Restricted source retrieval check](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/zFF1hieVJtPk0Tj6ZpPP/assets/g041-g041-04-restricted.png)

Inspect all returned filenames and passages to confirm that restricted source content is absent.

## Check the published experience and recover

Repeat the permitted and restricted questions through the published interface with both users. [Configure authenticated access](https://docs.stackai.com/guides-and-quickstarts/interfaces-and-end-user-experiences/interface-authentication-and-access.md) so the application can identify each reader; a password by itself is not a user identity. A successful builder test does not establish what a different published user can retrieve.

If StackAI asks for a source connection, connect or reconnect the prompted account and retry. If a known permitted file remains missing, confirm that the same account can open it in the source service, then check the file's indexing status and the workflow's filters. Do not disable enforcement to make a missing result appear. If the provider is unavailable, retry after its access is restored.

## Important behavior

A user needs access to the knowledge base and permission to read the underlying source. Knowledge-base sharing alone does not grant source access.

## Continue

* [Share and reuse a knowledge base](https://docs.stackai.com/guides-and-quickstarts/knowledge-and-retrieval/share-and-reuse-a-knowledge-base.md)
* [End user connections](https://docs.stackai.com/guides-and-quickstarts/using-tools-and-actions/end-user-connections.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/guides-and-quickstarts/knowledge-and-retrieval/source-permissions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
