Skip to content

chore(lint): toggle import/no-named-as-default to error level + fix all violations#42214

Open
hainenber wants to merge 2 commits into
masterfrom
chore/enable-import-no-named-as-default-lint-rule-to-error-level
Open

chore(lint): toggle import/no-named-as-default to error level + fix all violations#42214
hainenber wants to merge 2 commits into
masterfrom
chore/enable-import-no-named-as-default-lint-rule-to-error-level

Conversation

@hainenber

Copy link
Copy Markdown
Contributor

chore(lint): toggle import/no-named-as-default to error level + fix all violations

SUMMARY

Continuation of usual house cleaning ops.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

Green CI as acceptance threshold

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

… all violations

Signed-off-by: hainenber <dotronghai96@gmail.com>
@bito-code-review

Copy link
Copy Markdown
Contributor

AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).

export const DesignSystem = () => (
<>
<Markdown>
<MarkdownToJsx>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: Wrapping this markdown block in MarkdownToJsx now renders the embedded raw HTML anchor, which includes target="_blank" without rel="noopener noreferrer". That introduces a reverse-tabnabbing risk in rendered docs/stories; update the rendered link markup (or markdown renderer overrides) so external blank-target links always include a safe rel value. [security]

Severity Level: Major ⚠️
- ❌ Storybook design docs expose reverse-tabnabbing external link.
- ⚠️ Potential account hijack via malicious external site.
Steps of Reproduction ✅
1. Start the Storybook dev server that loads stories from
`superset-frontend/packages/superset-ui-core/src/components` (Storybook discovers
`*.stories.tsx` files; this file defines a `default` export at lines 22-24 naming the
story "Design System/Introduction").

2. In the Storybook UI, navigate to the "Design System/Introduction" story defined by
`export default { title: 'Design System/Introduction' };` at
`superset-frontend/packages/superset-ui-core/src/components/DesignSystem.stories.tsx:22-24`.

3. Observe that the `DesignSystem` story component at lines 26-42 wraps a markdown string
in `<MarkdownToJsx>` (line 28) which includes raw HTML for an external link at lines
36-38: `<a href="https://bradfrost.com/blog/post/atomic-web-design/" target="_blank">Intro
to Atomic Design</a>`.

4. Using browser devtools on the rendered story, inspect the "Intro to Atomic Design" link
and confirm the anchor is rendered with `target="_blank"` and no `rel` attribute; clicking
it opens a new tab while preserving `window.opener`, enabling reverse-tabnabbing if the
external site is compromised.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/packages/superset-ui-core/src/components/DesignSystem.stories.tsx
**Line:** 28:28
**Comment:**
	*Security: Wrapping this markdown block in `MarkdownToJsx` now renders the embedded raw HTML anchor, which includes `target="_blank"` without `rel="noopener noreferrer"`. That introduces a reverse-tabnabbing risk in rendered docs/stories; update the rendered link markup (or markdown renderer overrides) so external blank-target links always include a safe `rel` value.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@bito-code-review

Copy link
Copy Markdown
Contributor

The security concern regarding reverse-tabnabbing is valid. When using markdown-to-jsx to render raw HTML anchors with target="_blank", the browser does not automatically restrict the window.opener property, which can be exploited by a malicious linked site. To resolve this, you should ensure all external links with target="_blank" include rel="noopener noreferrer".

Since markdown-to-jsx allows overriding components, you can globally enforce this by providing an override for the a tag in your MarkdownToJsx configuration:

<MarkdownToJsx
  options={{
    overrides: {
      a: {
        props: {
          target: '_blank',
          rel: 'noopener noreferrer',
        },
      },
    },
  }}
>
  {markdownContent}
</MarkdownToJsx>

Alternatively, if you prefer to update the markdown content directly, you can manually add the rel attribute to the anchor tags: <a href="..." target="_blank" rel="noopener noreferrer">...</a>.

Regarding other comments on this PR, the provided comment file is empty, so there are no additional suggestions to address.

superset-frontend/packages/superset-ui-core/src/components/DesignSystem.stories.tsx

<MarkdownToJsx
  options={{
    overrides: {
      a: {
        props: {
          target: '_blank',
          rel: 'noopener noreferrer',
        },
      },
    },
  }}
>
  {markdownContent}
</MarkdownToJsx>

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.18%. Comparing base (42a2aed) to head (1249a15).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42214      +/-   ##
==========================================
- Coverage   65.19%   65.18%   -0.01%     
==========================================
  Files        2768     2768              
  Lines      156081   156081              
  Branches    35719    35719              
==========================================
- Hits       101754   101748       -6     
- Misses      52365    52371       +6     
  Partials     1962     1962              
Flag Coverage Δ
javascript 70.82% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: hainenber <dotronghai96@gmail.com>
@bito-code-review

bito-code-review Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #44457d

Actionable Suggestions - 0
Additional Suggestions - 4
  • superset-frontend/src/dashboard/components/SliceHeader/index.tsx - 2
    • Misleading import names · Line 47-48
      Import names `MemoizedFiltersBadge` and `MemoizedCustomizationsBadge` suggest these are memoized variants, but the source modules (`FiltersBadge/index.tsx`, `CustomizationsBadge/index.tsx`) only export default `memo(FiltersBadge)` and `memo(CustomizationsBadge)`. The `Memoized*` names are misleading as these are not separate memoized exports.
    • Redundant memoization · Line 336-336
      Components at lines 336 and 340 use `MemoizedCustomizationsBadge` and `MemoizedFiltersBadge` which are misleading names - the actual components are `CustomizationsBadge` and `FiltersBadge` (already memoized at definition). Consider using the original names for clarity.
  • superset-frontend/plugins/plugin-chart-table/src/index.ts - 2
    • CWE-N: Naming Inconsistency · Line 31-31
      The import variable `cachedBuildQueryInstance` uses an inconsistent naming convention compared to all other chart plugins (e.g., `plugin-chart-echarts/src/Pie/index.ts` line 21). Other plugins import the buildQuery module simply as `buildQuery`, creating a misleading semantic gap where the variable name suggests caching behavior not reflected in the property usage.
    • Inconsistent property assignment · Line 79-79
      The property assignment uses explicit aliasing `buildQuery: cachedBuildQueryInstance` which requires extra mental tracking—the variable name doesn't match the property name. Other chart plugins in this codebase use the shorter `buildQuery,` form when the import and property names are the same.
Review Details
  • Files reviewed - 13 · Commit Range: 2f7c72c..1249a15
    • superset-frontend/packages/superset-ui-core/src/components/DesignSystem.stories.tsx
    • superset-frontend/packages/superset-ui-core/src/components/DropdownContainer/Overview.stories.tsx
    • superset-frontend/packages/superset-ui-core/src/components/MetadataBar/MetadataBarOverview.stories.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Table/TableOverview.stories.tsx
    • superset-frontend/packages/superset-ui-core/src/components/Table/cell-renderers/ActionCell/ActionCell.overview.tsx
    • superset-frontend/packages/superset-ui-switchboard/src/index.ts
    • superset-frontend/plugins/plugin-chart-table/src/index.ts
    • superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts
    • superset-frontend/src/dashboard/components/SliceHeader/index.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBarSettings/index.tsx
    • superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterConfigurationLink/FilterConfigurationLink.test.tsx
    • superset-frontend/src/pages/Home/index.tsx
    • superset-frontend/src/views/App.tsx
  • Files skipped - 1
    • superset-frontend/oxlint.json - Reason: Filter setting
  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant