-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Description
The vault.get() regex in src/domain/expressions/model_resolver.ts does not support spaces in vault names or secret keys, even when quoted.
Steps to Reproduce
- Create a vault backed by 1Password:
swamp vault create @swamp/1password infra --config '{"op_vault": "Infra"}' - The 1Password item has fields with spaces, e.g.
Client IDandClient Secret - Use a vault expression in a workflow:
${{ vault.get(infra, Tailscale K8s Operator/Client ID) }} - Run the workflow
Expected: The vault expression resolves the secret value.
Actual: CEL parse error: Expected RPAREN, got IDENTIFIER — the space in the key breaks parsing before the vault regex even runs.
Even if the CEL layer is bypassed, the vault regex itself would fail:
const vaultPattern = /vault\.get\(\s*(['"\`]?)([^'"\`\s,]+)\1\s*,\s*(['"\`]?)([^'"\`\s,]+)\3\s*\)/g;The capture group [^'"\\s,]+explicitly excludes whitespace, soTailscale K8s Operator/Client ID` stops matching at the first space.
Workaround
Rename the 1Password fields to remove spaces (e.g. ClientID instead of Client ID), or use the item UUID with spaceless field names.
Suggested Fix
Update the vault regex to allow spaces inside quoted arguments. When quotes are present, the inner capture should permit any character except the matching quote. For example:
/vault\.get\(\s*(?:(['"\`])(.+?)\1|([^\s,)]+))\s*,\s*(?:(['"\`])(.+?)\4|([^\s,)]+))\s*\)/g
This would allow both vault.get(infra, mykey) and vault.get("infra", "My Key With Spaces").
The CEL expression parser layer (${{ }}) would also need to handle the vault.get() call before passing to the CEL evaluator, since CEL itself tokenizes on spaces.
Environment
- swamp version: 20260327.235335.0-sha.0c993a65
- OS: macOS