Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ node_modules/

# Generated JavaScript Bundles
war/src/main/webapp/jsbundles/
apache-maven-3.9.6-bin.tar.gz
209 changes: 134 additions & 75 deletions core/src/main/java/jenkins/install/SetupWizard.java

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions core/src/main/java/jenkins/security/ResourceDomainFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,16 @@
public class ResourceDomainFilter implements HttpServletFilter {

private static final Logger LOGGER = Logger.getLogger(ResourceDomainFilter.class.getName());

private static final Set<String> ALLOWED_PATHS = new HashSet<>(Arrays.asList("/" + ResourceDomainRootAction.URL, "/favicon.ico", "/favicon.svg", "/apple-touch-icon.png", "/mask-icon.svg", "/robots.txt", "/images/rage.svg"));
private static final Set<String> ALLOWED_PATHS = new HashSet<>(Arrays.asList(
"/" + ResourceDomainRootAction.URL,
"/favicon.ico",
"/favicon.svg",
"/apple-touch-icon.png",
"/mask-icon.svg",
"/robots.txt",
//"/images/rage.svg",
"/images/shrug.svg"
));
public static final String ERROR_RESPONSE = "Jenkins serves only static files on this domain.";

@Override
Expand Down
44 changes: 8 additions & 36 deletions core/src/main/resources/jenkins/model/Jenkins/_404.jelly
Original file line number Diff line number Diff line change
@@ -1,60 +1,32 @@
<!--
The MIT License

Copyright (c) 2021 Daniel Beck

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<!--
This is the page designated by web.xml to handle 404 errors. Show a nice error message and suggest logging in if applicable.
Generally kept very similar to 'oops.jelly'.
-->
<st:statusCode value="${response2.getStatus()}" />
${request2.session.setAttribute('from', request2.getAttribute('jakarta.servlet.error.request_uri'))}
<l:layout title="${%title(jakarta.servlet.error.message?:'Not Found')}" type="one-column">
<l:header />
<l:main-panel>
<h1 style="text-align: center">
<img src="${imagesURL}/rage.svg" height="179" width="154"/>
<img src="${imagesURL}/shrug.svg" height="179" width="154" alt="${%Page Not Found}" />
<span style="font-size:50px"><st:nbsp/>${%Oops!}</span>
</h1>
<div id="error-description" style="text-align: center">
<h2>${%title(jakarta.servlet.error.message?:'Not Found')}</h2>
<j:if test="${!request2.getAttribute('jenkins.security.ResourceDomainRootAction.error')}">
<p>
<j:choose>
<j:when test="${app.useSecurity}">
<p>
<j:choose>
<j:when test="${app.useSecurity}">
${%noAccess}
<j:if test="${h.isAnonymous()}">
${%tryLoggingIn}
</j:if>
</j:when>
<j:otherwise>
${%notFound}
</j:when>
<j:otherwise>
${%notFound}
</j:otherwise>
</j:choose>
</p>
</j:if>
</div>
</l:main-panel>
</l:layout>
</j:jelly>
</j:jelly>
36 changes: 3 additions & 33 deletions core/src/main/resources/jenkins/model/Jenkins/_404_simple.jelly
Original file line number Diff line number Diff line change
@@ -1,34 +1,5 @@
<!--
The MIT License

Copyright (c) 2021 Daniel Beck

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:x="jelly:xml">
<!--
This is the page designated by web.xml to handle 404 errors on the resource domain.
We do not have access to all the javascript and css resources here, so render a simple page.
Do not use /lib/layout:layout with type="full-screen" here to prevent external contributions.
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:x="jelly:xml">
<l:view contentType="text/html;charset=UTF-8">
<st:setHeader name="Expires" value="0" />
<st:setHeader name="Cache-Control" value="no-cache,no-store,must-revalidate" />
Expand All @@ -42,13 +13,12 @@ THE SOFTWARE.
<title>${%title(jakarta.servlet.error.message?:'Not Found')}</title>
<link rel="icon" href="${resURL}/favicon.svg" type="image/svg+xml" />
<link rel="alternate icon" href="${resURL}/favicon.ico" sizes="any" />
<!-- TODO Determine need for these -->
<link rel="apple-touch-icon" href="${resURL}/apple-touch-icon.png" sizes="180x180" />
<link rel="mask-icon" href="${resURL}/mask-icon.svg" color="#191717" />
</head>
<body style="font-family: system-ui, sans-serif">
<h1 style="text-align: center">
<img src="${imagesURL}/rage.svg" height="179" width="154" style="vertical-align: middle"/>
<img src="${imagesURL}/shrug.svg" height="179" width="154" alt="${%Page Not Found}" />
<span style="font-size:50px"><st:nbsp/>${%Oops!}</span>
</h1>
<div style="text-align: center">
Expand All @@ -58,4 +28,4 @@ THE SOFTWARE.
</body>
</html>
</l:view>
</j:jelly>
</j:jelly>
Loading
Loading