Commit e7ed683
committed
[Fizz] escape <style> textContent as css (#28870)
style text content has historically been escaped as HTML which is
non-sensical and often leads users to using dangerouslySetInnerHTML as a
matter of course. While rendering untrusted style rules is a security
risk React doesn't really provide any special protection here and
forcing users to use a completely unescaped API is if anything worse. So
this PR updates the style escaping rules for Fizz to only escape the
text content to ensure the tag scope cannot be closed early. This is
accomplished by encoding "s" and "S" as hexadecimal unicode
representation "\73 " and "\53 " respectively when found within a
sequence like </style>. We have to be careful to support casing here
just like with the script closing tag regex for bootstrap scripts.
DiffTrain build for [aead514](aead514)1 parent f29aad9 commit e7ed683
File tree
7 files changed
+95
-17
lines changed- compiled/facebook-www
7 files changed
+95
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
4924 | 4924 | | |
4925 | 4925 | | |
4926 | 4926 | | |
| 4927 | + | |
| 4928 | + | |
| 4929 | + | |
| 4930 | + | |
| 4931 | + | |
| 4932 | + | |
| 4933 | + | |
| 4934 | + | |
| 4935 | + | |
| 4936 | + | |
| 4937 | + | |
| 4938 | + | |
| 4939 | + | |
| 4940 | + | |
| 4941 | + | |
| 4942 | + | |
| 4943 | + | |
| 4944 | + | |
| 4945 | + | |
| 4946 | + | |
4927 | 4947 | | |
4928 | 4948 | | |
4929 | 4949 | | |
| |||
4968 | 4988 | | |
4969 | 4989 | | |
4970 | 4990 | | |
4971 | | - | |
| 4991 | + | |
4972 | 4992 | | |
4973 | 4993 | | |
4974 | 4994 | | |
| |||
5013 | 5033 | | |
5014 | 5034 | | |
5015 | 5035 | | |
5016 | | - | |
| 5036 | + | |
5017 | 5037 | | |
5018 | 5038 | | |
5019 | 5039 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
4924 | 4924 | | |
4925 | 4925 | | |
4926 | 4926 | | |
| 4927 | + | |
| 4928 | + | |
| 4929 | + | |
| 4930 | + | |
| 4931 | + | |
| 4932 | + | |
| 4933 | + | |
| 4934 | + | |
| 4935 | + | |
| 4936 | + | |
| 4937 | + | |
| 4938 | + | |
| 4939 | + | |
| 4940 | + | |
| 4941 | + | |
| 4942 | + | |
| 4943 | + | |
| 4944 | + | |
| 4945 | + | |
| 4946 | + | |
4927 | 4947 | | |
4928 | 4948 | | |
4929 | 4949 | | |
| |||
4968 | 4988 | | |
4969 | 4989 | | |
4970 | 4990 | | |
4971 | | - | |
| 4991 | + | |
4972 | 4992 | | |
4973 | 4993 | | |
4974 | 4994 | | |
| |||
5013 | 5033 | | |
5014 | 5034 | | |
5015 | 5035 | | |
5016 | | - | |
| 5036 | + | |
5017 | 5037 | | |
5018 | 5038 | | |
5019 | 5039 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
707 | 711 | | |
708 | 712 | | |
709 | 713 | | |
| |||
1435 | 1439 | | |
1436 | 1440 | | |
1437 | 1441 | | |
1438 | | - | |
| 1442 | + | |
1439 | 1443 | | |
1440 | 1444 | | |
1441 | 1445 | | |
| |||
1484 | 1488 | | |
1485 | 1489 | | |
1486 | 1490 | | |
1487 | | - | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
1488 | 1494 | | |
1489 | 1495 | | |
1490 | 1496 | | |
| |||
5680 | 5686 | | |
5681 | 5687 | | |
5682 | 5688 | | |
5683 | | - | |
| 5689 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
707 | 711 | | |
708 | 712 | | |
709 | 713 | | |
| |||
1435 | 1439 | | |
1436 | 1440 | | |
1437 | 1441 | | |
1438 | | - | |
| 1442 | + | |
1439 | 1443 | | |
1440 | 1444 | | |
1441 | 1445 | | |
| |||
1484 | 1488 | | |
1485 | 1489 | | |
1486 | 1490 | | |
1487 | | - | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
1488 | 1494 | | |
1489 | 1495 | | |
1490 | 1496 | | |
| |||
5658 | 5664 | | |
5659 | 5665 | | |
5660 | 5666 | | |
5661 | | - | |
| 5667 | + | |
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4921 | 4921 | | |
4922 | 4922 | | |
4923 | 4923 | | |
| 4924 | + | |
| 4925 | + | |
| 4926 | + | |
| 4927 | + | |
| 4928 | + | |
| 4929 | + | |
| 4930 | + | |
| 4931 | + | |
| 4932 | + | |
| 4933 | + | |
| 4934 | + | |
| 4935 | + | |
| 4936 | + | |
| 4937 | + | |
| 4938 | + | |
| 4939 | + | |
| 4940 | + | |
| 4941 | + | |
| 4942 | + | |
| 4943 | + | |
4924 | 4944 | | |
4925 | 4945 | | |
4926 | 4946 | | |
| |||
4965 | 4985 | | |
4966 | 4986 | | |
4967 | 4987 | | |
4968 | | - | |
| 4988 | + | |
4969 | 4989 | | |
4970 | 4990 | | |
4971 | 4991 | | |
| |||
5010 | 5030 | | |
5011 | 5031 | | |
5012 | 5032 | | |
5013 | | - | |
| 5033 | + | |
5014 | 5034 | | |
5015 | 5035 | | |
5016 | 5036 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
689 | 693 | | |
690 | 694 | | |
691 | 695 | | |
| |||
1428 | 1432 | | |
1429 | 1433 | | |
1430 | 1434 | | |
1431 | | - | |
| 1435 | + | |
1432 | 1436 | | |
1433 | 1437 | | |
1434 | 1438 | | |
| |||
1477 | 1481 | | |
1478 | 1482 | | |
1479 | 1483 | | |
1480 | | - | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
1481 | 1487 | | |
1482 | 1488 | | |
1483 | 1489 | | |
| |||
0 commit comments