Add rel="noopener noreferrer" to external links (#14440) (#14819)

* Add rel=noreferrer to url field formatter

* Add rel="noopener noreferrer" to external links
This commit is contained in:
Tim Roes 2017-11-07 15:02:13 +01:00 committed by GitHub
parent 208fb0fe62
commit ee5eb88181
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 28 additions and 20 deletions

View file

@ -7,7 +7,7 @@ describe('UrlFormat', function () {
const url = new UrlFormat();
expect(url.convert('http://elastic.co', 'html'))
.to.be('<span ng-non-bindable><a href="http://elastic.co" target="_blank" rel="noopener">http://elastic.co</a></span>');
.to.be('<span ng-non-bindable><a href="http://elastic.co" target="_blank" rel="noopener noreferrer">http://elastic.co</a></span>');
});
it('outputs an <image> if type === "img"', function () {
@ -21,7 +21,7 @@ describe('UrlFormat', function () {
it('accepts a template', function () {
const url = new UrlFormat({ urlTemplate: 'url: {{ value }}' });
expect(url.convert('url', 'html'))
.to.be('<span ng-non-bindable><a href="url: url" target="_blank" rel="noopener">url: url</a></span>');
.to.be('<span ng-non-bindable><a href="url: url" target="_blank" rel="noopener noreferrer">url: url</a></span>');
});
it('only outputs the url if the contentType === "text"', function () {
@ -34,7 +34,7 @@ describe('UrlFormat', function () {
it('accepts a template', function () {
const url = new UrlFormat({ labelTemplate: 'extension: {{ value }}' });
expect(url.convert('php', 'html'))
.to.be('<span ng-non-bindable><a href="php" target="_blank" rel="noopener">extension: php</a></span>');
.to.be('<span ng-non-bindable><a href="php" target="_blank" rel="noopener noreferrer">extension: php</a></span>');
});
it('uses the label template for text formating', function () {

View file

@ -108,7 +108,7 @@ UrlFormat.prototype._convert = {
const linkTarget = this.param('openLinkInCurrentTab') ? '_self' : '_blank';
return `<a href="${url}" target="${linkTarget}" rel="noopener">${linkLabel}</a>`;
return `<a href="${url}" target="${linkTarget}" rel="noopener noreferrer">${linkLabel}</a>`;
}
}
};

View file

@ -60,7 +60,7 @@
</h3>
<p>
The search bar at the top uses Elasticsearch's support for Lucene <a class="kuiLink" documentation-href="query.luceneQuerySyntax" target="_blank">Query String syntax</a>. Let's say we're searching web server logs that have been parsed into a few fields.
The search bar at the top uses Elasticsearch's support for Lucene <a class="kuiLink" documentation-href="query.luceneQuerySyntax" target="_blank" rel="noopener noreferrer">Query String syntax</a>. Let's say we're searching web server logs that have been parsed into a few fields.
</p>
<h4>Examples:</h4>

View file

@ -89,6 +89,7 @@
aria-label="Learn how to index data into Elasticsearch"
documentation-href="indexPatterns.loadingData"
target="_blank"
rel="noopener noreferrer"
>
Learn how.
</a>

View file

@ -11,7 +11,7 @@ export function getUiSettingDefaults() {
},
'query:queryString:options': {
value: '{ "analyze_wildcard": true, "default_field": "*" }',
description: '<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html" target="_blank">Options</a> for the lucene query string parser',
description: '<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html" target="_blank" rel="noopener noreferrer">Options</a> for the lucene query string parser',
type: 'json'
},
'search:queryLanguage': {
@ -26,12 +26,12 @@ export function getUiSettingDefaults() {
},
'sort:options': {
value: '{ "unmapped_type": "boolean" }',
description: '<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html" target="_blank">Options</a> for the Elasticsearch sort parameter',
description: '<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html" target="_blank" rel="noopener noreferrer">Options</a> for the Elasticsearch sort parameter',
type: 'json'
},
'dateFormat': {
value: 'MMMM Do YYYY, HH:mm:ss.SSS',
description: 'When displaying a pretty formatted date, use this <a href="http://momentjs.com/docs/#/displaying/format/" target="_blank">format</a>',
description: 'When displaying a pretty formatted date, use this <a href="http://momentjs.com/docs/#/displaying/format/" target="_blank" rel="noopener noreferrer">format</a>',
},
'dateFormat:tz': {
value: 'Browser',
@ -54,7 +54,7 @@ export function getUiSettingDefaults() {
'Values that define the format used in situations where timebased' +
' data is rendered in order, and formatted timestamps should adapt to the' +
' interval between measurements. Keys are' +
' <a href="http://en.wikipedia.org/wiki/ISO_8601#Time_intervals" target="_blank">' +
' <a href="http://en.wikipedia.org/wiki/ISO_8601#Time_intervals" target="_blank" rel="noopener noreferrer">' +
'ISO8601 intervals.</a>'
)
},
@ -127,7 +127,8 @@ export function getUiSettingDefaults() {
description: 'The maximum geoHash precision displayed on tile maps: 7 is high, 10 is very high, ' +
'12 is the max. ' +
'<a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/' +
'search-aggregations-bucket-geohashgrid-aggregation.html#_cell_dimensions_at_the_equator" target="_blank">' +
'search-aggregations-bucket-geohashgrid-aggregation.html#_cell_dimensions_at_the_equator" ' +
'target="_blank" rel="noopener noreferrer">' +
'Explanation of cell dimensions</a>',
},
'visualization:tileMap:WMSdefaults': {
@ -144,7 +145,7 @@ export function getUiSettingDefaults() {
}
}, null, 2),
type: 'json',
description: 'Default <a href="http://leafletjs.com/reference.html#tilelayer-wms" target="_blank">properties</a> for the WMS map server support in the coordinate map'
description: 'Default <a href="http://leafletjs.com/reference.html#tilelayer-wms" target="_blank" rel="noopener noreferrer">properties</a> for the WMS map server support in the coordinate map'
},
'visualization:regionmap:showWarnings': {
value: true,
@ -215,22 +216,22 @@ export function getUiSettingDefaults() {
'format:number:defaultPattern': {
type: 'string',
value: '0,0.[000]',
description: 'Default <a href="http://numeraljs.com/" target="_blank">numeral format</a> for the "number" format'
description: 'Default <a href="http://numeraljs.com/" target="_blank" rel="noopener noreferrer">numeral format</a> for the "number" format'
},
'format:bytes:defaultPattern': {
type: 'string',
value: '0,0.[000]b',
description: 'Default <a href="http://numeraljs.com/" target="_blank">numeral format</a> for the "bytes" format'
description: 'Default <a href="http://numeraljs.com/" target="_blank" rel="noopener noreferrer">numeral format</a> for the "bytes" format'
},
'format:percent:defaultPattern': {
type: 'string',
value: '0,0.[000]%',
description: 'Default <a href="http://numeraljs.com/" target="_blank">numeral format</a> for the "percent" format'
description: 'Default <a href="http://numeraljs.com/" target="_blank" rel="noopener noreferrer">numeral format</a> for the "percent" format'
},
'format:currency:defaultPattern': {
type: 'string',
value: '($0,0.[00])',
description: 'Default <a href="http://numeraljs.com/" target="_blank">numeral format</a> for the "currency" format'
description: 'Default <a href="http://numeraljs.com/" target="_blank" rel="noopener noreferrer">numeral format</a> for the "currency" format'
},
'savedObjects:perPage': {
type: 'number',
@ -276,7 +277,7 @@ export function getUiSettingDefaults() {
},
'notifications:banner': {
type: 'markdown',
description: 'A custom banner intended for temporary notices to all users. <a href="https://help.github.com/articles/basic-writing-and-formatting-syntax/" target="_blank">Markdown supported</a>.',
description: 'A custom banner intended for temporary notices to all users. <a href="https://help.github.com/articles/basic-writing-and-formatting-syntax/" target="_blank" rel="noopener noreferrer">Markdown supported</a>.',
value: ''
},
'notifications:lifetime:banner': {

View file

@ -170,6 +170,7 @@
<a
href="https://www.elastic.co/guide/en/elasticsearch/reference/5.1/query-dsl-query-string-query.html#query-string-syntax"
target="_blank"
rel="noopener noreferrer"
>
Lucene query string
</a>
@ -194,6 +195,7 @@
<a
href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics.html"
target="_blank"
rel="noopener noreferrer"
>
Elasticsearch metric aggregation
</a>

View file

@ -45,6 +45,7 @@
class="kuiLink"
documentation-href="date.dateMath"
target="_blank"
rel="noopener noreferrer"
>
Accepted date formats
</a>

View file

@ -1,6 +1,6 @@
<div class="form-group">
<small class="pull-right">
<a ng-href="http://momentjs.com/" target="_blank">
<a ng-href="http://momentjs.com/" target="_blank" rel="noopener noreferrer">
Docs <i class="fa fa-link"></i>
</a>
</small>

View file

@ -1,6 +1,6 @@
<div class="form-group">
<small class="pull-right">
<a ng-href="https://adamwdraper.github.io/Numeral-js/" target="_blank">
<a ng-href="https://adamwdraper.github.io/Numeral-js/" target="_blank" rel="noopener noreferrer">
Docs <i class="fa fa-link"></i>
</a>
</small>
@ -19,4 +19,3 @@
placeholder="editor.field.format.getParamDefaults().pattern"
inputs="cntrl.sampleInputs">
</field-format-editor-pattern>

View file

@ -82,7 +82,7 @@
></filter-query-dsl-editor>
<p class="kuiText kuiVerticalRhythmSmall">
Filters are built using the <a class="kuiLink" target="_blank" documentation-href="query.queryDsl">Elasticsearch Query DSL</a>.
Filters are built using the <a class="kuiLink" target="_blank" rel="noopener noreferrer" documentation-href="query.queryDsl">Elasticsearch Query DSL</a>.
</p>
</div>
</div>

View file

@ -38,6 +38,7 @@
class="kuiLink"
documentation-href="date.dateMath"
target="_blank"
rel="noopener noreferrer"
>
Accepted date formats
</a>

View file

@ -23,6 +23,7 @@
class="kuiLink"
documentation-href="date.dateMath"
target="_blank"
rel="noopener noreferrer"
>
Accepted date formats
</a>

View file

@ -29,6 +29,7 @@
class="kuiLink"
documentation-href="query.luceneQuerySyntax"
target="_blank"
rel="noopener noreferrer"
>
Uses lucene query syntax
</a>
@ -58,6 +59,7 @@
class="kuiLink"
documentation-href="query.kueryQuerySyntax"
target="_blank"
rel="noopener noreferrer"
>
Uses kuery syntax
</a>