Skip to content

Commit e7cd95a

Browse files
committed
Merge branch 'windows-build-changes' of github.com:BSd3v/dash into windows-build-changes
2 parents e2226e7 + 349c4b9 commit e7cd95a

File tree

9 files changed

+32
-10
lines changed

9 files changed

+32
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ This project adheres to [Semantic Versioning](https://semver.org/).
44

55
## [UNRELEASED]
66

7+
## Fixed
8+
9+
- [#2756](https://github.com/plotly/dash/pull/2756) Prevent false dangerous link warning. Fixes [#2743](https://github.com/plotly/dash/issues/2743)
10+
711
## Changed
812

913
- [#2734](https://github.com/plotly/dash/pull/2734) Configure CI for Python 3.10 [#1863](https://github.com/plotly/dash/issues/1863)

components/dash-core-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"private::lint.eslint": "eslint src",
2020
"private::lint.flake8": "flake8 --exclude=dash_core_components,node_modules,venv",
2121
"private::lint.prettier": "prettier --config .prettierrc src/**/*.js --list-different",
22-
"prepublishOnly": "rimraf -rf lib && babel src --out-dir lib --copy-files --config-file ./.lib.babelrc && rimraf --glob -rf lib/jl/ lib/*.jl",
22+
"prepublishOnly": "rimraf lib && babel src --out-dir lib --copy-files --config-file ./.lib.babelrc && rimraf --glob lib/jl/ lib/*.jl",
2323
"test": "run-s -c lint test:intg test:pyimport",
2424
"test:intg": "pytest --nopercyfinalize --headless tests/integration ",
2525
"test:pyimport": "python -m unittest tests/test_dash_import.py",

components/dash-core-components/src/components/Link.react.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ const Link = props => {
4646
refresh,
4747
setProps,
4848
} = props;
49-
const sanitizedUrl = useMemo(() => sanitizeUrl(href), [href]);
49+
const sanitizedUrl = useMemo(() => {
50+
return href ? sanitizeUrl(href) : undefined;
51+
}, [href]);
5052

5153
const updateLocation = e => {
5254
const hasModifiers = e.metaKey || e.shiftKey || e.altKey || e.ctrlKey;
@@ -70,7 +72,7 @@ const Link = props => {
7072
};
7173

7274
useEffect(() => {
73-
if (sanitizedUrl !== href) {
75+
if (sanitizedUrl && sanitizedUrl !== href) {
7476
setProps({
7577
_dash_error: new Error(`Dangerous link detected:: ${href}`),
7678
});

components/dash-html-components/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ See the [contributing guide](CONTRIBUTING.md) for guidelines on contributing to
100100
```
101101
2. Cleanup the dist folder (optional)
102102
```
103-
$ rimraf -rf dist
103+
$ rimraf dist
104104
```
105105
3. Publish on NPM (Optional if chosen False in `publish_on_npm`)
106106
```

components/dash-html-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"homepage": "https://github.com/plotly/dash",
1515
"scripts": {
16-
"clean": "rimraf --glob -rf ./src/* && mkdirp ./src/components",
16+
"clean": "rimraf --glob ./src/* && mkdirp ./src/components",
1717
"prebuild": "cd scripts && sh generate-all.sh && cd ../../",
1818
"extract": "cd scripts && sh extract-all.sh",
1919
"lint": "eslint src scripts",

dash/_validate.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,11 @@ def validate_index(name, checks, index):
392392
def validate_layout_type(value):
393393
if not isinstance(value, (Component, patch_collections_abc("Callable"))):
394394
raise exceptions.NoLayoutException(
395-
"Layout must be a dash component "
396-
"or a function that returns a dash component."
395+
"""
396+
Layout must be a single dash component
397+
or a function that returns a dash component.
398+
Cannot be a tuple (are there any trailing commas?)
399+
"""
397400
)
398401

399402

dash/dash-renderer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "render dash components in react",
55
"main": "build/dash_renderer.min.js",
66
"scripts": {
7-
"prepublishOnly": "rimraf -rf lib && babel src --extensions=\".ts,.tsx,.js,.jsx\" --out-dir lib --copy-files",
7+
"prepublishOnly": "rimraf lib && babel src --extensions=\".ts,.tsx,.js,.jsx\" --out-dir lib --copy-files",
88
"private::format.eslint": "eslint --quiet --fix src tests",
99
"private::format.prettier": "prettier --write \"{src,tests}/**/*.{js,jsx,ts,tsx}\"",
1010
"private::lint.eslint": "eslint src tests",

dash/dash-renderer/src/utils/TreeContainer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ export function validateComponent(componentDefinition: any) {
6161
if (type(componentDefinition) === 'Array') {
6262
throw new Error(
6363
'The children property of a component is a list of lists, instead ' +
64-
'of just a list. ' +
65-
'Check the component that has the following contents, ' +
64+
'of just a list. This can sometimes be due to a trailing comma. ' +
65+
'Check the component that has the following contents ' +
6666
'and remove one of the levels of nesting: \n' +
6767
JSON.stringify(componentDefinition, null, 2)
6868
);

tests/integration/security/test_xss.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,16 @@ def test_xss001_banned_protocols(dash_duo):
4545
assert (
4646
element.get_attribute(prop) == "about:blank"
4747
), f"Failed prop: {element_id}.{prop}"
48+
49+
50+
def test_xss002_blank_href(dash_duo):
51+
app = Dash()
52+
53+
app.layout = html.Div(dcc.Link("dcc-link", href="", id="dcc-link-no-href"))
54+
55+
dash_duo.start_server(app)
56+
57+
element = dash_duo.find_element("#dcc-link-no-href")
58+
assert element.get_attribute("href") is None
59+
60+
assert dash_duo.get_logs() == []

0 commit comments

Comments
 (0)