Skip to content

Commit 1d87a74

Browse files
authored
fix: add rel="noopener noreferrer" to web console links opening in a new tab (#19483)
Several Blueprint MenuItem and AnchorButton usages in the web console open external links in a new tab via target="_blank" but do not set the companion rel attribute. Unlike the project's own ExternalLink component, Blueprint does not inject rel="noopener noreferrer" automatically (verified against the rendered HTML in about-dialog's snapshot), so each new tab can reach back into the opener window and the destination receives a Referer header. Add rel="noopener noreferrer" to every existing target="_blank" call site that was missing it: the help menu and Explore link in the header bar, the "Visit Druid" button in the about dialog, the DruidSQL docs menu item in the workbench, the array ingest mode docs menu item in the run panel, the flattenSpec help button in the load-data view, and the "Learn more" button in the SQL data loader schema step. Snapshot tests are updated to match the new rendered HTML; no other behavior changes.
1 parent 781aba6 commit 1d87a74

8 files changed

Lines changed: 27 additions & 2 deletions

File tree

web-console/src/components/header-bar/__snapshots__/header-bar.spec.tsx.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ exports[`HeaderBar matches snapshot 1`] = `
179179
}
180180
multiline={false}
181181
popoverProps={{}}
182+
rel="noopener noreferrer"
182183
selected={false}
183184
shouldDismissPopover={true}
184185
target="_blank"
@@ -390,6 +391,7 @@ exports[`HeaderBar matches snapshot 1`] = `
390391
icon="th"
391392
multiline={false}
392393
popoverProps={{}}
394+
rel="noopener noreferrer"
393395
shouldDismissPopover={true}
394396
target="_blank"
395397
text="Docs"
@@ -401,6 +403,7 @@ exports[`HeaderBar matches snapshot 1`] = `
401403
icon="user"
402404
multiline={false}
403405
popoverProps={{}}
406+
rel="noopener noreferrer"
404407
shouldDismissPopover={true}
405408
target="_blank"
406409
text="User group"
@@ -412,6 +415,7 @@ exports[`HeaderBar matches snapshot 1`] = `
412415
icon="chat"
413416
multiline={false}
414417
popoverProps={{}}
418+
rel="noopener noreferrer"
415419
shouldDismissPopover={true}
416420
target="_blank"
417421
text="Slack channel"
@@ -423,6 +427,7 @@ exports[`HeaderBar matches snapshot 1`] = `
423427
icon="git-branch"
424428
multiline={false}
425429
popoverProps={{}}
430+
rel="noopener noreferrer"
426431
shouldDismissPopover={true}
427432
target="_blank"
428433
text="GitHub"

web-console/src/components/header-bar/header-bar.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,31 +133,41 @@ export const HeaderBar = React.memo(function HeaderBar(props: HeaderBarProps) {
133133
disabled={!capabilities.hasSql()}
134134
selected={activeView === 'explore'}
135135
target="_blank"
136+
rel="noopener noreferrer"
136137
/>
137138
</Menu>
138139
);
139140

140141
const helpMenu = (
141142
<Menu>
142143
<MenuItem icon={IconNames.GRAPH} text="About" onClick={() => setAboutDialogOpen(true)} />
143-
<MenuItem icon={IconNames.TH} text="Docs" href={getLink('DOCS')} target="_blank" />
144+
<MenuItem
145+
icon={IconNames.TH}
146+
text="Docs"
147+
href={getLink('DOCS')}
148+
target="_blank"
149+
rel="noopener noreferrer"
150+
/>
144151
<MenuItem
145152
icon={IconNames.USER}
146153
text="User group"
147154
href={getLink('USER_GROUP')}
148155
target="_blank"
156+
rel="noopener noreferrer"
149157
/>
150158
<MenuItem
151159
icon={IconNames.CHAT}
152160
text="Slack channel"
153161
href={getLink('SLACK')}
154162
target="_blank"
163+
rel="noopener noreferrer"
155164
/>
156165
<MenuItem
157166
icon={IconNames.GIT_BRANCH}
158167
text="GitHub"
159168
href={getLink('GITHUB')}
160169
target="_blank"
170+
rel="noopener noreferrer"
161171
/>
162172
</Menu>
163173
);

web-console/src/dialogs/about-dialog/__snapshots__/about-dialog.spec.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ exports[`AboutDialog matches snapshot 1`] = `
140140
aria-disabled="false"
141141
class="bp5-button bp5-intent-primary"
142142
href="https://druid.apache.org"
143+
rel="noopener noreferrer"
143144
role="button"
144145
target="_blank"
145146
>

web-console/src/dialogs/about-dialog/about-dialog.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ export const AboutDialog = React.memo(function AboutDialog(props: AboutDialogPro
5757
<div className={Classes.DIALOG_FOOTER}>
5858
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
5959
<Button onClick={onClose}>Close</Button>
60-
<AnchorButton intent={Intent.PRIMARY} href={getLink('WEBSITE')} target="_blank">
60+
<AnchorButton
61+
intent={Intent.PRIMARY}
62+
href={getLink('WEBSITE')}
63+
target="_blank"
64+
rel="noopener noreferrer"
65+
>
6166
Visit Druid
6267
</AnchorButton>
6368
</div>

web-console/src/views/load-data-view/load-data-view.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,7 @@ export class LoadDataView extends React.PureComponent<LoadDataViewProps, LoadDat
17671767
icon={IconNames.INFO_SIGN}
17681768
href={`${getLink('DOCS')}/ingestion/data-formats#flattenspec`}
17691769
target="_blank"
1770+
rel="noopener noreferrer"
17701771
minimal
17711772
/>
17721773
</FormGroup>

web-console/src/views/sql-data-loader-view/schema-step/schema-step.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,7 @@ export const SchemaStep = function SchemaStep(props: SchemaStepProps) {
985985
text="Learn more..."
986986
href={`${getLink('DOCS')}/ingestion/schema-model#primary-timestamp`}
987987
target="_blank"
988+
rel="noopener noreferrer"
988989
intent={Intent.WARNING}
989990
minimal
990991
/>

web-console/src/views/workbench-view/run-panel/run-panel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ export const RunPanel = React.memo(function RunPanel(props: RunPanelProps) {
478478
text="Documentation"
479479
href={`${getLink('DOCS')}/querying/arrays#arrayingestmode`}
480480
target="_blank"
481+
rel="noopener noreferrer"
481482
/>
482483
</MenuItem>
483484
<MenuBoolean

web-console/src/views/workbench-view/workbench-view.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,7 @@ export class WorkbenchView extends React.PureComponent<WorkbenchViewProps, Workb
867867
text="DruidSQL documentation"
868868
href={getLink('DOCS_SQL')}
869869
target="_blank"
870+
rel="noopener noreferrer"
870871
/>
871872
)}
872873
{queryEngines.includes('sql-msq-task') &&

0 commit comments

Comments
 (0)