Skip to content

fix(module): accept Windows creator-owner module cache ACL - #25

Merged
senamakel merged 3 commits into
tinyhumansai:mainfrom
senamakel:windows-memory-module-load
Sep 25, 2026
Merged

senamakel merged 3 commits into
tinyhumansai:mainfrom
senamakel:windows-memory-module-load

Conversation

@senamakel

@senamakel senamakel commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Trust the running process SID and Windows CREATOR OWNER placeholder when admitting a native module directory.
  • Keep refusing directories and module files that grant write access to Everyone, and require a trusted file owner.
  • Add Windows regression tests for inherited CREATOR OWNER, the process SID, and broad write grants on directories and files.

Why

OpenHuman 0.64.0 reports Sentry issue TAURI-RUST-113D: its TinyMemory module is refused on Windows with module directory is writable by another user. The ACL scan classified both an inherited CREATOR OWNER entry and an explicit write ACE for the running account as unrelated writers when the directory owner SID differs from the process SID. The Windows CI runner reproduced that ACL shape.

Validation

  • cargo fmt --all -- --check
  • cargo test --locked -p tinybus --features modules module::host::tests --lib -- --nocapture (33 passed, 10 fixture-dependent ignored on macOS)
  • Windows ACL regression tests run in the repository's Windows CI lane (latest run pending).

The OpenHuman gitlink update will follow this upstream fix.

@tinysweeper

tinysweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

This pull request adds support for the CREATOR OWNER well-known SID and the current process user SID in the Windows ACL check. Review across 6 lanes found 3 active actionable findings: the CREATOR OWNER SID is trusted unconditionally, which may grant write access to untrusted accounts; and the new user-SID trust path lacks a regression test. The change is not safe to merge as-is.

State: Changes requested
Priority: high
Reviewed head: 8d4f42f36ad8
Updated: 1790358914 (Unix time)

Review snapshot

Change surface Files Review signal Count
Production 1 Active findings 7
Tests 1 Noted findings 0
Documentation 0 Resolved findings 5
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

Modifies `windows_directory_grants_untrusted_write` to treat the CREATOR OWNER well-known SID and the current process token user SID as trusted when checking ACLs, with two added Windows tests. This prevents false refusals for directories with inheritable creator-owner permissions, but introduces an unconditional trust for CREATOR OWNER that may accept directories writable by an untrusted account.

Features

  • Added — Accept CREATOR OWNER and current user SID in Windows ACL check: Prevents false positives when a module directory's ACL includes an inheritable CREATOR OWNER entry or when the current process user has an explicit ACE. However, trusting CREATOR OWNER unconditionally may grant write access to untrusted accounts if a malicious directory has a CREATOR OWNER ACE. The user-SID path lacks a dedicated test. (crates/tinybus/src/module/host.rs#fn windows_directory_grants_untrusted_write(path: &Path) -> Result<bool> {)

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

  • high · critique · Do not trust CREATOR OWNER unconditionally — This treats every allowed ACE whose SID is CREATOR OWNER as trusted, without checking whether the ACE is inherit-only or whether its mask grants any write permission. A directory A (crates/tinybus/src/module/host\.rs:2074)
  • medium · critique · Test acceptance of an explicit current-user write ACE — The implementation now trusts the process token's user SID, but the tests only cover CREATOR OWNER and Everyone. They do not establish the new contract that a directory writable by (crates/tinybus/src/module/host\_test\.rs:1141)
  • high · security · Do not trust CREATOR OWNER as an unconditional principal — This accepts any write-capable ACE whose SID is CREATOR OWNER without checking that it is inherit-only or otherwise limited to the intended inheritance semantics. A directory with (crates/tinybus/src/module/host\.rs:2074)
  • medium · security · Test the new user-SID trust path — The new process-token SID is now accepted as trusted, but the Windows tests only cover CREATOR OWNER and Everyone. Add a test that grants write access specifically to the current u (crates/tinybus/src/module/host\.rs:2051)
  • medium · tests · Test the new user-SID trust path — The new code trusts the current process user SID when checking directory ACLs, but there is no test that verifies this path. Add a test that creates a directory with an explicit AC (crates/tinybus/src/module/host\.rs:2071)
  • high · description · Do not trust CREATOR OWNER unconditionally — The well-known CREATOR OWNER SID is now unconditionally trusted as a writer, without checking whether the ACE carries an inherit-only flag. Trusting CREATOR OWNER is only safe when (\(pull request description\))
  • medium · description · Test the new user-SID trust path — The change adds the current process user's SID to the trusted writers but no test exercises that path. A test should grant the process user an explicit write ACE and assert the dir (\(pull request description\))

