Skip to content

fix: strip whitespace from workflow secret names (fixes #5326)#6179

Closed
DragonBot00 wants to merge 2 commits intokeephq:mainfrom
DragonBot00:fix/trim-secret-names
Closed

fix: strip whitespace from workflow secret names (fixes #5326)#6179
DragonBot00 wants to merge 2 commits intokeephq:mainfrom
DragonBot00:fix/trim-secret-names

Conversation

@DragonBot00
Copy link
Copy Markdown
Contributor

Summary

Fixes #5326 — Secrets named with trailing/leading whitespace (e.g. "MY_SECRET ") appeared in the UI but could not be deleted, updated, or accessed.

Root Cause

When a secret was saved with a trailing space in the key (e.g. "MY_SECRET "), it was stored verbatim. Subsequent lookups or deletions using the trimmed name ("MY_SECRET") did not match the stored key, causing 404 errors or silent misses.

Changes

Backend: keep/api/routes/workflows.py

  • write_workflow_secret: Strip whitespace from all incoming secret keys before storing — {k.strip(): v for k, v in secret_data.items()}
  • delete_workflow_secret: Strip whitespace from the secret_name path parameter before lookup

Frontend: keep-ui/app/(keep)/workflows/[workflow_id]/workflow-secrets.tsx

  • handleAddSecret: Trim the secret name before passing to the API so trailing spaces are caught at the UI level too

Testing

  • Create a secret with trailing spaces in the name → it is stored without them
  • Delete a secret → works correctly even if whitespace was in the original request
  • Existing secrets without spaces are unaffected

Fixes: #5326

…space bugs

Fixes keephq#5326 - Secrets with trailing/leading spaces caused bugs where they appeared in the UI but could not be deleted, updated, or accessed. The stored key included the space while the lookup did not match.

Changes:
- In write_workflow_secret: strip whitespace from all incoming secret keys before storing
- In delete_workflow_secret: strip whitespace from secret_name path param before lookup
Part of fix for keephq#5326 - also trim the secret name in the UI before calling the API so trailing/leading spaces are prevented at the source.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

@DragonBot00 is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Apr 1, 2026
@DragonBot00
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@dosubot dosubot bot added the Bug Something isn't working label Apr 1, 2026
@TheCodingDragon0
Copy link
Copy Markdown

Closing — no maintainer engagement after 5 days. Shifting focus to quality over quantity.

1 similar comment
@DragonBot00
Copy link
Copy Markdown
Contributor Author

Closing — no maintainer engagement after 5 days. Shifting focus to quality over quantity.

@DragonBot00 DragonBot00 closed this Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Secrets with trailing spaces in name appear in UI but cannot be accessed or deleted

2 participants