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

[JENKINS-74081] Migrate legacy checkUrl in /ValidatingStringParameterDefinition/index.jelly #146

Merged
merged 1 commit into from
Nov 16, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@
* Called to validate the passed user entered value against the configured regular expression.
*/
@POST
public FormValidation doValidate(@QueryParameter("regex") String regex,
@QueryParameter("failedValidationMessage") final String failedValidationMessage,
@QueryParameter("value") final String value) {
public FormValidation doValidate(@QueryParameter String regex, @QueryParameter final String failedValidationMessage,

Check warning

Code scanning / Jenkins Security Scan

Stapler: Missing permission check Warning

Potential missing permission check in DescriptorImpl#doValidate
@QueryParameter final String value) {
try {
if (Pattern.matches(regex, value)) {
return FormValidation.ok();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ THE SOFTWARE.
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">

<j:set var="escapeEntryTitleAndDescription" value="false"/>

<f:entry title="${h.xmlEscape(it.name)}" description="${it.formattedDescription}">
<div name="parameter" description="${it.formattedDescription}">
<input type="hidden" name="name" value="${it.name}" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, I guess this line had to stay. I'll fix this tomorrow morning CET.

<f:textbox name="value" value="${it.defaultValue}"
checkUrl="'${rootURL}/descriptorByName/hudson.plugins.validating_string_parameter.ValidatingStringParameterDefinition/validate?regex='+encodeURIComponent('${h.jsStringEscape(it.regex)}')+'&amp;failedValidationMessage='+encodeURIComponent('${h.jsStringEscape(it.failedValidationMessage)}')+'&amp;value='+encodeURIComponent(this.value)"/>
</div>

<f:invisibleEntry>
<f:textbox field="regex" value="${it.regex}"/>
</f:invisibleEntry>
<f:invisibleEntry>
<f:textbox field="failedValidationMessage" value="${it.failedValidationMessage}"/>
</f:invisibleEntry>
<f:entry title="${h.xmlEscape(it.name)}" description="${it.formattedDescription}" field="defaultValue">
<f:textbox value="${it.defaultValue}" checkUrl="${it.descriptor.descriptorFullUrl}/validate"
checkDependsOn="regex failedValidationMessage"/>
</f:entry>
</j:jelly>