Resolved this pass

  • Do not treat the current user as the only trusted account
  • Do not treat the current user as the only trusted account
  • Do not trust CREATOR OWNER as an unconditional principal
  • Do not treat the current user as the only trusted account
  • Do not treat the current user as the only trusted account

Before merge

  • Address Do not trust CREATOR OWNER unconditionally (crates/tinybus/src/module/host\.rs).
  • Address Do not trust CREATOR OWNER as an unconditional principal (crates/tinybus/src/module/host\.rs).
  • Address Do not trust CREATOR OWNER unconditionally (\(pull request description\)).

How this fits together

flowchart LR
  n0["attach_raw"]:::impacted
  n1["ModuleInfo"]:::impacted
  n2["load_dir"]:::impacted
  n3["register_lazy"]:::impacted
  n0 -->|uses| n1
  n2 -->|uses| n1
  n2 -->|calls| n3
  n3 -->|uses| n1
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Failure
  • Scope reviewed: all assigned evidence
  • Lane summary: The change adds current-user and CREATOR OWNER recognition to the Windows ACL check, but it still contains an unconditional CREATOR OWNER trust decision and lacks coverage for the new current-user path. It is not safe to merge without addressing the remaining ACL trust concern and adding the missing regression test. (2 earlier finding(s) still open) (1 observation(s) grouped into shared inline comments) _The code index is behind this pull request (indexed at `67a3a8af37ef`), so retrieved context may be out of date._ _Memory was unavailable (model: cortex: v1/recall: timed out after 10s), so this review ran without it._
  • Evidence: crates/tinybus/src/module/host\.rs — Do not trust CREATOR OWNER unconditionally
  • Evidence: crates/tinybus/src/module/host\_test\.rs — Test acceptance of an explicit current-user write ACE

security

  • Conclusion: Failure
  • Scope reviewed: all assigned evidence
  • Lane summary: The current-user trust path is now present, but the Windows ACL check still treats CREATOR OWNER as an unconditional trusted principal and lacks coverage for the new SID path. The change is not safe to merge. _The code index is behind this pull request (indexed at `67a3a8af37ef`), so retrieved context may be out of date._ _Memory was unavailable (model: cortex: v1/recall: timed out after 10s), so this review ran without it._
  • Evidence: crates/tinybus/src/module/host\.rs — Do not trust CREATOR OWNER as an unconditional principal
  • Evidence: crates/tinybus/src/module/host\.rs — Test the new user-SID trust path

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: This change adds trust for the CREATOR OWNER SID and the current user SID in the Windows directory security check, and adds two Windows tests. The user-SID trust path remains untested. _The code index is behind this pull request (indexed at `67a3a8af37ef`), so retrieved context may be out of date._ _Memory was unavailable (model: cortex: v1/recall: timed out after 10s), so this review ran without it._
  • Evidence: crates/tinybus/src/module/host\.rs — Test the new user-SID trust path

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Failure
  • Scope reviewed: all assigned evidence
  • Lane summary: The change adds CREATOR OWNER and the current process user SID to the trusted SID list for Windows module directory ACL checks, with regression tests for CREATOR OWNER and Everyone. The earlier concern about unconditionally trusting CREATOR OWNER remains, and a test for the user-SID trust path is still missing. (1 earlier finding(s) still open) _The code index is behind this pull request (indexed at `67a3a8af37ef`), so retrieved context may be out of date._ _Memory was unavailable (model: cortex: v1/recall: timed out after 10s), so this review ran without it._
  • Evidence: \(pull request description\) — Do not trust CREATOR OWNER unconditionally
  • Evidence: \(pull request description\) — Test the new user-SID trust path

