Commit graph

871 commits

Author SHA1 Message Date
Justin Goping
9b61b10245
Fix Trusted Types violations from dangerouslySetInnerHTML on style elements (#36751)
Remove dangerouslySetInnerHTML usage in style elements

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-22 00:26:54 -05:00
JJ Kasper
6e40fbd495
Ensure hydration error doc link is shown with react 18 (#37074)
Follow-up to https://github.com/vercel/next.js/pull/31519 this ensures the error link we added is shown with react 18 as well. 

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-05-20 19:04:27 +00:00
JJ Kasper
6cc2147386
v12.1.7-canary.10 2022-05-19 17:11:19 -05:00
JJ Kasper
50833d009d
v12.1.7-canary.9 2022-05-19 13:06:44 -05:00
JJ Kasper
5acf9db617
v12.1.7-canary.8 2022-05-18 20:35:50 -05:00
JJ Kasper
af86ca08e4
v12.1.7-canary.7 2022-05-17 11:01:35 -05:00
JJ Kasper
257eccb7fc
v12.1.7-canary.6 2022-05-13 10:25:27 -05:00
JJ Kasper
1ccf368f1a
v12.1.7-canary.5 2022-05-12 13:11:34 -05:00
JJ Kasper
334d42c441
v12.1.7-canary.4 2022-05-11 09:26:55 -05:00
Tim Neutkens
a1bb1c69ed v12.1.7-canary.3 2022-05-06 13:11:55 +02:00
Steven
cefb944ee5 v12.1.7-canary.2 2022-05-05 08:08:52 -04:00
Justin Goping
0dd62111f6
Fix various Trusted Types violations without use of policy (#34726)
Linked to issue #32209.

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation
There are three Trusted Types violations that are fixed in this PR:
### 1. ban-element-innerhtml-assignments: maintain--tab-focus.ts
The innerHTML assignment here is unsafe as a string is being used that could contain an XSS attack. The solution chosen was to replace the string containing HTML with programmatically-created DOM elements. This removes the Trusted Types violation as there is no longer a string passed in that can contain an XSS attack.

Notes on solution:
-  The `<svg>` tag is omitted completely since the original snippet returns fragment.firstChild.firstChild. The first firstChild omits the `<div>`, and the second firstChild omits the `<svg>`, so to remove unnecessary code the created elements start at the foreignObject level.
-  The reason createElementNS is used instead of createElement is because the ‘foreignObject’ element is a separate namespace from the default HTML elements. The documentation for this command is found [here](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS).

The code was tested to be equivalent by rendering both the original code and the re-written code in a browser to see if they evaluate to the same thing in the DOM. The DOM elements styles were then compared to ensure that they were identical.

### 2. ban-window-stringfunctiondef: packages/next/lib/recursive-delete.ts
The setTimeout function caused a Trusted Types violation because if a string is passed in as the callback, XSS can occur. The solution to this problem is to ensure that only function callbacks can be passed to setTimeout. There is only one call to the sleep function and it does not involve a string callback, so this can be enforced without breaking the application logic. In the process of doing this, promisify has been removed and the promise has been created explicitly.

The code was tested in a sample application to ensure it behaved as expected.

### 3. ban-window-stringfunctiondef: packages/next/client/dev/fouc.ts
This file also uses setTimeout, so the call was wrapped in a `safeSetTimeout` call that specifies that the callback argument is not a string.
2022-05-05 00:11:36 +00:00
JJ Kasper
87529e987c
v12.1.7-canary.1 2022-05-03 16:02:45 -05:00
Tim Neutkens
b9bf269991 v12.1.7-canary.0 2022-05-03 13:17:28 +02:00
JJ Kasper
b188fab336
v12.1.6 2022-05-02 14:46:56 -05:00
Tim Neutkens
0c23f5d1d2 v12.1.6-canary.17 2022-05-02 20:27:26 +02:00
Tim Neutkens
ddba1aab1f v12.1.6-canary.16 2022-05-01 18:58:46 +02:00
JJ Kasper
c838b5f50d
v12.1.6-canary.15 2022-04-29 11:54:57 -05:00
JJ Kasper
244456936b
v12.1.6-canary.14 2022-04-28 13:34:45 -05:00
Tim Neutkens
0b0b5ca75c v12.1.6-canary.13 2022-04-28 11:33:17 +02:00
JJ Kasper
af1d7c94f6
v12.1.6-canary.12 2022-04-27 14:23:09 -05:00
Tim Neutkens
5e3225da0f v12.1.6-canary.11 2022-04-27 18:40:33 +02:00
Tim Neutkens
5907e9d394 v12.1.6-canary.10 2022-04-27 17:34:18 +02:00
JJ Kasper
90863c70ea
v12.1.6-canary.9 2022-04-26 15:14:22 -05:00
Tim Neutkens
52816703be v12.1.6-canary.8 2022-04-26 14:15:28 +02:00
JJ Kasper
994f1823ba
v12.1.6-canary.7 2022-04-25 19:22:10 -05:00
Steven
94faeec1dd v12.1.6-canary.6 2022-04-22 08:57:41 -04:00
JJ Kasper
b8f7c520da
v12.1.6-canary.5 2022-04-21 10:07:37 -05:00
Tim Neutkens
0e2fd9280a v12.1.6-canary.4 2022-04-19 14:44:21 +02:00
JJ Kasper
e80c48e009
v12.1.6-canary.3 2022-04-16 11:15:20 -05:00
JJ Kasper
9c7311b1a5
v12.1.6-canary.2 2022-04-15 14:08:42 -05:00
JJ Kasper
6907519155
v12.1.6-canary.1 2022-04-14 10:23:58 -05:00
JJ Kasper
bc40c0b530
v12.1.6-canary.0 2022-04-13 12:45:39 -05:00
JJ Kasper
38d17bca0c
v12.1.5 2022-04-12 14:40:16 -05:00
JJ Kasper
9c613aaa66
v12.1.5-canary.7 2022-04-12 13:35:53 -05:00
JJ Kasper
a9d6d9f71a
v12.1.5-canary.6 2022-04-11 16:27:07 -05:00
JJ Kasper
da39e29c27
v12.1.5-canary.5 2022-04-11 12:00:35 -05:00
JJ Kasper
345f5cc351
v12.1.5-canary.4 2022-04-07 11:41:10 -05:00
JJ Kasper
211ce73c87
v12.1.5-canary.3 2022-04-06 13:34:56 -05:00
JJ Kasper
e146168c3b
v12.1.5-canary.2 2022-04-05 18:34:29 -05:00
JJ Kasper
4db8c49cc3
v12.1.5-canary.1 2022-04-04 10:29:32 -05:00
JJ Kasper
3069d4b770
v12.1.5-canary.0 2022-03-31 18:27:09 -05:00
Tim Neutkens
48a3222ccc v12.1.4 2022-03-31 08:58:14 +02:00
JJ Kasper
09ac22ff28
v12.1.4-canary.1 2022-03-30 21:21:00 -05:00
JJ Kasper
2f11413448
v12.1.4-canary.0 2022-03-30 17:28:11 -05:00
Tim Neutkens
7eee27f9ed v12.1.3 2022-03-30 21:49:00 +02:00
Tim Neutkens
bb918fd321 v12.1.3-canary.4 2022-03-30 20:52:45 +02:00
Tim Neutkens
2269f03af0 v12.1.3-canary.3 2022-03-30 18:34:13 +02:00
Tim Neutkens
eef557d4f8 v12.1.3-canary.2 2022-03-30 15:16:01 +02:00
Tim Neutkens
d876667aef v12.1.3-canary.1 2022-03-30 14:31:26 +02:00