1
0
mirror of synced 2026-08-05 01:36:56 +00:00

Deprecate X-FRAME-OPTIONS ALLOW-FROM Directive

Closes gh-8677
This commit is contained in:
Rob Winch
2020-06-10 10:06:38 -05:00
parent 6fbe58e624
commit a907026eae
10 changed files with 55 additions and 34 deletions
@@ -29,7 +29,12 @@ import javax.servlet.http.HttpServletRequest;
*
* @author Marten Deinum
* @since 3.2
* @deprecated ALLOW-FROM is an obsolete directive that no longer works in modern browsers. Instead use
* Content-Security-Policy with the
* <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors">frame-ancestors</a>
* directive.
*/
@Deprecated
abstract class AbstractRequestParameterAllowFromStrategy implements AllowFromStrategy {
private static final String DEFAULT_ORIGIN_REQUEST_PARAMETER = "x-frames-allow-from";
@@ -23,7 +23,12 @@ import javax.servlet.http.HttpServletRequest;
*
* @author Marten Deinum
* @since 3.2
* @deprecated ALLOW-FROM is an obsolete directive that no longer works in modern browsers. Instead use
* Content-Security-Policy with the
* <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors">frame-ancestors</a>
* directive.
*/
@Deprecated
public interface AllowFromStrategy {
/**
@@ -26,7 +26,12 @@ import java.util.regex.Pattern;
*
* @author Marten Deinum
* @since 3.2
* @deprecated ALLOW-FROM is an obsolete directive that no longer works in modern browsers. Instead use
* Content-Security-Policy with the
* <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors">frame-ancestors</a>
* directive.
*/
@Deprecated
public final class RegExpAllowFromStrategy extends
AbstractRequestParameterAllowFromStrategy {
@@ -20,7 +20,13 @@ import java.net.URI;
/**
* Simple implementation of the {@code AllowFromStrategy}
*
* @deprecated ALLOW-FROM is an obsolete directive that no longer works in modern browsers. Instead use
* Content-Security-Policy with the
* <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors">frame-ancestors</a>
* directive.
*/
@Deprecated
public final class StaticAllowFromStrategy implements AllowFromStrategy {
private final URI uri;
@@ -24,7 +24,12 @@ import org.springframework.util.Assert;
*
* @author Marten Deinum
* @since 3.2
* @deprecated ALLOW-FROM is an obsolete directive that no longer works in modern browsers. Instead use
* Content-Security-Policy with the
* <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors">frame-ancestors</a>
* directive.
*/
@Deprecated
public final class WhiteListedAllowFromStrategy extends
AbstractRequestParameterAllowFromStrategy {
@@ -68,7 +68,13 @@ public final class XFrameOptionsHeaderWriter implements HeaderWriter {
*
* @param allowFromStrategy the strategy for determining what the value for ALLOW_FROM
* is.
*
* @deprecated ALLOW-FROM is an obsolete directive that no longer works in modern browsers. Instead use
* Content-Security-Policy with the
* <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors">frame-ancestors</a>
* directive.
*/
@Deprecated
public XFrameOptionsHeaderWriter(AllowFromStrategy allowFromStrategy) {
Assert.notNull(allowFromStrategy, "allowFromStrategy cannot be null");
this.frameOptionsMode = XFrameOptionsMode.ALLOW_FROM;
@@ -107,7 +113,15 @@ public final class XFrameOptionsHeaderWriter implements HeaderWriter {
* @since 3.2
*/
public enum XFrameOptionsMode {
DENY("DENY"), SAMEORIGIN("SAMEORIGIN"), ALLOW_FROM("ALLOW-FROM");
DENY("DENY"), SAMEORIGIN("SAMEORIGIN"),
/**
* @deprecated ALLOW-FROM is an obsolete directive that no longer works in modern browsers. Instead use
* Content-Security-Policy with the
* <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors">frame-ancestors</a>
* directive.
*/
@Deprecated
ALLOW_FROM("ALLOW-FROM");
private String mode;