e2e

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: No end-to-end harness in this repository: no e2e test files and no e2e workflow.
Evidence and run details
  • Models: ladder/vectors, gpt-5.6-luna, deepseek-v4-flash
  • Spend: $0.003762
  • Tokens: 117532 input · 23201 output · 14552 cached · 380 embedding
Head State Pass summary
724bf4ee22f2 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 1790357861)
4d2e71e13b65 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 1790358027)
8d4f42f36ad8 changes requested 3 active finding(s), 0 resolved finding(s) (at 1790358380)
8d4f42f36ad8 changes requested 7 active finding(s), 5 resolved finding(s) (at 1790358914)

tinysweeper 0.1.0

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: d5751ae8-653c-4177-90dc-e6a05696b1e4

📥 Commits

Reviewing files that changed from the base of the PR and between 6ee8258 and 8d4f42f.

📒 Files selected for processing (2)
  • crates/tinybus/src/module/host.rs
  • crates/tinybus/src/module/host_test.rs
 ______________________________________________________
< Your bugs are no match for my GPU-powered intellect. >
 ------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Comment @coderabbitai help to get the list of available commands.

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking. Approving.

             $0.0027 · 112,564 in / 9,178 out · 20,876 cached (19%) · ladder/vectors, gpt-5.6-luna, deepseek-v4-flash · 285 embedded
critique:    $0.0010 · 35,132 in  / 1,658 out · 2,112 cached (6%)   · gpt-5.6-luna
security:    $0.0009 · 34,644 in  / 1,140 out · 1,868 cached (5%)   · gpt-5.6-luna
tests:       $0.0005 · 32,860 in  / 4,102 out · 15,360 cached (47%) · deepseek-v4-flash
description: $0.0001 · 7,173 in   / 589 out   · 1,536 cached (21%)  · deepseek-v4-flash

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Sep 25, 2026
@senamakel
senamakel merged commit 50eae54 into tinyhumansai:main Sep 25, 2026
13 of 15 checks passed

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: 1 lane(s) blocking, worst finding is high.

Fix or reply to the findings below and push. The next review clears this automatically once they are gone — you should not need to dismiss anything by hand.

             $0.0049 · 179,613 in / 17,074 out · 9,432 cached (5%)  · ladder/vectors, gpt-5.6-luna, deepseek-v4-flash · 380 embedded
critique:    $0.0022 · 81,105 in  / 4,763 out  · 2,029 cached (3%)  · gpt-5.6-luna, deepseek-v4-flash
security:    $0.0019 · 68,771 in  / 2,756 out  · 5,355 cached (8%)  · gpt-5.6-luna
tests:       $0.0004 · 16,972 in  / 3,056 out  · 1,024 cached (6%)  · deepseek-v4-flash
description: $0.0003 · 8,520 in   / 5,059 out  · 1,024 cached (12%) · deepseek-v4-flash

Comment thread crates/tinybus/src/module/host.rs
Comment thread crates/tinybus/src/module/host.rs
Comment thread crates/tinybus/src/module/host.rs
@tinysweeper tinysweeper Bot added priority: p1 Next. Wrong behaviour a user will hit, or a security weakness behind a condition. and removed priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. labels Sep 25, 2026

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: 3 lane(s) blocking, worst finding is high.

