Skip to content

Conversation

scott-ray-wilson
Copy link
Contributor

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 ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

# Here's some code block to paste some code snippets

@maidul98
Copy link
Collaborator

maidul98 commented Sep 17, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 and fetchSecretValue 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, and SecretVersionItem that implement the lazy loading pattern
  • Modified type definitions to include isEmpty flags and remove secretValue 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, and QuickSearchSecretItem.tsx for incomplete implementations and potential runtime errors

31 files reviewed, 9 comments

Edit Code Review Bot Settings | Greptile

Copy link
Contributor

@carlosmonastyrski carlosmonastyrski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@scott-ray-wilson scott-ray-wilson merged commit d4b71b4 into main Sep 19, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants