Skip to content

v0.7.2

Latest

Choose a tag to compare

@github-actions github-actions released this 28 Oct 17:06
· 1 commit to develop since this release
v0.7.2
d0139dc

Release v0.7.2: Remote Path Boundary Hardening & Symlinked CWD Confinement

Release v0.7.2 is a security and stability patch release hardening remote path containment across okf hub pull, okf hub sync, okf pull, okf restore, and okf vendor remove, introducing staging-directory atomic rollbacks for registry installations, and resolving a false-positive traversal error when mutating relative bundles from a symlinked working directory.


1. Security Hardening & Bug Fixes

Remote Input Write Containment in Hub Sync & Registry Installs (#64)

  • Problem: okf hub pull, okf hub sync, okf pull, and okf restore derived filesystem destination paths from remote data (hub tree manifests, registry bundle IDs, okf.lock entries, and archive headers) without uniformly rejecting parent traversal (..), absolute paths, hidden dotfiles (e.g. .git/hooks/*, .okf-vault.json), or symlinks resolving outside the bundle or workspace. Furthermore, okf pull --force and okf restore --force unpacked directly into the target path and executed os.RemoveAll on validation failure, allowing an escaping bundle ID or symlink to delete directories outside the workspace or wipe a preexisting installation.
  • Resolution:
    • Hub Sync Tree & State Confinement (pkg/sync): Added validateTreePath / validateTreePaths to reject empty, absolute, volume-qualified, non-canonical (., .., //), hidden (.git, .okf-vault.json, .okf), NUL-byte, and backslash paths before any blob is fetched. Added hubTargets and containedPath to pre-verify every write and delete destination via filepath.EvalSymlinks and filepath.Rel (all-or-nothing commit application). Confined .okf/sync-state.json reads and writes to the resolved bundle root and ignored poisoned delete bases in stored state.
    • Registry Bundle ID & Archive Confinement (pkg/registry): Added ValidateBundleID and ResolveVendorDir to enforce canonical relative slash-separated IDs (preserving legitimate scoped and nested IDs such as @peter/django-5-rules and acme/tools/linter) and verify that .okf/vendor resolves within the workspace and each bundle resolves strictly inside .okf/vendor. Hardened DownloadAndExtract to pre-verify all archive entries lexically and through symlinks prior to extraction.
    • Staged Installations & Safe Rollback (internal/cli, pkg/registry): Added Staging (NewStaging, Commit, Discard). okf pull and okf restore now extract and validate bundles inside a fresh .okf/.vendor-staging-* directory before atomically committing them into .okf/vendor. Failed installs discard only the staging directory created by that invocation, preserving any previous --force installation and never following symlinks during rollback or okf vendor remove.
  • Credit: Reported via responsible disclosure with reproduction fixtures and implemented by Nick Hodulik (@nhod) in PR #64.

Symlinked Working Directory Bundle Root Resolution (#62, #63)

  • Problem: ensureWithinRoot in pkg/okf (and containedPath in pkg/sync) called filepath.EvalSymlinks before filepath.Abs. When okf was invoked with a relative bundle root (e.g. knowledge) from a symlinked working directory (such as macOS /tmp $\rightarrow$ /private/tmp), EvalSymlinks returned a relative path while target paths resolved to their canonical target under /private/tmp, causing legitimate writes to be refused as path traversal escapes.
  • Resolution: Normalized the bundle root to an absolute path via filepath.Abs before calling filepath.EvalSymlinks, ensuring both root and target resolve through the same working-directory symlinks.
  • Credit: Reported in #62 and implemented in PR #63 by Nick Hodulik (@nhod).

2. Knowledge & Architecture


3. Community & Special Thanks

  • Nick Hodulik (@nhod): For responsible security disclosure, comprehensive boundary test suites, and implementing remote path containment & staged registry rollbacks in #64, as well as diagnosing and fixing symlinked working directory root resolution in #62 and #63.

🌐 Discover & Share Knowledge: OKF Registry

Scale persistent memory across projects and agent sessions with the decentralized OKF Registry:

  • Browse & Share: Discover curated, quality-scored memory packages (e.g. framework best practices, architecture rules, compliance guidelines) at registry.okf-memory.dev.
  • Install in Seconds: Pull external knowledge directly into .okf/vendor/ with zero dependencies:
    okf pull <bundle-id>
  • Guaranteed Conformance: Every package is verifiable against Open Knowledge Quality Scorecards (--min-score) with atomic rollback to ensure deterministic agent consumption.

Pre-built Binaries & Verification

Release binaries are automatically built by GitHub Actions:

Full Changelog

Full Changelog: v0.7.1...v0.7.2