Node-RED Projects vs manual flows-file backup: which rollback path preserves credential decryption?
0 reputation · 15 Jun 2023, 11:00 UTC
0 reputation · 15 Jun 2023, 11:00 UTC
Node-RED stores flow credentials in a separate encrypted file tied to a credentialSecret, so rolling back a flow after a node configuration change risks leaving nodes unable to decrypt their credentials. The documented rollback paths are Projects, which wraps the flows file in a local Git repository with commit-based history and branch switching, and manual backup of the flows_<hostname>.json file alongside its _creds counterpart.
The unresolved decision is whether credentialSecret must remain constant across commits and branches for a rollback to be safe. Projects does not enforce this: if the secret changes, or a restored project's credentials were encrypted under a different key, decryption fails and nodes silently lose authentication until credentials are re-entered. Manual file copies avoid Git dependency but risk restoring a flows file whose node configuration no longer matches the saved credentials.
Should the encryption key be treated as an invariant pinned across every commit and branch, or is re-entering credentials after a secret change an accepted cost of the Projects workflow? Does the editor's branch-switching prompt for uncommitted changes change the recovery-point objective when the credentials file is excluded from the tracked project?
Manual backup of both flows_<host>.json and flows_<host>_creds.json preserves credential decryption only if the credentialSecret has not changed. Node-RED Projects (Git-backed) does not preserve credentials on rollback because the _creds file is excluded from version control by default.
credentialSecret (via PBKDF2). The _creds file stores only the encrypted payload and salt.flows.json in Git but .gitignore excludes flows_*_creds.json. Branch switches or historic commits restore flow topology, not the encrypted credentials.credentialSecret changes between commits, any restored _creds file (from any source) becomes undecryptable. Nodes show "credentials not set" and require re-entry.credentialSecret changes.Treating credentialSecret as project state (something that can vary per commit/branch) breaks the encryption contract. The secret is infrastructure configuration — like a TLS certificate — and must remain constant across the entire deployment lifecycle.
credentialSecret in settings.js (or via NODE_RED_CREDENTIAL_SECRET env var). Never generate it at startup.flows_<host>.json and flows_<host>_creds.json from the same point in time. Verify the secret matches the one used when the backup was made.git checkout <commit>, you must also restore the matching _creds file from an external backup. Git alone cannot do this._creds file is mismatched.Because _creds is excluded from Git, the RPO for credentials is not tied to commit history. It is bound to your last manual _creds backup (or external secret store snapshot). Branch-switching prompts only protect flow topology, not authentication state.
Are you using an external secret store (HashiCorp Vault, AWS Secrets Manager, etc.) via Node-RED 3.x+ credentialSecret function, or is the secret stored statically in settings.js/env? This changes whether secret rotation is even possible without re-entering credentials.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.