restic/changelog/unreleased
Aneesh N b9afdf795e
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
test / Linux Go 1.24.x (push) Has been cancelled
test / Linux (race) Go 1.25.x (push) Has been cancelled
test / Windows Go 1.25.x (push) Has been cancelled
test / macOS Go 1.25.x (push) Has been cancelled
test / Linux Go 1.25.x (push) Has been cancelled
test / Cross Compile for subset 0/3 (push) Has been cancelled
test / Cross Compile for subset 1/3 (push) Has been cancelled
test / Cross Compile for subset 2/3 (push) Has been cancelled
test / lint (push) Has been cancelled
test / docker (push) Has been cancelled
Create and publish a Docker image / provenance (push) Has been cancelled
test / Analyze results (push) Has been cancelled
Fix: Correctly restore ACL inheritance state (#5465)
* Fix: Correctly restore ACL inheritance state

When restoring a file or directory on Windows, the `IsInherited` property of its Access Control Entries (ACEs) was always being set to `False`, even if the ACEs were inherited in the original backup.

This was caused by the restore process calling the `SetNamedSecurityInfo` API without providing context about the object's inheritance policy. By default, this API applies the provided Discretionary Access Control List (DACL) as an explicit set of permissions, thereby losing the original inheritance state.

This commit fixes the issue by inspecting the `Control` flags of the saved Security Descriptor during restore. Based on whether the `SE_DACL_PROTECTED` flag is present, the code now adds the appropriate `PROTECTED_DACL_SECURITY_INFORMATION` or `UNPROTECTED_DACL_SECURITY_INFORMATION` flag to the `SetNamedSecurityInfo` API call.

By providing this crucial inheritance context, the Windows API can now correctly reconstruct the ACL, ensuring the `IsInherited` status of each ACE is preserved as it was at the time of backup.

* Fix: Correctly restore ACL inheritance flags

This commit resolves an issue where the ACL inheritance state (`IsInherited` property) was not being correctly restored for files and directories on Windows.

The root cause was that the `SECURITY_INFORMATION` flags used in the `SetNamedSecurityInfo` API call contained both the `PROTECTED_DACL_SECURITY_INFORMATION` and `UNPROTECTED_DACL_SECURITY_INFORMATION` flags simultaneously. When faced with this conflicting information, the Windows API defaulted to the more restrictive `PROTECTED` behavior, incorrectly disabling inheritance on restored items.

The fix modifies the `setNamedSecurityInfoHigh` function to first clear all existing inheritance-related flags from the `securityInfo` bitmask. It then adds the single, correct flag (`PROTECTED` or `UNPROTECTED`) based on the `SE_DACL_PROTECTED` control bit from the original, saved Security Descriptor.

This ensures that the API receives unambiguous instructions, allowing it to correctly preserve the inheritance state as it was at the time of backup. The accompanying test case for ACL inheritance now passes with this change.

* Fix inheritance flag handling in low-privilege security descriptor restore

When restoring files without admin privileges, the IsInherited property
of Access Control Entries (ACEs) was not being preserved correctly.
The low-privilege restore path (setNamedSecurityInfoLow) was using a
static PROTECTED_DACL_SECURITY_INFORMATION flag, which always marked
the restored DACL as explicitly set rather than inherited.

This commit updates setNamedSecurityInfoLow to dynamically determine
the correct inheritance flag based on the SE_DACL_PROTECTED control
flag from the original security descriptor, matching the behavior of
the high-privilege path (setNamedSecurityInfoHigh).

Changes:
- Update setNamedSecurityInfoLow to accept control flags parameter
- Add logic to set either PROTECTED_DACL_SECURITY_INFORMATION or
  UNPROTECTED_DACL_SECURITY_INFORMATION based on the original SD
- Add TestRestoreSecurityDescriptorInheritanceLowPrivilege to verify
  inheritance is correctly restored in low-privilege scenarios

This ensures that both admin and non-admin restore operations correctly
preserve the inheritance state of ACLs, maintaining the original
permissions flow on child objects.

Addresses review feedback on PR for issue #5427

* Refactor security flags into separate backup/restore variants

Split highSecurityFlags into highBackupSecurityFlags and
highRestoreSecurityFlags to avoid runtime bitwise operations.
This makes the code cleaner and more maintainable by using
appropriate flags for GET vs SET operations.

Addresses review feedback on PR for issue #5427

---------

Co-authored-by: Aneesh Nireshwalia <anireshw@akamai.com>
2025-11-28 19:22:47 +00:00
..
.gitignore Add gitignore to changelog/unreleased 2020-11-05 09:01:32 +01:00
issue-3326 restic check with snapshot filters (#5469) 2025-11-28 19:12:38 +00:00
issue-3572 feat(internal/fs/node): Restore ownership by name 2025-11-16 16:40:58 +01:00
issue-3738 Allow for a personal token to be specified for self-updates (#5568) 2025-11-17 21:39:39 +01:00
issue-4467 backup: return exit code 3 if not all targets are available (#5347) 2025-10-05 15:38:52 +02:00
issue-4728 Add support for additional compression levels fastest and better (#5321) 2025-03-31 21:21:12 +02:00
issue-4868 changelog: add changelog entry for issue-4868 2025-03-29 13:27:50 +05:30
issue-5233 chore: update changelog for issue-5233 2025-03-30 14:12:06 +05:30
issue-5258 changelog: add bugfix changelog for issue-5258 2025-09-13 23:32:40 +05:30
issue-5352 feat(backup): add possibility to exclude macOS cloud-only files 2025-10-04 19:22:51 +02:00
issue-5354 extend background handling changelog 2025-09-08 11:04:53 +02:00
issue-5383 Reduce terminal progress fps to 10 2025-10-04 17:34:40 +02:00
issue-5440 feat: allow override env RESTIC_HOST with flag to filter all snapshots (#5541) 2025-10-05 13:22:50 +02:00
issue-5453 align docs 2025-11-23 17:51:07 +01:00
issue-5477 add changelog 2025-10-05 16:14:16 +02:00
issue-5487 Bugfix(sftp): fix loose permissions on sftp backend. (#5497) 2025-10-03 18:20:52 +00:00
issue-5531 changelog: add a changelog entry for azure PutBlob API changes 2025-10-05 21:48:02 +05:30
issue-5586 snapshots: correctly handle --latest in combination with --group-by 2025-11-17 22:26:57 +01:00
issue-5595 backend/local: fix "operation not supported" when unlocking 2025-11-16 08:09:51 -05:00
pull-4938 bump minimum go version to 1.24 2025-11-26 21:33:40 +01:00
pull-5319 restic copy - stattistics counters 2025-11-16 13:47:11 +01:00
pull-5424 fs: Clarified documentation 2025-11-16 11:53:13 -05:00
pull-5448 feat: add integrated nice and ionice options for docker (#5448) 2025-11-16 16:42:33 +01:00
pull-5465 Fix: Correctly restore ACL inheritance state (#5465) 2025-11-28 19:22:47 +00:00
pull-5523 Add OpenContainers labels to Dockerfile.release 2025-09-22 17:37:17 +00:00
pull-5588 snapshots: Show timezone in non-compact output 2025-11-18 13:32:44 +01:00
pull-5610 add changelog 2025-11-26 20:59:39 +01:00