Repository navigation
Keep plugin scan fields separate from manifest contents #17283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: Formal checks | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - .github/workflows/formal.yml | ||
| - test/formal/** | ||
| - shell/services/PluginRegistry.qml | ||
| - test/shell.d/plugin-manifest-scan-test.sh | ||
| - test/shell.d/fixtures/plugin-registry/** | ||
| push: | ||
| branches: [quattro] | ||
| paths: | ||
| - .github/workflows/formal.yml | ||
| - test/formal/** | ||
| - shell/services/PluginRegistry.qml | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| plugin-scan: | ||
| runs-on: ubuntu-26.04 | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Install pinned Muro | ||
| shell: bash | ||
| run: | | ||
| curl -fsSL --retry 3 -o "$RUNNER_TEMP/muro" https://github.com/murolang/muro/releases/download/v0.20.3/muro-0.20.3-linux-x86_64 | ||
| echo "90e6a1462c36baf63ef8e657f41ea1b81d96c81d517a551e946f937d2e19aec8 $RUNNER_TEMP/muro" | sha256sum -c - | ||
| chmod +x "$RUNNER_TEMP/muro" | ||
| - name: Check framing evidence | ||
| shell: bash | ||
| run: | | ||
| "$RUNNER_TEMP/muro" check test/formal/plugin-scan.muro | ||
| - name: Check that evidence rejects framing mutations | ||
| shell: bash | ||
| run: | | ||
| "$RUNNER_TEMP/muro" mutate test/formal/plugin-scan.muro --only frame --only read-field --max-survivors 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Formal checks | ||
|
|
||
| The plugin scanner uses three NUL-terminated fields per record: origin, source directory and manifest. The origin and directory come from the scanner's traversal. Manifest contents must never supply another record or change that origin. | ||
|
|
||
| [plugin-scan.muro](plugin-scan.muro) models framing and reading a field. A text token represents any non-NUL code unit; a boundary token represents NUL. Bash variables and filesystem names cannot contain NUL. The model starts at that transport boundary, after Bash has read the file into a variable. | ||
|
|
||
| The evidence proves that reading a framed field returns exactly its contents and the entire following stream, for every field and suffix. Applied to each of the three fields, this keeps manifest text from becoming the origin or source of another record. Newlines, old record markers and arbitrary field lengths are covered by the quantified theorem. | ||
|
|
||
| Use Muro 0.20.3, which includes the imported standard library: | ||
|
|
||
| ~~~bash | ||
| mise install github:murolang/muro@0.20.3 | ||
| mise exec github:murolang/muro@0.20.3 -- muro check test/formal/plugin-scan.muro | ||
| mise exec github:murolang/muro@0.20.3 -- muro mutate test/formal/plugin-scan.muro --only frame --only read-field --max-survivors 0 | ||
| ~~~ | ||
|
|
||
| This installs a separate tool version without changing the user's global selection. The formal-check workflow uses the same release and verifies the executable against a pinned SHA-256. | ||
|
|
||
| The proof covers the Muro framing model. The implementation connection is checked by the existing plugin-manifest-scan test, which runs the actual Bash scanner and registry parser against malformed local manifests and source names containing newlines. The registry fixture separately checks NUL preservation through Quickshell's native Process and StdioCollector. Those tests remain necessary: the proof does not verify Bash, Qt, JSON parsing or the implementation of Muro. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| -- The scanner writes three NUL-terminated fields per record: origin, source, | ||
| -- manifest. Bash variables and filesystem names cannot contain NUL. A text | ||
| -- token represents any non-NUL code unit, including newlines and old markers. | ||
| -- The theorem preserves both the field and the entire following stream. | ||
| import "std:list.muro" | ||
|
|
||
| data Wire : Type where | ||
| boundary : Wire | ||
| text : Nat → Wire | ||
|
|
||
| def frame : run Π (field : List Nat) → Π (rest : List Wire) → List Wire := | ||
| λ (field : List Nat) → λ (rest : List Wire) → | ||
| match field motive (λ _ → List Wire) | ||
| | nil => cons boundary rest | ||
| | cons c cs => cons (text c) (frame cs rest) | ||
|
|
||
| def read-field : run Π (wire : List Wire) → List Nat × List Wire := | ||
| λ (wire : List Wire) → | ||
| match wire motive (λ _ → List Nat × List Wire) | ||
| | nil => (nil, nil) | ||
| | cons token remaining => | ||
| match token motive (λ _ → List Nat × List Wire) | ||
| | boundary => (nil, remaining) | ||
| | text c => | ||
| let (field, rest) = read-field remaining in (cons c field, rest) | ||
|
|
||
| def framed-field-roundtrip : evidence Π (field : List Nat) → Π (rest : List Wire) → | ||
| {read-field (frame field rest) ≡ (field, rest) : List Nat × List Wire} := | ||
| λ (field : List Nat) → λ (rest : List Wire) → | ||
| match field motive (λ (xs : List Nat) → | ||
| {read-field (frame xs rest) ≡ (xs, rest) : List Nat × List Wire}) | ||
| | nil => refl | ||
| | cons c cs => | ||
| rewrite framed-field-roundtrip cs rest motive (λ pair → | ||
| {(let (contents, suffix) = pair in (cons c contents, suffix)) ≡ | ||
| (cons c cs, rest) : List Nat × List Wire}) in refl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the scanner stops between records, this check accepts its partial output as complete. Each whole record has three fields and ends with NUL, so even empty output passes.
scanProcess.onExitedalso ignoresexitCode.The parser then replaces
installedPluginswith the partial map, causing the shell to remove missing services and widgets instead of keeping the previous registry. Require successful scan completion before replacing the map, and test truncation between records alongside the existing missing-final-NUL case.