-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[WIP] feat(dashboard): Only fetch secret value on relevant actions #4545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR implements a significant performance optimization by introducing lazy loading of secret values across the Infisical dashboard. Instead of fetching all secret values upfront when loading the dashboard, the system now only retrieves actual secret values when users perform specific actions like focusing on input fields, copying values, or sharing secrets.
The implementation introduces several key architectural changes:
Frontend Changes:
- New
useGetSecretValue
hook andfetchSecretValue
function for on-demand secret value fetching - Updated secret list components to conditionally fetch values based on user interaction (field focus, visibility toggles)
- Extracted reusable components like
SecretImportSecretRow
,SecretRotationSecretRow
, andSecretVersionItem
that implement the lazy loading pattern - Modified type definitions to include
isEmpty
flags and removesecretValue
from initial data structures - Updated API endpoints from general secret endpoints to dashboard-specific ones (e.g.,
/api/v1/dashboard/secret-value
)
Backend Changes:
- Added new audit log event types (
DASHBOARD_LIST_SECRETS
,DASHBOARD_GET_SECRET_VALUE
,DASHBOARD_GET_SECRET_VERSION_VALUE
) for granular tracking - Enhanced service layer methods to support filtering specific secret versions via
secretVersions
parameter - Updated DTOs to support the new lazy loading architecture
Performance Benefits:
- Reduces initial page load times by avoiding bulk secret value fetching
- Decreases network payload sizes for dashboard queries
- Improves security posture by minimizing unnecessary exposure of sensitive data
- Implements proper cache invalidation strategies to maintain data consistency
The changes maintain backward compatibility while providing substantial performance improvements, especially for organizations with large numbers of secrets across multiple environments.
Confidence score: 3/5
- This PR requires careful review due to complex state management and potential timing issues in async operations
- Score reflects the architectural complexity and multiple race condition risks identified in clipboard operations and focus handling
- Pay close attention to
SecretItem.tsx
,SecretEditRow.tsx
, andQuickSearchSecretItem.tsx
for incomplete implementations and potential runtime errors
31 files reviewed, 9 comments
...et-manager/SecretDashboardPage/components/SecretRotationListView/SecretRotationSecretRow.tsx
Outdated
Show resolved
Hide resolved
...src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretVersionItem.tsx
Show resolved
Hide resolved
...nd/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx
Outdated
Show resolved
Hide resolved
...c/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx
Show resolved
Hide resolved
frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx
Show resolved
Hide resolved
...nd/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx
Show resolved
Hide resolved
...secret-manager/SecretDashboardPage/components/SecretImportListView/SecretImportSecretRow.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description 📣
This PR updates the secret dashboard overview and environment view to only fetch secret values on relevant actions (interact with input, copy value, share, etc).
Includes minor bug fixes
Type ✨
Tests 🛠️
# Here's some code block to paste some code snippets