[PR #3406] [CLOSED] [TUI] Tests: compare ACL trustees through the SDDL alias #4620

Closed
opened 2026-11-07 15:37:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3406
Author: @jackbapa
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: fix/windows-builtin-administrator-sddl-alias


📝 Commits (1)

  • 449887a Tests: compare ACL trustees through the SDDL alias

📊 Changes

1 file changed (+13 additions, -7 deletions)

View changed files

📝 tests/terminal/test_private_files.py (+13 -7)

📄 Description

Problem and result

ef5d8ab (the fix for #3302) makes the product code accept the SDDL alias LA, but tests/terminal/test_private_files.py still compares the raw DACL text with current_user_sid(). On a host whose account is the built-in Administrator (RID 500) Windows renders that trustee as LA, so five existing tests fail even though the ACL is exactly what restrict_to_current_user() wrote:

  • test_a_directory_becomes_private_and_its_children_inherit
  • test_the_effective_acl_is_one_protected_entry_for_the_current_user
  • test_a_locked_file_is_read_again_after_the_repair
  • test_a_locked_folder_and_what_is_inside_are_repaired_as_a_tree
  • test_a_folder_made_with_private_mkdir_names_the_user_explicitly

After the change those five pass on such a host, and they still check the same thing: one protected ACE naming only the current user, with no Everyone, Users, Authenticated Users, SYSTEM or Administrators entry.

  • https://github.com/Niko1221/Strata/issues/3302 - product behaviour, closed by ef5d8ab. This PR does not touch production code; it covers the test gap that remains on a RID 500 host.
  • The branch originally carried the source fix; the conflict with ef5d8ab was resolved by keeping upstream's _same_sid() / _string_sid() and dropping the local _as_sid() implementation.

Approach

A module-level helper resolved(sddl) rewrites every trustee field through private_files._string_sid() (added upstream in ef5d8ab); the assertions then compare the string SID. _string_sid() returns its input unchanged when the field is not a resolvable alias, so ordinary accounts and POSIX output are compared exactly as before.

No production code is changed.

Validation

Passed:

  • Windows x86_64, signed in as the built-in Administrator (RID 500, S-1-5-21-...-500), Python 3.13.9:
    • python -m unittest tests.terminal.test_private_files -v at 449887a: 13 tests, OK (skipped=1) (the POSIX test).
    • python -m unittest tests.terminal.test_private_files tests.terminal.test_issues_022 -v: 38 tests, OK (skipped=1).
    • The same suite on unmodified origin/main 9de04cd: FAILED (failures=5, skipped=1), the five tests listed above.

Failed:

none observed.

Not run:

  • POSIX (Linux/macOS): no machine available. The helper only rewrites trustee fields and returns them untouched there; the POSIX test is skipped.
  • A second real Windows account: the alias-vs-different-SID case is already covered by test_issues_022.py::Issue3302AdministratorAlias.

Limits

Only the assertion text is normalised. A trustee alias that ConvertStringSidToSidW cannot resolve still has to match literally, which is the old behaviour.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3406 **Author:** [@jackbapa](https://github.com/jackbapa) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/windows-builtin-administrator-sddl-alias` --- ### 📝 Commits (1) - [`449887a`](https://github.com/Niko1221/Strata/commit/449887a32834108d4d6fe960f324ece6fdd7e0cf) Tests: compare ACL trustees through the SDDL alias ### 📊 Changes **1 file changed** (+13 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `tests/terminal/test_private_files.py` (+13 -7) </details> ### 📄 Description ## Problem and result `ef5d8ab` (the fix for #3302) makes the product code accept the SDDL alias `LA`, but `tests/terminal/test_private_files.py` still compares the raw DACL text with `current_user_sid()`. On a host whose account is the built-in Administrator (RID 500) Windows renders that trustee as `LA`, so five existing tests fail even though the ACL is exactly what `restrict_to_current_user()` wrote: - `test_a_directory_becomes_private_and_its_children_inherit` - `test_the_effective_acl_is_one_protected_entry_for_the_current_user` - `test_a_locked_file_is_read_again_after_the_repair` - `test_a_locked_folder_and_what_is_inside_are_repaired_as_a_tree` - `test_a_folder_made_with_private_mkdir_names_the_user_explicitly` After the change those five pass on such a host, and they still check the same thing: one protected ACE naming only the current user, with no Everyone, Users, Authenticated Users, SYSTEM or Administrators entry. ## Related discussion - https://github.com/Niko1221/Strata/issues/3302 - product behaviour, closed by `ef5d8ab`. This PR does not touch production code; it covers the test gap that remains on a RID 500 host. - The branch originally carried the source fix; the conflict with `ef5d8ab` was resolved by keeping upstream's `_same_sid()` / `_string_sid()` and dropping the local `_as_sid()` implementation. ## Approach A module-level helper `resolved(sddl)` rewrites every trustee field through `private_files._string_sid()` (added upstream in `ef5d8ab`); the assertions then compare the string SID. `_string_sid()` returns its input unchanged when the field is not a resolvable alias, so ordinary accounts and POSIX output are compared exactly as before. No production code is changed. ## Validation **Passed:** - Windows x86_64, signed in as the built-in Administrator (RID 500, `S-1-5-21-...-500`), Python 3.13.9: - `python -m unittest tests.terminal.test_private_files -v` at `449887a`: 13 tests, `OK (skipped=1)` (the POSIX test). - `python -m unittest tests.terminal.test_private_files tests.terminal.test_issues_022 -v`: 38 tests, `OK (skipped=1)`. - The same suite on unmodified `origin/main` `9de04cd`: `FAILED (failures=5, skipped=1)`, the five tests listed above. **Failed:** none observed. **Not run:** - POSIX (Linux/macOS): no machine available. The helper only rewrites trustee fields and returns them untouched there; the POSIX test is skipped. - A second real Windows account: the alias-vs-different-SID case is already covered by `test_issues_022.py::Issue3302AdministratorAlias`. ## Limits Only the assertion text is normalised. A trustee alias that `ConvertStringSidToSidW` cannot resolve still has to match literally, which is the old behaviour. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:37:53 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4620
No description provided.