Repository navigation
Fix #34 regressions and gaps (#35) - #36
Merged
Merged
Conversation
…old files, secure Configs alias, KeyError contract (#35) - tighten_mode: chmod only when the mode differs, warn instead of raising (import no longer crashes on a read-only or not-owned folder) - SecureTextFiles writes UTF-8 bytes, encoded before the file is truncated; keeps dol's key validation and KeyError contract - a managed configs folder's existing files lose group/other bits (symlinks not followed) - Configs alias is SecureTextFiles - secure_open is the builtin open with an owner_only_opener (honors encoding, O_BINARY) Claude-Session: https://claude.ai/code/session_01Ea4y3nEMhgmrx3XUpcUTMi
…hmod walk, secure_open mode note Claude-Session: https://claude.ai/code/session_01Ea4y3nEMhgmrx3XUpcUTMi
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #35 (all five points). Refs #33, #34.
tighten_mode: chmod only when the mode differs, warn instead of raising. Used bysecure_makedirsand the managed-folder re-tightening.SecureTextFilesencodes the value to UTF-8 before opening (so an unencodable value no longer leaves an emptied file) and writes bytes throughsecure_open..config2py), regular files lose group/other bits. Symlinks are not followed; unmanaged folders untouched.Configsalias is nowSecureTextFiles.validate_key, other failures re-raised asKeyError, as dol'sTextFilesdoes.Also:
secure_openis now the builtinopenwith anowner_only_opener, so it honorsencoding,newlineand binary modes (O_BINARYon Windows, addressing the plausible CR-doubling note).Tests (written failing first, in
config2py/tests/test_secure_io.py): chmod-raising folder at import (subprocess), no chmod when already tight,LC_ALL=C+PYTHONUTF8=0non-ASCII round trip and no truncation on failure, pre-existing 0o644 files (incl. nested, symlink, unmanaged),Configsalias, KeyError contract.Adversarial review (fresh Opus subagent, read the diff and #35): ship-after-fixes, none blocking. All five points confirmed fixed with scripts (incl. a real read-only bind mount of HOME under
unshare, andLC_ALL=C). Addressed in the second commit:Config2PyWarningper folder instead of oneUserWarningper file per import (confirmed);O_NOFOLLOWandfchmods the descriptor, closing a check-then-chmod race (plausible);secure_opendocstring notes it now honors the mode ("a"appends).Deferred to Follow-ups from the #35 review: ConfigStore.persist encoding, symlinked value files, dol internals #37:
ConfigStore.persistlocale encoding, symlinked value files (inherited fromTextFiles), reliance on dol internals.Dependents gate (branch on PYTHONPATH, one suite at a time, 10-min timeout): py2store 85 passed, xdol 4 passed, mood 8 passed, oa 41 passed / 3 failed, the same 3 as on master (need a real OpenAI key).
https://claude.ai/code/session_01Ea4y3nEMhgmrx3XUpcUTMi