Skip to content

feat(viking): restrict access to configured URI prefixes - #379

Merged
Million-mo merged 1 commit into
wolf1069b:mainfrom
Million-mo:feat/viking-allowed-uri-prefixes
Aug 19, 2026
Merged

feat(viking): restrict access to configured URI prefixes#379
Million-mo merged 1 commit into
wolf1069b:mainfrom
Million-mo:feat/viking-allowed-uri-prefixes

Conversation

@Million-mo

Copy link
Copy Markdown
Collaborator

Summary

Adds allowed_uri_prefixes to VikingCapabilityConfig, an opt-in URI prefix allowlist that scopes all Viking access to configured viking:// prefixes.

Previously an agent with the Viking capability could access every resource under the whole viking:// namespace — there was no way to grant read access to a single subtree (e.g. viking://resources/wiki/) without also exposing viking://resources/raw/, viking://user/*/memories/, etc.

Empty list (the default) preserves the current unrestricted behavior — fully backward compatible.

What changes

When allowed_uri_prefixes is non-empty:

Layer Behavior
All 15 viking_* tools Reject URIs outside the allowed prefixes (error string returned, SDK call not made)
viking_search / viking_find With no target_uri, automatically scope to the first allowed prefix; with a target_uri outside the allowlist — reject
list_resources() / read_resource() / resource_exists() @-mention flow only surfaces resources under the allowed prefixes; out-of-scope reads return None/False
Auto recall / profile injection Skipped when the memories URI is outside the allowlist
Compaction / multimodal-bridge uploads Skipped when the archive/upload URI is outside the allowlist
Skills discovery list_skills/read_skill/skill_exists return empty/false when the skills URI is out of scope
System prompt Documents the restriction and tells the model not to guess paths

Usage

agents:
  wiki_agent:
    capabilities:
      - type: viking
        mode: retrieve
        allowed_uri_prefixes:
          - "viking://resources/wiki/"
        uri_guard_enabled: true

Files changed

  • src/wolfharness_config/capabilities.py — new allowed_uri_prefixes field
  • src/wolfharness/capabilities/viking/__init__.py_check_uri_allowed() + _allowed_prefix_for() helpers; guards on ResourceAccess, skills, auto-recall, profile, compaction, uploads
  • src/wolfharness/capabilities/viking/tools.py — prefix check in all 15 tools
  • src/wolfharness/capabilities/viking/instructions.py — access-restriction guidance
  • tests/capabilities/viking/test_viking.py — 20 new L1 unit tests
  • tests/capabilities/viking/test_viking_integration.py — 5 new L2 integration tests
  • changelog/unreleased/2026-08-18-viking-allowed-uri-prefixes.md

Validation

  • ruff check + ruff format clean
  • mypy clean on changed sources
  • pytest tests/capabilities/viking/ → 483 passed (458 pre-existing + 25 new)
  • pytest tests/capabilities/ → 1324 passed (no cross-module regressions)

@Million-mo
Million-mo force-pushed the feat/viking-allowed-uri-prefixes branch 2 times, most recently from 1e97df2 to 6615fc8 Compare August 18, 2026 12:08
Adds an allowed_uri_prefixes option to VikingCapabilityConfig that scopes
shared knowledge-base access to a configured allowlist of
viking://resources/... URI prefixes.

The allowlist applies only to the viking://resources/ namespace: all
viking_* tools and the @-mention flow reject viking://resources/ URIs
outside the listed prefixes. Every other namespace (viking://user/...,
including the agent's own memories/sessions/skills and other users'
namespaces) is always allowed and governed by its own feature flags.

Empty list (default) preserves unrestricted behavior for backward
compatibility. viking_search/viking_find without a target_uri scope to
the first allowed prefix when an allowlist is set.
@Million-mo
Million-mo force-pushed the feat/viking-allowed-uri-prefixes branch from 6615fc8 to 6c57bfe Compare August 18, 2026 12:22
@Million-mo
Million-mo merged commit 3fba88c into wolf1069b:main Aug 19, 2026
12 checks passed
@Million-mo
Million-mo deleted the feat/viking-allowed-uri-prefixes branch August 19, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant