Schedule the access review with a credential that can read key metadata and cannot change billing settings. Keep the credential that replenishes a fintech service's prepaid balance outside that job, and archive each successful inventory as a dated document before declaring the run complete.
TL;DR: An unattended key inventory should prove which identities could affect the balance, without giving the reporting process those same powers. A dated archive is evidence of an observation; it becomes access review evidence only when someone records a decision about that observation.
The OWASP Secrets Management Cheat Sheet supports the underlying controls: least privilege, lifecycle management, auditing, and automation. The implementation below translates those controls into a proposed reporting contract. Its field names and thresholds are illustrative design choices, not claims about a particular account API.
How should a scheduled access review job archive key inventory safely?
Start with that question before choosing a scheduler. The operational objective is to keep the prepaid balance from running out unattended, but the access review has a different responsibility: establish who can read the balance, modify replenishment policy, initiate funding, or grant another identity those capabilities. Combining those responsibilities in one credential makes a reporting compromise relevant to money movement, even if the scheduled program itself contains no payment code.
Read access matters.
An inventory can reveal account relationships, privileged identities, and rotation timing. Restrict its readers as well as its writers, and exclude raw secrets entirely. A document containing usable keys is a new secret store with an audit-report filename. Metadata such as a stable key identifier, owner, permission set, and lifecycle state is sufficient for the proposed review; last-use information is useful only if the source actually supplies it and its meaning is documented.
Use two boundaries. First, the source must enforce a metadata-only role for the inventory collector; a local check of permission labels cannot constrain a stolen source credential. Second, the archive writer should have access only to the evidence destination. Keep the replenishment credential in its own execution context, where its permissions and transaction limits can be reviewed independently. If a platform cannot express those separations, record that constraint as an unresolved access-review finding rather than treating a successful export as proof of isolation.
For an illustrative review, consider three identities: a balance observer, an automatic replenishment worker, and a policy administrator. The interesting question is whether the replenishment worker can also create credentials or raise its own funding limit. Counting three keys answers none of that. Capturing their effective permissions and the account boundary does. Trace each permission to the operation it authorizes, including grants inherited through a role, and distinguish a worker that may request a bounded replenishment from an administrator that may change that bound. If the source exposes only role names, retain those names and identify the missing effective-permission analysis in the review decision; don't manufacture a clean bill of health from incomplete metadata. A role called observer is a label, not evidence that mutations are denied. This is also why the archived inventory needs an account identifier: identical permission labels in two accounts do not establish an identical financial exposure.
Check the grants.
Trigger the run from evidence freshness
Choose the review interval from the consequences of stale access information. As an example policy, a team could run the inventory every 24 hours and page when no complete snapshot has arrived within 26 hours; these are proposed thresholds, not measured performance or a compliance requirement. Express the reporting SLO in terms of complete, fresh archives, and track the eventual reviewer decision separately. A scheduler exit code alone is too weak a success signal.
Capacity planning starts at the source. Estimate the largest account inventory, pagination cost, collection duration, archive size, and retention volume before setting a deadline. The input adapter must consume every page and reject a partially collected result. An empty account and an interrupted export cannot share the same representation. If collection takes longer than the schedule interval, overlapping jobs can amplify source load precisely when the source is already slow; prevent overlap or bound concurrency and make missed runs visible.
This also separates balance health from reporting health.
An overdue inventory should alert the access-review owner. A balance approaching its operational reserve belongs to the funding workflow and its own monitoring. Pausing evidence collection must not silently pause replenishment, and a fresh inventory must not be presented as proof that the balance will last until the next funding attempt.
Build a dated document without copying secrets
For an existing unattended Node.js scheduler, the same operational contract applies: invoke the collector, enforce a deadline, inspect its exit status, and retain the archive receipt. The example worker uses Go. It reads a local metadata snapshot from standard input and publishes a dated document into a dedicated directory; obtaining a complete snapshot from the account platform remains the source adapter's responsibility.
The input is a JSON object with account, observed_at, and keys. Each key has id, owner, state, and permissions. Those names define this example's local interchange format. The adapter must construct that object from approved metadata fields, after a complete collection, without serializing a source response wholesale. The worker rejects unknown fields, missing owners, duplicate identifiers, empty inventories, and observations older than its illustrative two-hour freshness limit. An intentionally empty account needs an explicit policy change rather than an accidental pass.
The publication method matters more than the filename.
On a filesystem supporting hard links, the worker writes and synchronizes a temporary file in the destination directory, then links it to the final name without replacing an existing archive. Readers must ignore temporary names. This supplies a local publication boundary; it does not create immutable storage or protect against an administrator who can rewrite the directory.
package main import ( "crypto/sha256" "encoding/json" "fmt" "io" "os" "path/filepath" "time" ) type Key struct { ID string `json:"id"` Owner string `json:"owner"` State string `json:"state"` Permissions []string `json:"permissions"` } type Snapshot struct { Account string `json:"account"` ObservedAt time.Time `json:"observed_at"` Keys []Key `json:"keys"` } func run() error { if len(os.Args) != 2 { return fmt.Errorf("usage: review-archive DIRECTORY") } dec := json.NewDecoder(os.Stdin) dec.DisallowUnknownFields() var snapshot Snapshot if err := dec.Decode(&snapshot); err != nil { return err } var extra any if err := dec.Decode(&extra); err != io.EOF { return fmt.Errorf("expected exactly one input document") } now := time.Now().UTC() age := now.Sub(snapshot.ObservedAt) if snapshot.Account == "" || len(snapshot.Keys) == 0 || snapshot.ObservedAt.IsZero() || age < 0 || age > 2*time.Hour { return fmt.Errorf("missing account, empty inventory, or stale observation") } seen := make(map[string]bool) for _, key := range snapshot.Keys { if key.ID == "" || key.Owner == "" || key.State == "" || len(key.Permissions) == 0 || seen[key.ID] { return fmt.Errorf("invalid metadata or duplicate key identifier") } seen[key.ID] = true } data, err := json.MarshalIndent(snapshot, "", " ") if err != nil { return err } data = append(data, '\n') digest := sha256.Sum256(data) dir := os.Args[1] tmp, err := os.CreateTemp(dir, ".review-*.tmp") if err != nil { return err } defer os.Remove(tmp.Name()) defer tmp.Close() if _, err := tmp.Write(data); err != nil { return err } if err := tmp.Sync(); err != nil { return err } if err := tmp.Close(); err != nil { return err } name := fmt.Sprintf("review-%s-%x.json", now.Format("2006-01-02T150405.000000000Z"), digest) if err := os.Link(tmp.Name(), filepath.Join(dir, name)); err != nil { return err } fmt.Printf("archive=%s sha256=%x keys=%d\n", name, digest, len(snapshot.Keys)) return nil } func main() { if err := run(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } Pre-create the directory with access restricted to the intended service and evidence readers. The filename uses publication time in UTC; the document retains observation time so delayed collection cannot masquerade as fresh evidence. The date layout in the code is Go's formatting reference, not an event date. A hash helps a reader compare bytes against a separately retained receipt, but a hash stored beside a writable document does not establish authenticity.
There are deliberate limits here.
The worker checks structure and freshness, not whether an owner is still employed or a permission is appropriate. It does not translate permissions, implement retention, synchronize directory metadata for a power-loss guarantee, or persist the receipt to an independent system. Select and test a storage adapter with the required durability, retention, and conditional-create semantics before counting its publications toward the production SLO. A retry may produce a second document; group attempts by the scheduler's logical run identifier when building the review queue, while preserving the original observations.
The trade-off is explicit: this local worker is not suitable for evidence that requires enforced retention or independent verification of origin. Use an archive destination with those controls and a separately protected receipt channel for that requirement. A limitation of the example is that its strict schema also rejects newly added metadata fields; changing the adapter requires a coordinated schema review rather than silently accepting every upstream field.
Choose the boundary the team can operate
Buy-versus-build decisions should turn on authority and operational ownership. A convenient scheduler does not compensate for a credential that can both inspect and change the funding policy.
| Boundary | Managed service evaluation | Self-hosted implementation burden |
|---|---|---|
| Collection | Verify metadata-only permissions, complete exports, and deadline controls | Maintain pagination, permission mapping, and bounded retries |
| Scheduling | Verify execution isolation, overlap controls, and exportable run history | Operate scheduling, credentials, missed-run detection, and upgrades |
| Evidence storage | Verify retention enforcement, reader restrictions, and independent receipts | Operate publication, backups, restore tests, and access logging |
Managed operation can reduce maintenance work while introducing service-specific permission and export semantics. Self-hosting gives the team direct control over the collector and evidence format, while leaving it responsible for patching, recovery, and on-call coverage. Neither choice proves that one credential has a small blast radius. Review the effective permissions and test the boundary.
Budget storage from retained observations and expected retries. Budget engineering time from the adapters and controls the team must own. Unit price is a poor substitute for either calculation, particularly when an undocumented export behavior can turn every review cycle into manual reconciliation.
Verify the evidence path and rehearse rollback
Before deployment, test a complete collection, a failed page, an unknown field containing a secret-shaped value, duplicate identifiers, a stale observation, and an unavailable archive destination. The failed page must stop the adapter before publication; the worker cannot infer a missing page from an otherwise valid object. Also test the final filesystem's hard-link behavior and access restrictions. A successful run should leave a parseable dated document whose bytes match the receipt, with a key count that reconciles to the collection result.
Then test authority.
With an approved test account, confirm that the reporting identity can list the intended metadata and is denied a billing-policy mutation. Test archive permissions independently. A green test of the Go program says nothing about the role assigned to its source adapter, and a private directory says nothing about who can change its access policy.
Roll out one account first. Compare the archived permissions with the source, check the alert for a deliberately missed run, and have a reviewer record a decision linked to that document. Keep owner changes, revocations, and accepted exceptions in the decision record rather than rewriting the historical inventory. This preserves the distinction between what was observed and what was approved.
Rollback should disable the reporting schedule and revoke its credentials if their scope is suspect. Preserve existing evidence and deployment records, restore a previously verified worker only after checking its permissions, and use a manual metadata review while reporting is paused. Keep balance monitoring and replenishment under their separate owners throughout that intervention.
The acceptance rule is concrete: the scheduled job can produce complete, dated evidence about access to the prepaid account, its failure becomes visible within the chosen freshness objective, and possession of its credential does not confer replenishment authority. A document with today's date is only the starting point.
References
- OWASP Secrets Management Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html