OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

Skill privacy extractor records plain URIs from SKILL.md, which then corrupts generated sidecars and stored text

Open timacek opened this issue 1 month ago • 4 comments

Summary

The skill-privacy extractor records plain URIs from assignment-style text in a SKILL.md as "private config values". From that moment the privacy sanitizer rewrites every occurrence of that literal in stored content, including system-generated metadata: the generated .abstract.md frontmatter becomes invalid YAML, so the skill loses its abstract, GET /api/v1/skills returns description: "", and the session-start <available-skills> catalog lists it by name only.

This is not the same failure as #6457 (which reports yaml.safe_load aborting on a legacy, frontmatter-free preview that already carries a privacy reference). Here the reference exists because the extractor put it there, in a frontmatter-bearing sidecar, and the observable damage is metadata loss rather than a dead vectorization job. Both share the same parser, so I cross-reference them; feel free to merge if you judge it one fix.

Environment

  • OpenViking v0.5.2.1 (Docker image ghcr.io/volcengine/openviking:latest), auth_mode: api_key, single account/user
  • Default server config, no privacy section anywhere, nothing tuned
  • Skills installed through the add_skill MCP tool; extraction VLM = deepseek-flash

Steps to reproduce

  1. Install a skill into viking://agent/skills whose SKILL.md contains an assignment-style URI, e.g. Install with target_uri="viking://agent/skills" when other users must see it.
  2. privacy_tree now shows category skill, target <skill>, field target_uri, value viking://agent/skills — a plain URI recorded as a private value.
  3. Install an unrelated second skill into the same root.
  4. ov skills show <second> --output json → "description": "", abstract "# viking://agent/skills/<second> [Directory abstract is not ready]".
  5. read viking://agent/skills/<second>/.abstract.md:
    ---
    directory: {{ov_privacy:<user>:viking://~/privacy/skill/<first>#/values/target_uri}}/<second>/
    generated_by:
      component: SkillProcessor
      trigger: skill_ingest
    ---
    
  6. Log: WARNING ... Malformed directory abstract for viking://agent/skills/<second>: invalid abstract overview YAML: while parsing a block mapping; one error per skill lands in the Semantic queue.

Expected

Either the extractor ignores plain resource paths, or the generated sidecar stays parseable and the skill keeps its description.

Actual

The sidecars are permanently unparseable, the description disappears from the skills API and from every session's skill catalog, and the failure is silent — search still finds the skill (81 % in our test), so nothing surfaces to the user.

Root cause

  1. openviking/utils/skill_processor.py::prepare_skill_privacy runs extract_skill_privacy_values (prompt skill.privacy_extraction). That prompt asks for "user-maintained config items" and explicitly accepts values "shown only as a placeholder/example", so target_uri="viking://agent/skills" is classified as private config and stored under skill/<skill>/<field>. A resource URI is not a secret.
  2. The privacy substitution then runs over content written through the pipeline, including the generated .abstract.md / .overview.md (generated_by.component = SkillProcessor, i.e. system output, not user content). .abstract.md and .overview.md are listed as internal names in openviking/storage/internal_names.py, so the exclusion concept exists but is not applied here.
  3. The frontmatter is serialized correctly with yaml.safe_dump, but the substitution happens after serialization: directory: viking://agent/skills/<name>/ turns into directory: {{ov_privacy:...}}/<name>/, and a scalar starting with { is a flow mapping — the YAML parse fails.

v0.5.2.1's changelog says automatic Session privacy discovery was temporarily disabled (#6680) because it replaced ordinary message content (see also #6575 and the closed #3791 for the same family of over-reach). The skill ingestion path still discovers new values, and its substitutions also reached stored memory text in our instance: one Experience file and one Events memory were written with placeholders instead of the path they described.

Suggested fixes

  • Do not sanitize system-generated metadata: skip .abstract.md / .overview.md (the names already exist in internal_names.py), or re-serialize the frontmatter after substitution, or quote scalars that start with { (the parser-side fix in #6457 covers legacy previews).
  • Tighten the extractor: a bare URI or filesystem path is not a secret; require secret-shaped values or an explicit declaration in the SKILL.md. Do not register a value that appears as a path in the document's own metadata.
  • Expose a switch to disable skill privacy extraction (privacy currently has no config knobs at all).
  • Self-heal: when a stored sidecar fails to parse, regenerate it and log, instead of keeping it broken forever.
  • Also consider whether substitutions should apply to memory files written outside the skill pipeline.

Workaround (verified end-to-end)

GET    /api/v1/privacy-configs/tree
DELETE /api/v1/privacy-configs/{category}/{target_key}/field?field=<field>   # user/admin key

After deleting the false-positive field, installing an identical probe into the same viking://agent/skills root produced a populated description, a parsed abstract and no new warning — which isolates the registered value as the cause. Note that removing a skill does not delete its privacy config; delete the field first.

Practical rules we now follow:

  • keep personal skills in the user root (viking://user/<id>/skills) — its header never contains the registered literal;
  • never write key="viking://..." assignments in a SKILL.md (a prose mention of the same URI is not flagged — verified both ways);
  • audit after every install: privacy_tree plus skills show <name>.

Impact / severity

Metadata and content integrity, silent: descriptions vanish from the catalog every harness injects at session start, and stored text can be rewritten with placeholders. Suggested P2.

timacek avatar Nov 02 '26 08:11 timacek

Hi, I'd like to take this one.

Plan (smallest fix surface first, from the root-cause section):

  1. Extractor guard in openviking/privacy/skill_extractor.py::extract_skill_privacy_values — drop extracted values that are bare resource URIs/paths (a viking:// URI or plain filesystem path is not a secret; it identifies a location, not a credential). This stops the false-positive at registration time, which is what poisons .abstract.md frontmatter for every sibling skill.
  2. System-sidecar guard — make the skill-pipeline substitution path skip system-generated internal sidecars (.abstract.md / .overview.md names already exist in openviking/storage/internal_names.py), so even a legitimately registered value can never break generated metadata.

I'll keep the prompt template itself unchanged (its wording is fine once the deterministic guard exists) and add offline unit tests for both guards: an assignment-style target_uri="viking://agent/skills" extracted value is filtered out; a real secret-shaped value still registers; the sidecar skip does not affect user content sanitization.

PR to follow.

lester076 avatar Nov 02 '26 08:11 lester076

Opened #6911 with the two guards from my plan above:

  1. extract_skill_privacy_values now drops extracted values that are bare resource locations (any scheme:// URI or absolute filesystem path) before anything registers, so target_uri="viking://agent/skills" can no longer become a private value.
  2. ContentWriteCoordinator._write skips privacy substitution for the generated .abstract.md / .overview.md sidecars, so even a legitimately registered value cannot break system-generated metadata.

User content keeps the full sanitization path; 14 new offline tests pin both guards (including the mixed case where a real api_key from the same VLM response still registers).

lester076 avatar Nov 02 '26 10:11 lester076

Independent reproduction on v0.5.3 (ghcr.io/volcengine/openviking:latest, digest sha256:57d3fd88...), single account, all skills installed into viking://agent/skills.

Same symptom: after updating skills, add_skill tasks fail with invalid abstract overview YAML, GET /api/v1/skills returns description: "" for the affected skills, and the generated sidecar contains

directory: {{ov_privacy:admin:viking://...}}/<skill>/

Unlike the example in the report, the false positive here was not target_uri: the extractor recorded the shared/user skills roots declared in openviking-skills/SKILL.md as skill/openviking-skills#/values/openviking_account_shared_skills_root_uri (viking://agent/skills) and ..._user_skills_root_uri (viking://~/skills). Every sidecar under that root then became unparseable.

One additional data point for #6911: the sidecar guard added to ContentWriteCoordinator._write does not cover the skill-ingest path. write_abstract_overview() writes through VikingFS.write_file() (openviking/storage/viking_fs/_ops.py, sanitize at ~L2056 on main @3e0c9dcc), which still runs sanitizer.sanitize() over the whole string. On our instance, patching only content_write.py was not enough: sidecars regenerated during add_skill stayed invalid; adding the same frontmatter-exempt logic to VikingFS.write_file fixed it.

Suggestion: put the sidecar-aware sanitization in one shared helper and call it from both write paths (or have VikingFS.write_file call it when is_abstract_overview_uri(uri)), otherwise the PR may leave the skills pipeline producing invalid frontmatter.

Recovery used here: delete the false-positive privacy fields, rewrite the already-broken directory: lines to the real URI, then re-run the skill installs.

maomao94 avatar Nov 05 '26 03:11 maomao94

Thanks for the report and the follow-up reproductions. This is resolved by #7458, now merged into main.

Skill discovery now requires credential-shaped values, including when using the optional VLM extractor, so an assignment such as target_uri="viking://agent/skills" no longer registers that URI as a secret. Matching no longer uses values collected by unrelated Skills. The shared write-time handling also preserves generated metadata through both content writes and the VikingFS path used by Skill ingestion, preventing the reported description loss on new imports and updates.

Existing malformed sidecars are not regenerated automatically. The legacy-preview failure during reindexing remains tracked in #6457. Closing this extraction/metadata-corruption issue as fixed by #7458.

qin-ctx avatar Nov 17 '26 06:11 qin-ctx