Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-21881] System property for disabling X-Frame-Options
- Loading branch information
1 parent
aa7f0a9
commit fc78fde
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
core/src/main/java/jenkins/security/FrameOptionsPageDecorator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package jenkins.security; | ||
|
||
import hudson.Extension; | ||
import hudson.model.PageDecorator; | ||
import org.kohsuke.accmod.Restricted; | ||
import org.kohsuke.accmod.restrictions.NoExternalUse; | ||
|
||
/** | ||
* Adds the 'X-Frame-Options' header to all web pages. | ||
* | ||
* @since TODO | ||
*/ | ||
@Extension(ordinal = 1000) | ||
public class FrameOptionsPageDecorator extends PageDecorator { | ||
@Restricted(NoExternalUse.class) | ||
public static boolean enabled = Boolean.valueOf(System.getProperty(FrameOptionsPageDecorator.class.getName() + ".enabled", "true")); | ||
} |
6 changes: 6 additions & 0 deletions
6
core/src/main/resources/jenkins/security/FrameOptionsPageDecorator/httpHeaders.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"> | ||
<j:if test="${it.enabled}"> | ||
<st:header name="X-Frame-Options" value="sameorigin"/> | ||
</j:if> | ||
</j:jelly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters