Skip to content

Knowledge Base Permissions Guide 🟑 BETA

Scope knowledge-base folders with the permission file the code parses, and prove that a restricted user cannot retrieve a hidden document.

Admin guide Β· KB permission runbook

When to use Before you start Steps Verify Roll back
Adding a sensitive folder, after an access complaint Folder already in Drive, Vault credentials ready Edit the permission file, wait for reload, search as a test user Hidden folder absent from results Restore the previous permission file

When to use

Use this runbook when a knowledge-base folder must be readable by a group rather than by everyone, or when a document unexpectedly appears in a user's retrieval results.

Before you start

  • The permission parser and defaults live in botserver/crates/botcore/src/kb/permissions/ (mod.rs, parser.rs, defaults.rs). Read those files for the current field names; do not copy a schema from an older page.
  • Permissions are evaluated against the verified tenant and the authenticated user. A folder grant never overrides tenant scoping.
  • .gbkb content is Drive-owned: pull the file to /tmp with oc, edit it there and push it back. Never edit a local materialised copy and expect the change to persist.
  • config.csv changes are reloaded by the Drive monitor on ETag change; a restart is not the fix.

Steps

# 1. Read the parser before editing anything.
sed -n '1,200p' botserver/crates/botcore/src/kb/permissions/parser.rs

# 2. Get Drive credentials from Vault.
source <(grep -E '^VAULT_' "${WORKSPACE}/.env")
export VAULT_ADDR="$VAULT_ADDR"
export VAULT_CACERT="${WORKSPACE}/botserver-stack/conf/system/certificates/ca/ca.crt"
export VAULT_TOKEN=$(cat /tmp/vault-token-gb 2>/dev/null || echo "$VAULT_TOKEN")
VAULT_BIN="${WORKSPACE}/botserver-stack/bin/vault/vault"
DRIVE_ACCESSKEY=$($VAULT_BIN kv get -field=accesskey secret/gbo/drive)
DRIVE_SECRET=$($VAULT_BIN kv get -field=secret secret/gbo/drive)
DRIVE_PORT=$($VAULT_BIN kv get -field=port secret/gbo/drive)
/tmp/oc alias set local "http://127.0.0.1:${DRIVE_PORT}" "$DRIVE_ACCESSKEY" "$DRIVE_SECRET" --api s3v4

# 3. Pull the folder's permission file to /tmp, edit it there, push it back.
/tmp/oc cp local/"<bot>.gbai"/"<bot>.gbkb"/<path-to-permissions-file> /tmp/
# ...edit /tmp/<permissions-file>, then:
/tmp/oc cp /tmp/<permissions-file> local/"<bot>.gbai"/"<bot>.gbkb"/<path-to-permissions-file>

# 4. Wait for the Drive monitor to reload, then search as a restricted test user.
grep -E "drive_monitor|kb|ERROR" botserver.log | tail -30

Verify

Check Surface Pass condition
Schema parser.rs and defaults.rs file fields match the parser
Default parser default access unlisted folders use the documented default
Inheritance parser resolution child folder inherits the parent unless overridden
Retrieval search as a restricted user hidden folder returns no document
Direct read request a hidden document by id refused
Tenant scope cross-tenant read attempt refused independently of folder grants

Roll back

πŸ”΄ Push the previous permission file back from /tmp and let the Drive monitor reload it; do not restart botserver for a config change. Repeat the retrieval checks, and record any unexpected exposure through incident response.