Fix or reply to the findings below and push. The next review clears this automatically once they are gone — you should not need to dismiss anything by hand.

             $0.0038 · 117,532 in / 23,201 out · 14,552 cached (12%) · ladder/vectors, gpt-5.6-luna, deepseek-v4-flash · 380 embedded
critique:    $0.0014 · 39,214 in  / 6,148 out  · 4,160 cached (11%)  · gpt-5.6-luna, deepseek-v4-flash
security:    $0.0015 · 49,658 in  / 2,760 out  · 3,736 cached (8%)   · gpt-5.6-luna
tests:       $0.0005 · 14,242 in  / 8,030 out  · 2,048 cached (14%)  · deepseek-v4-flash
description: $0.0002 · 5,752 in   / 4,402 out  · 1,024 cached (18%)  · deepseek-v4-flash


#[cfg(windows)]
#[test]
fn a_creator_owner_cache_directory_is_accepted() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

priority medium critique confident

Test acceptance of an explicit current-user write ACE

The implementation now trusts the process token's user SID, but the tests only cover CREATOR OWNER and Everyone. They do not establish the new contract that a directory writable by the current user is accepted, nor distinguish that case from a directory writable by another account. Add a Windows test that grants write access to the current token's user SID and verifies acceptance, plus a distinct non-current-user principal case.

[RULE] missing-regression-test ·

|| unsafe { EqualSid(sid, admin_sid.as_ptr().cast()) } != 0
|| unsafe { EqualSid(sid, system_sid.as_ptr().cast()) } != 0;
|| unsafe { EqualSid(sid, system_sid.as_ptr().cast()) } != 0
// CREATOR OWNER is an inheritable placeholder for the owner

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

priority high security confident

Do not trust CREATOR OWNER as an unconditional principal

This accepts any write-capable ACE whose SID is CREATOR OWNER without checking that it is inherit-only or otherwise limited to the intended inheritance semantics. A directory with this ACE can grant the creator of a child module ownership and write access, allowing another account to replace a module that this check admits. Only accept CREATOR OWNER when the ACE flags prove it cannot grant write access to an untrusted account for the directory or its module children, or reject it by default.


Additional critique observation

priority high likely

Do not trust CREATOR OWNER unconditionally

[RULE] unconditional-principal-trust

This treats every allowed ACE whose SID is CREATOR OWNER as trusted, without checking whether the ACE is inherit-only or whether its mask grants any write permission. A directory ACL containing a CREATOR OWNER ACE with write access that applies to the directory can therefore be classified as safe even though the effective creator/owner principal is not necessarily one of the explicitly trusted principals. Model the ACE inheritance/effective-principal semantics, or only accept CREATOR OWNER when the ACE cannot grant write access to the checked directory itself.

[RULE] unsafe-acl-principal ·

if user_read == 0 {
return true;
}
let user_sid = unsafe { (*user.as_ptr().cast::<SidAndAttributes>()).sid };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

priority medium security confident

Test the new user-SID trust path

The new process-token SID is now accepted as trusted, but the Windows tests only cover CREATOR OWNER and Everyone. Add a test that grants write access specifically to the current user's SID and verifies admission, plus a contrasting test for a different user SID, so this security-sensitive exception is exercised rather than only compiled.

[RULE] missing-security-test ·

let trusted = unsafe { EqualSid(sid, owner) } != 0
// A directory's owner may be Administrators even when this
// process has its own explicit full-control ACE.
|| unsafe { EqualSid(sid, user_sid) } != 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

priority medium tests confident

Test the new user-SID trust path

The new code trusts the current process user SID when checking directory ACLs, but there is no test that verifies this path. Add a test that creates a directory with an explicit ACE granting full control to the current user (e.g., via icacls /grant "*S-1-5-21-...:F") and asserts that windows_directory_grants_untrusted_write returns false.

[RULE] untested-behaviour ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p1 Next. Wrong behaviour a user will hit, or a security weakness behind a condition.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant