feat(envvars): use cache for envvar dropdown key names, prevent autofill & suggestions in the settings#1769
Merged
Conversation
…ill & suggestions in the settings
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Implemented in-memory caching for workspace environment variables to reduce redundant API calls when users open the env var dropdown. The cache is stored in a Map keyed by workspaceId and is properly invalidated when variables are updated or deleted. Additionally, implemented browser autofill prevention for the environment variable settings form by switching from type="password" to type="text" with WebkitTextSecurity: 'disc' styling and adding honeypot inputs to prevent password managers from interfering.
Key changes:
- Cache preloads when workflow becomes ready, providing instant dropdown results
- Cache invalidation correctly triggers on
upsertWorkspaceEnvironment,removeWorkspaceEnvironmentKeys, and personal variable changes - Autofill prevention uses modern web techniques (honeypot inputs + text security styling)
- Added
maxHeightto dropdown for better UX with long variable lists
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The implementation is straightforward and well-structured. The cache invalidation logic is correctly placed in all mutation methods, the preload strategy won't cause race conditions, and the autofill prevention technique is a standard browser workaround. No logical errors or security issues were found.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/stores/settings/environment/store.ts | 5/5 | Added workspace env cache with Map, proper invalidation on mutations, and reset method |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx | 5/5 | Added preload logic for workspace env vars when workflow is ready, with cache clearing on workspace change |
| apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx | 5/5 | Replaced password input type with text + WebkitTextSecurity styling, added honeypot inputs to prevent autofill |
| apps/sim/components/ui/env-var-dropdown.tsx | 4/5 | Simplified group creation logic and label display, removed conditional group pushing, added maxHeight styling |
Sequence Diagram
sequenceDiagram
participant User
participant Workflow
participant EnvStore
participant Cache
participant API
participant Dropdown
User->>Workflow: Opens workflow
Workflow->>EnvStore: loadWorkspaceEnvironment(workspaceId)
EnvStore->>Cache: Check cache for workspaceId
alt Cache Hit
Cache-->>EnvStore: Return cached data
EnvStore-->>Workflow: Return env data
else Cache Miss
EnvStore->>API: GET /workspace/:id/environment
API-->>EnvStore: Return workspace & personal env vars
EnvStore->>Cache: Store data with timestamp
EnvStore-->>Workflow: Return env data
end
User->>Dropdown: Types {{ to trigger dropdown
Dropdown->>EnvStore: loadWorkspaceEnvironment(workspaceId)
EnvStore->>Cache: Check cache
Cache-->>EnvStore: Return cached data (fast)
EnvStore-->>Dropdown: Display env vars
User->>EnvStore: Updates/Deletes env var
EnvStore->>API: PUT/DELETE request
API-->>EnvStore: Success
EnvStore->>Cache: clearWorkspaceEnvCache(workspaceId)
Cache-->>EnvStore: Cache invalidated
7 files reviewed, no comments
waleedlatif1
added a commit
that referenced
this pull request
Nov 12, 2025
…ill & suggestions in the settings (#1769) * feat(envvars): use cache for envvar dropdown key names, prevent autofill & suggestions in the settings * add the same prevention for autocomplete and suggestions to sso and webhook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
save passwordandsuggested passwordsType of Change
Testing
Tested manually.
Checklist