Skip to content

feat: support for import/export masked_encrypted_extra (frontend)#38078

Merged
Vitor-Avila merged 2 commits into
masterfrom
feat/masked-encrypted-extra-import-export-frontend
Mar 9, 2026
Merged

feat: support for import/export masked_encrypted_extra (frontend)#38078
Vitor-Avila merged 2 commits into
masterfrom
feat/masked-encrypted-extra-import-export-frontend

Conversation

@Vitor-Avila
Copy link
Copy Markdown
Contributor

@Vitor-Avila Vitor-Avila commented Feb 18, 2026

User description

SUMMARY

This PR adds support for exporting/importing masked_encrypted_extra info from DB connections. This is useful for:

  • BQ connections
  • GSheets connection
  • OAuth connections
  • Any DB connection that includes sensitive info in secure_extra

Stacked 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_extra and masked_encrypted_extra:

  • In case there is, it exports masked_encrypted_extra with fields properly masked.
  • If not, it exports encrypted_extra directly. Note that the import already supports encrypted_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:

image

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

CodeAnt-AI Description

Support importing masked encrypted extra fields (frontend)

What Changed

  • Import flow now detects when exported files require values for masked encrypted fields and asks the user to enter those secrets before importing.
  • Import modal and Database import dialog show per-file, per-field prompts (with labels when available) for masked encrypted extra values and include those secrets in the import request.
  • Client-side logic extracts encrypted-extra requirements from import errors, treats them as non-terminal validation (so users can supply secrets), and unit tests added to validate parsing and UI behavior.

Impact

✅ Clearer encrypted-field prompts during import
✅ Fewer import failures due to missing masked secrets
✅ Ability to import databases with masked secure extras

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Feb 18, 2026

Bito Automatic Review Skipped - Branch Excluded

Bito didn't auto-review because the source or target branch is excluded from automatic reviews.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change the branch exclusion settings here, or contact your Bito workspace admin at evan@preset.io.

@dosubot dosubot Bot added the change:frontend Requires changing the frontend label Feb 18, 2026
@codeant-ai-for-open-source
Copy link
Copy Markdown
Contributor

Sequence Diagram

Shows 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
Loading

Generated by CodeAnt AI

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 18, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit dd207b5
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69aa47c73862ce0008bdce36
😎 Deploy Preview https://deploy-preview-38078--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread superset-frontend/src/features/databases/DatabaseModal/index.tsx Outdated
@bito-code-review
Copy link
Copy Markdown
Contributor

Yes, extracting this type to a shared interface would be a good idea for maintainability. The type { fileName: string; fields: { path: string; label: string }[] }[] appears in DatabaseModal, ImportModal types, and hooks. You could define it as EncryptedExtraFields[] in a shared types file, leveraging the existing EncryptedExtraField interface from utils.tsx.

superset-frontend/src/views/CRUD/types.ts

import { EncryptedExtraField } from './utils';

export type EncryptedExtraFields = {
  fileName: string;
  fields: EncryptedExtraField[];
}[];

