feat: support for import/export masked_encrypted_extra (frontend)#38078
Conversation
|
Bito Automatic Review Skipped - Branch Excluded |
Sequence DiagramShows how the frontend collects masked_encrypted_extra secrets during import and sends them to the import API, and the alternate path where the API requests missing encrypted fields which the frontend then renders for the user to fill. sequenceDiagram
participant User
participant Frontend as "Import / Database Modal"
participant Hook as "useImportResource"
participant API as "Superset Import API"
User->>Frontend: Select import bundle + enter encrypted_extra secrets
Frontend->>Hook: onUpload/onDbImport(bundle, ..., encryptedExtraSecrets)
Hook->>API: POST /api/v1/<resource>/import/ (formData includes encrypted_extra_secrets)
alt API accepts secrets (success)
API-->>Hook: 200 OK (import succeeded)
Hook-->>Frontend: update state (clear needs), return success
Frontend-->>User: show success (toast / close modal)
else API needs encrypted fields (missing/secrets masked)
API-->>Hook: 400 validation error (masked_encrypted_extra messages)
Hook-->>Frontend: set encryptedExtraFieldsNeeded (file+paths+labels)
Frontend-->>User: render encrypted extra input fields for those files
end
Generated by CodeAnt AI |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
df23c4a to
c6258bb
Compare
| setSSHTunnelPrivateKeyPasswordFields, | ||
| ] = useState<string[]>([]); | ||
| const [encryptedExtraFields, setEncryptedExtraFields] = useState< | ||
| { fileName: string; fields: { path: string; label: string }[] }[] |
There was a problem hiding this comment.
It looks like this type is repeated in a few places, can we extract it to some shared interface?
|
Yes, extracting this type to a shared interface would be a good idea for maintainability. The type superset-frontend/src/views/CRUD/types.ts |
| return encryptedExtraFields.map(({ fileName, fields }) => ( | ||
| <div key={fileName}> | ||
| <StyledAlertMargin> | ||
| <Alert |
There was a problem hiding this comment.
Do we want to repeat that alert multiple times for each encryptedExtraField? Perhaps we should just display it once at the top?
SUMMARY
This PR adds support for exporting/importing
masked_encrypted_extrainfo from DB connections. This is useful for:secure_extraStacked diffs implementation
The feature was split into 3 PRs:
#38075 can be merged now. Once it gets merged, #38077 can get merged as well (shouldn't impact the frontend) and this one can be merged last. As they get merged I'll update the PRs to point to
master.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Export demo
During the export, Superset checks if there's any diff between
encrypted_extraandmasked_encrypted_extra:masked_encrypted_extrawith fields properly masked.encrypted_extradirectly. Note that the import already supportsencrypted_extra(not part of this PR).Export.Flow.mov
Import demo
During the import, the modal prompts users to provide masked fields:
Import.Flow.mov
I also forced a test connection to prompt both for password and secure extra info:
ADDITIONAL INFORMATION