Skip to content

Commit 14cc642

Browse files
committed
X-Frame-Options: stop special-casing ALLOW-FROM
1 parent f03399c commit 14cc642

4 files changed

Lines changed: 4 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Changed
66

77
- **Breaking:** Where possible, increase TypeScript strictness around some strings. Only affects TypeScript users. See [#369](https://github.com/helmetjs/helmet/issues/369)
8+
- `helmet.frameguard` no longer offers a specific error when trying to use `ALLOW-FROM`; it just says that it is unsupported. Only the error message has changed
89

910
### Removed
1011

middlewares/x-frame-options/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Changed
66

77
- **Breaking:** increase TypeScript strictness around arguments. Only affects TypeScript users. See [helmetjs/helmet#369](https://github.com/helmetjs/helmet/issues/369)
8+
- No longer offer a specific error when trying to use `ALLOW-FROM`; it just says that it is unsupported. Only the error message has changed
89

910
## 4.0.0 - 2020-12-21
1011

middlewares/x-frame-options/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ function getHeaderValueFromOptions({
1616
case "DENY":
1717
case "SAMEORIGIN":
1818
return normalizedAction;
19-
case "ALLOW-FROM":
20-
throw new Error(
21-
"X-Frame-Options no longer supports `ALLOW-FROM` due to poor browser support. See <https://github.com/helmetjs/helmet/wiki/How-to-use-X%E2%80%93Frame%E2%80%93Options's-%60ALLOW%E2%80%93FROM%60-directive> for more info."
22-
);
2319
default:
2420
throw new Error(
2521
`X-Frame-Options received an invalid action ${JSON.stringify(action)}`

test/x-frame-options.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,12 @@ describe("X-Frame-Options middleware", () => {
5252
});
5353

5454
it("throws when passed invalid actions", () => {
55-
for (const action of ["allow-from", "ALLOW-FROM"]) {
56-
expect(() => xFrameOptions({ action: action as any })).toThrow(
57-
/^X-Frame-Options no longer supports `ALLOW-FROM` due to poor browser support. See <https:\/\/github.com\/helmetjs\/helmet\/wiki\/How-to-use-X%E2%80%93Frame%E2%80%93Options's-%60ALLOW%E2%80%93FROM%60-directive> for more info.$/
58-
);
59-
}
60-
6155
for (const action of [
6256
"",
6357
"foo",
6458
" deny",
59+
"allow-from",
60+
"ALLOW-FROM",
6561
123,
6662
null,
6763
new String("SAMEORIGIN"),

0 commit comments

Comments
 (0)