Add site credential lifecycle #169
No reviewers
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools!169
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/site-credential-lifecycle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Site credentials can now be checked against the server without building or publishing a site.
The owner can inspect safe fields, update only the host, user, or password, or explicitly replace all three.
A rejected FTP login says username or password because the protocol cannot identify which value is wrong.
Existing deploy behavior, hosting layouts, default config resolution, and the compatible
--forcespelling stay available.Focused lifecycle tests and the full tagged and untagged Go test and vet matrix prove the new paths.
If this is wrong, revert this PR; existing rclone configuration files remain valid and usable.
Closes allod/tools#163
Contract
allod site check [--config <path>]reuses the deploy preflight's read-onlylsd shared:probe and failure reporter. It does not resolve a site repository, build, sync, verify HTTPS, or publish.allod site config show [--config <path>]prints Config, Remote, Type, Host, and User only. It rejects missing or duplicate required keys, unsafe terminal text, non-FTP remotes, and configurations without explicit TLS; it never prints the plaintext-equivalent password field.allod site config update {host|user|password} [--config <path>]accepts no value in argv, asks exactly one terminal question, and replaces only that field's byte range. Both rclone-supportedkey = valueandkey: valueseparators work, while other formatting, directives, line endings, and stanzas survive unchanged.allod site config replace [--config <path>]is the discoverable full replacement.allod site config --forceremains its compatibility spelling, while a bareallod site configkeeps create-and-refuse-existing behavior. Replacement refuses duplicatesharedstanzas before prompting or writing rather than reporting success over an ambiguous credential.sharedstanza. All mutable actions accept a regular file and refuse symlinks and non-regular files before prompting. A rejected credential selected through a symlink, whether explicitly or through rclone's default resolution, points back to its source credential rather than recommending an impossible mutation of the symlink.allod site checkcommand. Named-path output tells the owner to reuse the reported Config path with--configwithout emitting an unquoted pseudo-command.Risk
Medium. These commands write a machine-wide, plaintext-equivalent rclone configuration. The write remains atomic at mode 0600, password input still reaches rclone only on stdin, and mutable operations reuse the named-config file-type protections from the parent PR. The remaining operational risk is the narrow filesystem race after the writer's final destination recheck; ordinary symlink and non-regular destinations are refused.
Validation
nix develop -c bash -lc 'go test -tags site ./cmd/allod -run "TestSite(Check|Config|ReportSiteRemoteFailure)" -count=1'nix develop -c bash -lc 'go test ./... && go vet ./... && go vet -tags site ./... && go test -tags site ./...'gofmt -don all four changed Go files andgit diff --check=/:parsing and exact byte preservation, explicit and default symlink-safe credential-rejection guidance, and the update precondition in help.nix flake checkreaches the existing unrelatedallod-parityfailure at test 23:tests/pr-explain/components.shexpects the section prompt to containnot decoration. The lifecycle and full Go matrices above pass.Files
cmd/allod/site.gocmd/allod/site_config.gocmd/allod/site_test.gocmd/allod/site_config_test.goDepends on: #168
Independent review found three lifecycle defects and one help-text defect. Please fix these additively before merge; the focused and full Go matrices otherwise pass.
--forcereplaces only the first[shared]stanza. Rclone 1.72.1 accepts duplicate sections and later credential keys win, so the command can report success while rclone keeps using an untouched later password. Reject duplicate owned stanzas before prompting or writing, and test no mutation.--config <symlink>recommends update with that same path, but read-only symlinks are intentionally accepted by check/show and refused by every mutable lifecycle command. Direct the owner to the activation/source credential rather than an impossible mutation of the selected symlink.key = value, while rclone 1.72.1 also acceptskey: value. Support the accepted colon separator with exact byte-range preservation (including mixed syntax), or diagnose it explicitly; do not report valid required keys as missing.[shared]stanza. Narrow that wording to create/replace and state update’s precondition.Addressed in
344f837.--forcespelling now reject duplicate[shared]stanzas before any prompt, obscuring call, or write.=and:separators; update still replaces only the selected value bytes.sharedstanza.Focused lifecycle tests, the full tagged and untagged Go test/vet matrix,
gofmt -d, andgit diff --checkpass at this head.One P2 remediation gap remains for an implicitly resolved symlink.
rcloneConfigSelection.configPath()returns""when the caller omits--config, andsite checkcarries that empty value intoreportSiteRemoteFailure. The credential-rejected branch therefore recommendsallod site config update user|passwordwithout checking whether rclone's default path (includingRCLONE_CONFIG) is a symlink. That update then resolves the default path and refuses it through the mutableO_NOFOLLOWpath. An activation-managed default symlink thus receives the same impossible mutation remedy fixed here for explicit--config <symlink>.Please make the default rejection guidance mention updating the activation/source credential when applicable, or safely carry enough resolved-path metadata to choose the symlink-specific remedy. The focused duplicate-section, mixed-separator/byte-preservation, explicit-symlink, help, and secret/argv tests otherwise pass at
344f837.Addressed in
a61b3df.Credential-rejection reporting now checks the path selected by rclone's implicit precedence:
RCLONE_CONFIGfirst, then the XDG/HOME default. When that path is a symlink, the remedy points to the source credential and recommends only rerunning the implicitallod site check; it does not print the resolved path or recommendsite config update/--configagainst the read-only link.Focused regressions cover both an
RCLONE_CONFIGsymlink and an XDG-default symlink. The focused lifecycle tests, full tagged and untagged Go test/vet matrix,gofmt -d, andgit diff --checkpass at this head.