Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make plugin CSP compliant #2551

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ private boolean canApplyFrom(List<YamlSource> yamlSources) {

@POST
@Restricted(NoExternalUse.class)
public FormValidation doCheckNewSource(@QueryParameter String newSource) {
public FormValidation doCheckNewSource(@QueryParameter String value) {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
String normalizedSource = Util.fixEmptyAndTrim(newSource);
String normalizedSource = Util.fixEmptyAndTrim(value);
if (normalizedSource == null) {
return FormValidation.ok(); // empty, do nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<f:form method="post" action="replace" name="replace">
<h2>${%Replace configuration source with:}</h2>
<f:entry title="${%Path or URL}" field="newSource" >
<f:textbox checkUrl="'checkNewSource?newSource='+escape(this.value)" checkMethod="post" />
<f:textbox checkUrl="checkNewSource" checkDependsOn=""/>
</f:entry>
<f:block>
<f:submit name="replace" value="${%Apply new configuration}"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,100 +1,19 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler">
<st:contentType value="text/html;charset=UTF-8"/>
<j:new var="h" className="hudson.Functions"/>
<j:invoke on="${h}" method="initPageVariables">
<j:arg value="${context}"/>
</j:invoke>
<html><head>
<style class='anchorjs'></style><link href='https://jenkins.io/assets/bower/bootstrap/css/bootstrap.min.css' media='screen' rel='stylesheet'/>
<link href='https://jenkins.io/assets/bower/bootstrap/css/bootstrap.min.css' media='screen' rel='stylesheet'/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯 what is this doing here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what that style could be for. The reference page works just fine without it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if its fine do you mind removing it now too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bootstrap is required, without it the page looks bad, I was referring to the <style class="anchorjs"></style>, that this isn't required

<link href='https://jenkins.io/assets/bower/tether/css/tether.min.css' media='screen' rel='stylesheet'/>
<link href='https://jenkins.io/css/font-icons.css' media='screen' rel='stylesheet'/>
<link href='https://jenkins.io/css/jenkins.css' media='screen' rel='stylesheet'/>
<link href='https://jenkins.io/assets/bower/ionicons/css/ionicons.min.css' media='screen' rel='stylesheet'/>
<link href='https://jenkins.io/css/footer.css' media='screen' rel='stylesheet'/>
<link href='https://jenkins.io/css/font-awesome.min.css' media='screen' rel='stylesheet'/>
<style>
.configurator {
margin-top: 30px;
}

.configurator__name {
font-size: 1.5em;
}

.configurator-pointer {
font-size: 0.5em;
color: #454545;
font-weight: 100;
}

.root-configurator-pointer {
font-size: 0.5em;
color: #7f5200;
font-weight: 100;
}

.configurator-attributes {
display: flex;
flex-direction: column;
}

.configurator-attribute {
display: flex;
flex-grow: 1;
margin-left: 25px;
border-left: 1px solid #ccc;
line-height: 24px;
}

.configurator-attribute__name {
display: flex;
flex-direction: column;
flex-basis: 30%;
min-height: 30px;
padding-top: 5px;
}

.attribute-name {
display:flex;
}

.attribute-name:before {
content: '';
display: block;
margin-right: 10px;
border-top: 1px solid #ccc;
width: 10px;
margin-top: 12px;
}


.attribute-name:after {
content: '';
display: block;
margin-left: 10px;
border-top: 1px dashed #ccc;
flex: 1;
margin-top: 12px;
}

.configurator-attribute__details {
display: flex;
flex-direction: column;
flex: 1;
padding: 5px;
}

.attribute-type {
color: #454545;
}

.attribute-type__list {
color: #999;
margin-right: 5px;
}

.attribute-type__class {
font-family: Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
font-size: 0.8em;
}
</style>
<link href='${rootURL}/plugin/configuration-as-code/css/reference.css' rel='stylesheet'/>
</head>

<body class='syntax'>
Expand Down
84 changes: 84 additions & 0 deletions plugin/src/main/webapp/css/reference.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
.configurator {
margin-top: 30px;
}

.configurator__name {
font-size: 1.5em;
}

.configurator-pointer {
font-size: 0.5em;
color: #454545;
font-weight: 100;
}

.root-configurator-pointer {
font-size: 0.5em;
color: #7f5200;
font-weight: 100;
}

.configurator-attributes {
display: flex;
flex-direction: column;
}

.configurator-attribute {
display: flex;
flex-grow: 1;
margin-left: 25px;
border-left: 1px solid #ccc;
line-height: 24px;
}

.configurator-attribute__name {
display: flex;
flex-direction: column;
flex-basis: 30%;
min-height: 30px;
padding-top: 5px;
}

.attribute-name {
display:flex;
}

.attribute-name:before {
content: '';
display: block;
margin-right: 10px;
border-top: 1px solid #ccc;
width: 10px;
margin-top: 12px;
}


.attribute-name:after {
content: '';
display: block;
margin-left: 10px;
border-top: 1px dashed #ccc;
flex: 1;
margin-top: 12px;
}

.configurator-attribute__details {
display: flex;
flex-direction: column;
flex: 1;
padding: 5px;
}

.attribute-type {
color: #454545;
}

.attribute-type__list {
color: #999;
margin-right: 5px;
}

.attribute-type__class {
font-family: Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
font-size: 0.8em;
}
Loading