Skip to content

Commit 87bbb9e

Browse files
authored
Merge branch 'master' into bug/validation-messages
2 parents ec2179f + 1d98a8f commit 87bbb9e

File tree

13 files changed

+135
-52
lines changed

13 files changed

+135
-52
lines changed

.github/issue_template.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<!---
22
Thanks for filing an issue 😄 ! Before you submit, please read the following:
33
4+
If you're here to report a security issue, please STOP writing an issue and contact us
5+
at [email protected] instead!
6+
47
Search open/closed issues before submitting since someone might have asked the same thing before!
58
69
Issues on GitHub are only related to problems of Swagger-UI itself. We'll try to offer support

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The OpenAPI Specification has undergone 5 revisions since initial creation in 20
2222

2323
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes
2424
------------------ | ------------ | -------------------------- | -----
25-
3.4.1 | 2017-10-20 | 2.0, 3.0 | [tag v3.4.1](https://github.com/swagger-api/swagger-ui/tree/v3.4.1)
25+
3.4.2 | 2017-10-30 | 2.0, 3.0 | [tag v3.4.2](https://github.com/swagger-api/swagger-ui/tree/v3.4.2)
2626
3.0.21 | 2017-07-26 | 2.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-ui/tree/v3.0.21)
2727
2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10)
2828
2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5)

dist/swagger-ui-bundle.js

Lines changed: 59 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "swagger-ui",
3-
"version": "3.4.1",
3+
"version": "3.4.2",
44
"main": "dist/swagger-ui.js",
55
"repository": "[email protected]:swagger-api/swagger-ui.git",
66
"contributors": [
@@ -39,6 +39,7 @@
3939
"e2e": "npm-run-all --parallel -r hot-server mock-api test-e2e"
4040
},
4141
"dependencies": {
42+
"@braintree/sanitize-url": "^2.0.2",
4243
"base64-js": "^1.2.0",
4344
"brace": "0.7.0",
4445
"classnames": "^2.2.5",

src/core/components/info.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from "react"
22
import PropTypes from "prop-types"
33
import { fromJS } from "immutable"
44
import ImPropTypes from "react-immutable-proptypes"
5+
import { sanitizeUrl } from "core/utils"
56

67

78
class Path extends React.Component {
@@ -35,9 +36,9 @@ class Contact extends React.Component {
3536

3637
return (
3738
<div>
38-
{ url && <div><a href={ url } target="_blank">{ name } - Website</a></div> }
39+
{ url && <div><a href={ sanitizeUrl(url) } target="_blank">{ name } - Website</a></div> }
3940
{ email &&
40-
<a href={`mailto:${email}`}>
41+
<a href={sanitizeUrl(`mailto:${email}`)}>
4142
{ url ? `Send email to ${name}` : `Contact ${name}`}
4243
</a>
4344
}
@@ -59,7 +60,7 @@ class License extends React.Component {
5960
return (
6061
<div>
6162
{
62-
url ? <a target="_blank" href={ url }>{ name }</a>
63+
url ? <a target="_blank" href={ sanitizeUrl(url) }>{ name }</a>
6364
: <span>{ name }</span>
6465
}
6566
</div>
@@ -97,7 +98,7 @@ export default class Info extends React.Component {
9798
{ version && <VersionStamp version={version}></VersionStamp> }
9899
</h2>
99100
{ host || basePath ? <Path host={ host } basePath={ basePath } /> : null }
100-
{ url && <a target="_blank" href={ url }><span className="url"> { url } </span></a> }
101+
{ url && <a target="_blank" href={ sanitizeUrl(url) }><span className="url"> { url } </span></a> }
101102
</hgroup>
102103

103104
<div className="description">
@@ -106,14 +107,14 @@ export default class Info extends React.Component {
106107

107108
{
108109
termsOfService && <div>
109-
<a target="_blank" href={ termsOfService }>Terms of service</a>
110+
<a target="_blank" href={ sanitizeUrl(termsOfService) }>Terms of service</a>
110111
</div>
111112
}
112113

113114
{ contact && contact.size ? <Contact data={ contact } /> : null }
114115
{ license && license.size ? <License license={ license } /> : null }
115116
{ externalDocsUrl ?
116-
<a target="_blank" href={externalDocsUrl}>{externalDocsDescription || externalDocsUrl}</a>
117+
<a target="_blank" href={sanitizeUrl(externalDocsUrl)}>{externalDocsDescription || externalDocsUrl}</a>
117118
: null }
118119

119120
</div>

src/core/components/online-validator-badge.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react"
22
import PropTypes from "prop-types"
3+
import { sanitizeUrl } from "core/utils"
34

45
export default class OnlineValidatorBadge extends React.Component {
56
static propTypes = {
@@ -32,6 +33,8 @@ export default class OnlineValidatorBadge extends React.Component {
3233
let { getConfigs } = this.props
3334
let { spec } = getConfigs()
3435

36+
let sanitizedValidatorUrl = sanitizeUrl(this.state.validatorUrl)
37+
3538
if ( typeof spec === "object" && Object.keys(spec).length) return null
3639

3740
if (!this.state.url || !this.state.validatorUrl || this.state.url.indexOf("localhost") >= 0
@@ -40,8 +43,8 @@ export default class OnlineValidatorBadge extends React.Component {
4043
}
4144

4245
return (<span style={{ float: "right"}}>
43-
<a target="_blank" href={`${ this.state.validatorUrl }/debug?url=${ this.state.url }`}>
44-
<ValidatorImage src={`${ this.state.validatorUrl }?url=${ this.state.url }`} alt="Online validator badge"/>
46+
<a target="_blank" href={`${ sanitizedValidatorUrl }/debug?url=${ this.state.url }`}>
47+
<ValidatorImage src={`${ sanitizedValidatorUrl }?url=${ this.state.url }`} alt="Online validator badge"/>
4548
</a>
4649
</span>)
4750
}

src/core/components/operation.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { PureComponent } from "react"
22
import PropTypes from "prop-types"
33
import { getList } from "core/utils"
44
import * as CustomPropTypes from "core/proptypes"
5+
import { sanitizeUrl } from "core/utils"
56

67
//import "less/opblock"
78

@@ -206,7 +207,7 @@ export default class Operation extends PureComponent {
206207
<span className="opblock-external-docs__description">
207208
<Markdown source={ externalDocs.get("description") } />
208209
</span>
209-
<a className="opblock-external-docs__link" href={ externalDocs.get("url") }>{ externalDocs.get("url") }</a>
210+
<a className="opblock-external-docs__link" href={ sanitizeUrl(externalDocs.get("url")) }>{ externalDocs.get("url") }</a>
210211
</div>
211212
</div> : null
212213
}

0 commit comments

Comments
 (0)