DD-469 follow-on: check Darwin extended ACLs in recovery_crypto key custody #45

Open
opened 2026-11-20 07:02:07 +00:00 by svc-agent-writer · 0 comments

This was generated by AI during the merge gate.

Problem

On Darwin, the key-custody code in src/attention_mind_mcp/recovery_crypto.py does not check extended ACLs. An extended ACL can grant access that the mode bits do not show. For example, an inherited everyone allow read entry makes a 0600 key file readable by other users.

_check_custody (lines 236-240 at main 35d15ff3) checks the file type, the mode (0700 for the directory, 0600 for a key file) and the owner. It does not check ACLs. Three paths use it:

  • _custody_directory (line 242), which opens the key directory;
  • write_key_copy (line 258), which creates a key file;
  • _read_key_file (line 300), which reads a key file.

Background

  • The merge-gate Security review of PR #44 (#30) found the same gap in the staging area (round 1, SEC4). The operator ruled to fix it in staging before merge and to leave recovery_crypto unchanged for now (#30, comment 43725). The PR #44 body records the residual.
  • PR #44 added a Darwin ACL check to recovery_staging.py (_no_acl). It reads the extended ACL through the pinned descriptor with acl_get_fd_np. A failure to load or bind the checker, or a query error other than ENOENT, counts as an ACL present, so the check fails closed. Other platforms skip it.
  • The #31 spec gives recovery_crypto.py to #31 only (open risk 1, "Downstream API freeze"). #32 to #35 cannot change it without expanding a write set. That is why this gap was not fixed with #30.

Acceptance criteria

  • On Darwin, the key directory and every key file are refused with a fixed code when they carry an extended ACL. This applies when the directory is opened, when a key file is created and when a key file is read.
  • A failure of the ACL checker fails closed, as in staging.
  • Refusals keep no exception cause or context, as elsewhere in the module.
  • Tests cover each path. Darwin-only tests skip on Linux CI, and a local Darwin run shows them passing with 0 skipped.
  • The existing key-custody tests pass unchanged.
  • The spec chooses whether to share the staging helper or keep a copy in recovery_crypto.

Human act

ruling: the operator authorizes recovery_crypto.py into a write set past the #31 downstream API freeze and picks when this runs (DD-469)

Refs #6, #30, #31.

Filed under: operator-word-d982c2768589

> *This was generated by AI during the merge gate.* ## Problem On Darwin, the key-custody code in `src/attention_mind_mcp/recovery_crypto.py` does not check extended ACLs. An extended ACL can grant access that the mode bits do not show. For example, an inherited `everyone allow read` entry makes a 0600 key file readable by other users. `_check_custody` (lines 236-240 at main 35d15ff3) checks the file type, the mode (0700 for the directory, 0600 for a key file) and the owner. It does not check ACLs. Three paths use it: - `_custody_directory` (line 242), which opens the key directory; - `write_key_copy` (line 258), which creates a key file; - `_read_key_file` (line 300), which reads a key file. ## Background - The merge-gate Security review of PR #44 (#30) found the same gap in the staging area (round 1, SEC4). The operator ruled to fix it in staging before merge and to leave `recovery_crypto` unchanged for now (#30, comment 43725). The PR #44 body records the residual. - PR #44 added a Darwin ACL check to `recovery_staging.py` (`_no_acl`). It reads the extended ACL through the pinned descriptor with `acl_get_fd_np`. A failure to load or bind the checker, or a query error other than `ENOENT`, counts as an ACL present, so the check fails closed. Other platforms skip it. - The #31 spec gives `recovery_crypto.py` to #31 only (open risk 1, "Downstream API freeze"). #32 to #35 cannot change it without expanding a write set. That is why this gap was not fixed with #30. ## Acceptance criteria - On Darwin, the key directory and every key file are refused with a fixed code when they carry an extended ACL. This applies when the directory is opened, when a key file is created and when a key file is read. - A failure of the ACL checker fails closed, as in staging. - Refusals keep no exception cause or context, as elsewhere in the module. - Tests cover each path. Darwin-only tests skip on Linux CI, and a local Darwin run shows them passing with 0 skipped. - The existing key-custody tests pass unchanged. - The spec chooses whether to share the staging helper or keep a copy in `recovery_crypto`. ## Human act ruling: the operator authorizes `recovery_crypto.py` into a write set past the #31 downstream API freeze and picks when this runs (DD-469) Refs #6, #30, #31. Filed under: operator-word-d982c2768589
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
dev/attention-mind-mcp#45
No description provided.