return encryptedExtraFields.map(({ fileName, fields }) => (
<div key={fileName}>
<StyledAlertMargin>
<Alert
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we want to repeat that alert multiple times for each encryptedExtraField? Perhaps we should just display it once at the top?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Synced with @kgabryje offline and we should be good here.

Base automatically changed from feat/masked-encrypted-extra-import-export-backend to master March 4, 2026 19:26
@rusackas
Copy link
Copy Markdown
Member

rusackas commented Mar 4, 2026

@Vitor-Avila wanna address comments and rebase? Happy to merge this.

@Vitor-Avila Vitor-Avila force-pushed the feat/masked-encrypted-extra-import-export-frontend branch from cd779ef to dd207b5 Compare March 6, 2026 03:19
@codeant-ai-for-open-source codeant-ai-for-open-source Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Mar 6, 2026
@codeant-ai-for-open-source
Copy link
Copy Markdown
Contributor

Sequence Diagram

Shows how the frontend prompts for masked encrypted extra fields during import, sends provided secrets to the backend, and completes the import. This captures the core user+UI+hook+API interactions added in this PR.

sequenceDiagram
    participant User
    participant ImportModal as UI
    participant Hook as useImportResource
    participant Server as API

    User->>UI: Upload import bundle
    UI->>Hook: importResource(bundle, passwords..., encryptedExtraSecrets={})
    Hook->>Server: POST /api/v1/<resource>/import (formData without encrypted_extra_secrets)
    Server-->>Hook: 200 with validation error: masked_encrypted_extra fields needed
    Hook-->>UI: set encryptedExtraFieldsNeeded (file + field paths/labels)
    UI-->>User: Render inputs asking for encrypted extra secrets
    User->>UI: Fill secrets and click Import
    UI->>Hook: importResource(bundle, ..., encryptedExtraSecrets={file: {path: secret}})
    Hook->>Server: POST /api/v1/<resource>/import (formData includes encrypted_extra_secrets)
    Server-->>Hook: 200 OK (import success)
    Hook-->>UI: clear needed flags, return success
    UI-->>User: Show success toast
Loading

Generated by CodeAnt AI

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Mar 6, 2026

Code Review Agent Run #384f76

Actionable Suggestions - 0
Additional Suggestions - 2
  • superset-frontend/src/views/CRUD/utils.tsx - 1
    • Missing explicit return type · Line 531-531
      The isNeedsEncryptedExtraField function lacks an explicit return type annotation, violating the requirement for explicit type hints in all functions.
      Code suggestion
       @@ -531,1 +531,1 @@
      - const isNeedsEncryptedExtraField = (payload: any) =>
      + const isNeedsEncryptedExtraField = (payload: any): boolean =>
  • superset-frontend/src/components/ImportModal/index.tsx - 1
    • State Update Safety · Line 354-361
      The onChange handler for encrypted extra secrets should use a functional state update to avoid stale closures and ensure consistency, especially with nested object updates. Also, defensively spread the nested object to handle undefined cases safely.
      Code suggestion
       @@ -354,7 +354,7 @@
      -                    setEncryptedExtraSecrets({
      -                      ...encryptedExtraSecrets,
      -                      [fileName]: {
      -                        ...encryptedExtraSecrets[fileName],
      -                        [field.path]: event.target.value,
      -                      },
      -                    })
      +                    setEncryptedExtraSecrets(prev => ({
      +                      ...prev,
      +                      [fileName]: {
      +                        ...(prev[fileName] || {}),
      +                        [field.path]: event.target.value,
      +                      },
      +                    }))
Review Details
  • Files reviewed - 7 · Commit Range: dd207b5..dd207b5
    • superset-frontend/src/components/ImportModal/ImportModal.test.tsx
    • superset-frontend/src/components/ImportModal/index.tsx
    • superset-frontend/src/components/ImportModal/types.ts
    • superset-frontend/src/features/databases/DatabaseModal/index.tsx
    • superset-frontend/src/views/CRUD/hooks.ts
    • superset-frontend/src/views/CRUD/utils.test.tsx
    • superset-frontend/src/views/CRUD/utils.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Mar 6, 2026

Code Review Agent Run #0a8ede

Actionable Suggestions - 0
Review Details
  • Files reviewed - 5 · Commit Range: dd207b5..e8dbf23
    • superset-frontend/src/components/ImportModal/types.ts
    • superset-frontend/src/features/databases/DatabaseModal/index.tsx
    • superset-frontend/src/views/CRUD/hooks.ts
    • superset-frontend/src/views/CRUD/types.ts
    • superset-frontend/src/views/CRUD/utils.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@Vitor-Avila Vitor-Avila merged commit d9a91f9 into master Mar 9, 2026
71 checks passed
@Vitor-Avila Vitor-Avila deleted the feat/masked-encrypted-extra-import-export-frontend branch March 9, 2026 04:59
aminghadersohi pushed a commit to aminghadersohi/superset that referenced this pull request Mar 17, 2026
MallikarjunaReddyN pushed a commit to MallikarjunaReddyN/superset that referenced this pull request Mar 18, 2026
rusackas pushed a commit that referenced this pull request Apr 17, 2026
- development-setup.md: update Node.js prerequisite from v20 to v22 LTS
  (PR #37223 — project minimum Node version upgraded)
- importing-exporting-datasources.mdx: document that masked_encrypted_extra
  (sensitive connection parameters like service account JSON) is now included
  in database import/export (PR #38078)
- security.mdx: add note that get_samples() enforces datasource-level access
  control, closing prior gap where unprivileged users could fetch sample rows
  (PR #36550)
- exploring-data.mdx: document natural language time range expressions
  including new "first of" expressions (first day/week of month/quarter/year)
  supported in the Custom time range picker (PR #37098)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend size/L size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants