-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(external-migrations): vault migrations #4211
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
base: main
Are you sure you want to change the base?
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 adds functionality to migrate secrets from HashiCorp Vault (KV V2) to Infisical. The implementation allows users to transfer their secrets from self-hosted or dedicated Vault instances while preserving their hierarchical structure. The changes span both frontend and backend:
- Frontend changes add a new Vault platform option in the import selection modal with a dedicated form for Vault credentials
- Backend implements the migration logic with support for two mapping types: namespace-based and key-vault based
- The implementation follows existing patterns used for EnvKey migrations, using a queue-based system for processing
- Data transformation handles the conversion between Vault's structure and Infisical's project/environment/folder hierarchy
Confidence score: 2/5
- This PR has significant security implications and needs careful review before merging
- Score reflects multiple security concerns in error handling and input validation
- The following files need particular attention:
- frontend/src/hooks/api/migration/mutations.tsx (error handling issues)
- backend/src/services/external-migration/external-migration-fns/vault.ts (URL construction)
- backend/src/server/routes/v3/external-migration-router.ts (rate limiting configuration)
Security Concerns:
- The mutations.tsx file has poor error handling that swallows errors and only logs them
- User-controlled input (vaultUrl) is used to construct API calls without proper URL validation
- Sensitive information (vault tokens) may be exposed in logs
- Rate limiting configuration needs review to prevent DoS attacks
- Need to ensure proper sanitization of imported secret values
a
13 files reviewed, 13 comments
const request = axios.create({ | ||
baseURL: baseUrl, | ||
headers: { | ||
"X-Vault-Namespace": namespace, | ||
"X-Vault-Token": accessToken | ||
} | ||
}); |
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.
logic: Validate the baseUrl before creating axios instance - potential SSRF vulnerability if not validated
Description 📣
Added a new vault migration option. This allows users to migrate from Vault self-hosted/dedicated to Infisical. Currently the migration only supports Vault Key Vault (KV) V2. But we can extend it as we please in the future.
Type ✨