Skip to content

docs: attenuation by narrowing design doc - #1047

Draft
ci-belphegor wants to merge 1 commit into
mainfrom
grypez/narrowing-1-docs
Draft

docs: attenuation by narrowing design doc#1047
ci-belphegor wants to merge 1 commit into
mainfrom
grypez/narrowing-1-docs

Conversation

@ci-belphegor

Copy link
Copy Markdown

Explanation

Design doc for attenuation by narrowing: a restricted form of attenuation in which every method of the derived capability is an unaltered forward to the same method of the capability it narrows, admitting a subset of that method's arguments. The restriction buys something worth having — narrowings of a common capability form a lattice whose join is computable syntactically, so overlapping grants combine without ambiguity.

Also adds a narrowing entry to the glossary.

This document is normative for semantics. The implementation follows in the rest of this stack.

Notes for reviewers

Four claims in this document were corrected during implementation, each after being measured rather than argued about. They are worth knowing because they are the parts most likely to be wrong again:

  • A delta position landing in a rest guard constrains every trailing argument, not only the one named — a rest guard is a single pattern. It stays sound, and errs toward less authority than intended.
  • pathUnder confines nothing on its own. A pattern cannot see inside a segment, so ['srv', 'data/../../etc'] satisfies pathUnder(['srv']) and resolves to /etc. The capability must reject malformed segments separately.
  • fs does not actually enforce anti-aliasing, which an earlier draft claimed it did. lstat follows every intermediate component, so makeNoSymlinksCaveat catches only a final-position symlink. Documented as an unmet obligation with a Roadmap entry rather than fixed here.
  • No typed array can cross an exo boundary (@endo/pass-style rejects Buffer and Uint8Array as mutable; harden does not help), so readFile takes a required encoding and returns a string.

Stack

PR 1 of 12. Base: main.

Specifies narrowing — attenuation restricted to unaltered method forwards
over subsets of a base's arguments — as a library exported from
`@metamask/kernel-utils`, the fs capability it is first applied to, and the
kernel integration it is meant to lead to. Adds a `narrowing` glossary entry.

No code; the implementation follows in separate pull requests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ci-belphegor
ci-belphegor force-pushed the grypez/narrowing-1-docs branch from 598072a to 8a78cf0 Compare September 11, 2026 11:42
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