Repository navigation
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Items deferred from the review of #54 (key rotation in plain pull/push/diff behind features.key_rotation); none of them blocks the PR.
Behaviour
- Tenant push sends stale workspace dirs. A tenant push sends the
key_rotation.yamlof every localworkspaces/<wid>/directory, including stale ones withoutserver.yamlthat the tenant import itself skips. Restrict it to workspaces present in the pushed configuration, or at least to dirs that haveserver.yaml. (internal/cac/keyrotation/dir_store.goDirStore.Workspaces,cmd/key_rotation_feature.goreadKeyRotations) - Plain pull drops
starting_from. A plain pull rewrites the file from the server, which never echoesstarting_from, so a locally setstarting_fromdisappears on every routine pull. Consider preserving it on rewrite, or warn when dropping it. (internal/cac/keyrotation/sync.goPull) -
mergeddiff side is not a per-use merge. Themergedside picks the local file or the server per workspace, unlike the regular merged view, so a local file with onlysigmakes the remoteencshow up as a spurious difference. Merge per use (fall back to the server for uses the local file does not set). (internal/cac/keyrotation/diff.goSide.Read) - Stale
--outfile on an empty key-rotation-only dry run. Done in feat: handle key rotation in plain pull, push and diff behind features.key_rotation #54. A key-rotation-onlypush --dry-runwith nothing to push leaves an existing--outfile untouched, so a stale plan can look current. Truncate it or write an empty stream. (internal/cac/keyrotation/dry_run.goDryRun.WriteAll,cmd/key_rotation_feature.gopushKeyRotations)
Security hardening (low, same trust model as the existing config files)
- Cross-profile identity compared by
name. Whether a diff side reuses the already-initialized client is decided by comparing the profilename, which users can set and which can collide. Compare the resolved profile key instead. (cmd/key_rotation_feature.gosideSpec.gate/sideSpec.side) -
key_rotation.yamlis rendered as a template. The file goes through the template engine (env,include), so a crafted cron can echo environment values into diff output, and over-long cron strings pass validation. Read the file without rendering and/or cap cron fields at 7. (internal/cac/keyrotation/dir_store.goDirStore.Read,internal/cac/keyrotation/keyrotation.goConfig.Validate) - Server-supplied workspace ids joined into paths unchecked. In a tenant pull, workspace ids returned by the server are joined into file paths without checks. Reject ids that are not a single local path segment. Pre-existing in
internal/cac/storage/server_storage.go(ServerStorage.workspacePath) too. (internal/cac/keyrotation/dir_store.goDirStore.Write/DirStore.dirPath)
Simplification
- Drop the ignored-file warning on plain push. Done in feat: handle key rotation in plain pull, push and diff behind features.key_rotation #54. It fires for users who intentionally use only the
key-rotationsubcommands, and even with unrelated--filtervalues. Remove it along withDirStore.Has. (cmd/key_rotation_feature.gowarnIgnoredKeyRotation,cmd/push.go,internal/cac/keyrotation/dir_store.goDirStore.Has) - Trim indirection and duplication (~120 lines, no behaviour change). Done in feat: handle key rotation in plain pull, push and diff behind features.key_rotation #54, except the
TestValidateConfigurationsubtests (next item). Collapse theDryRunstruct into a single function; dropReader(typeSide.RemoteasRemote),NewService, the exportedReadLocal, and the unreachable newline guard inappendSection; remove duplicated subtests inTestValidateConfiguration; trim the README examples. (internal/cac/keyrotation/dry_run.goDryRun,internal/cac/keyrotation/service.goReader/NewService/Service.ReadLocal,internal/cac/keyrotation/diff.goSide/appendSection,internal/cac/config/config_test.goTestValidateConfiguration, README "Managing key rotation") - Duplicated subtests in
TestValidateConfiguration. Left over from the item above. (internal/cac/config/config_test.go) - Misleading test comment. Done in feat: handle key rotation in plain pull, push and diff behind features.key_rotation #54: the test went away with
Service.Diff. A comment in the service diff test claims a NotFound case but the test injects a generic error. Fix the comment, or inject an actual NotFound error to cover what it describes. (internal/cac/keyrotation/service_test.go, thesvc.Diffcase)
Longer term: a dedicated manage_key_rotation scope on the server side so features.key_rotation no longer needs manage_servers.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity