Skip to content

docs: remove outdated hash-includes-perms-owner gap#5

Merged
nknapp merged 13 commits into
mainfrom
cfgsync-agent
Jul 14, 2026
Merged

docs: remove outdated hash-includes-perms-owner gap#5
nknapp merged 13 commits into
mainfrom
cfgsync-agent

Conversation

@nknapp

@nknapp nknapp commented Jul 11, 2026

Copy link
Copy Markdown
Owner

The spec and implementation both now use content-only hashing (XXH3_128 over file contents). This gap was resolved in a previous PR.

nknapp added 6 commits July 11, 2026 21:02
…validations

Implement all 6 gaps from the algorithm specification:

Phase 1 — Permission preset mappings:
- Fix Private preset: 755→700 (not 600) for directories
- Add reverse_map_permissions for CopyToSource
- Fix resolve_file_perms to store mapped target perms in state

Phase 2 — Directory permission warnings:
- Warn on directory perm/owner mismatches (don't modify)
- Use dir_perms preset for expected directory permissions

Phase 3 — Security: foreign dir owner edge case:
- Skip files with no explicit owner in foreign-owned directories

Phase 4 — Deviating directories validation:
- Check deviating entries after sync, warn on mismatches
- Canonicalize deviating paths in config loading

Phase 5 — Target-to-source validation:
- Validate target perms/owner before CopyToSource
- Skip files with unexpected perms using reverse mapping

Phase 6 — Action feasibility validation:
- Add failed_checks field to all Change variants
- Implement validate_actions in changes pipeline
- Show failed counts in status (long+short format)
- Print warnings and skip failed changes in sync

6 new e2e tests (85 total, 55 unit tests passing)
- Remove unused imports in e2e tests (deno lint)
- Fix copy-to-source-owner test: target file must have configured owner
  for Phase 5 validation to pass (root:root not user:user)
Avoid exact stderr matching for deviating directory warnings to
support macOS where user/group names differ from Linux runners.
…ce check

- Foreign-dir owner check now only runs when security bypass is false
  (trusted root-owned configs skip the check)
- CopyToSource feasibility no longer requires source parent to exist
  (it is created by create_dir_all during copy)
[[sync.deviating]]
path = "/etc/ssh"
path = "./target/special-dir"
permissions = "700"

@nknapp nknapp Jul 14, 2026

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

permissions should not be allowed anymore


assertEquals(await testbed.readTestDir(), [
"user:user | 0644 | 0 | config.cfgsync.state | CFGSYNC_STATE",
`user:user | 0644 | 0 | config.cfgsync.state | CFGSYNC_STATE`,

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

unnessecary change

files: [
"user:user | 0755 | 0 | config.toml | __CONFIG_TOML__",
"user:user | 0755 | 0 | source/",
"user:user | 0755 | 0 | target/",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Set the directory to root:root as well

nknapp added 2 commits July 14, 2026 22:51
The permissions field on sync.deviating entries was never used
effectively. Deviating entry validation now only checks owner.
permission skips: 1
`,
stderr: deindent`
Permission warning: directory 'subdir' has 0o755, should be 0o700 (run as root to fix)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Instead of 0o755 write 755

globs = ["**/*.conf"]
`,
files: [
"user:user | 0755 | 0 | config.toml | __CONFIG_TOML__",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Use 755 instead of 0755

nknapp added 3 commits July 15, 2026 00:20
…target dir

- Change {:o} instead of 0o{:o} in all permission warning messages
- Set target/ directory owner to root:root in copy-to-source-owner test
- Update all e2e tests to match new warning format (644/600 instead of 0o644/0o600)
Script automates verification, commit, push, and CI wait.
AGENTS.md now references the script instead of listing steps manually.
@nknapp
nknapp merged commit 3e62861 into main Jul 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant