From 6027a23f88c770d38751c57c5842bc1c8010b640 Mon Sep 17 00:00:00 2001 From: Michael Dailey Date: Wed, 14 Jun 2023 12:20:30 -0500 Subject: [PATCH 1/2] Added POST annotation for Form Validations --- src/main/java/io/jenkins/plugins/ProvarAutomation.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/io/jenkins/plugins/ProvarAutomation.java b/src/main/java/io/jenkins/plugins/ProvarAutomation.java index 84ffc69..126f034 100644 --- a/src/main/java/io/jenkins/plugins/ProvarAutomation.java +++ b/src/main/java/io/jenkins/plugins/ProvarAutomation.java @@ -42,6 +42,7 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.verb.POST; import javax.servlet.ServletException; import java.io.File; @@ -455,6 +456,7 @@ public boolean configure(StaplerRequest req, JSONObject json) throws FormExcepti public static final SalesforceMetadataCacheSettings defaultSalesforceMetadataCacheSetting = SalesforceMetadataCacheSettings.Reuse; public static final ResultsPathSettings defaultResultsPathSetting = ResultsPathSettings.Increment; + @POST public ListBoxModel doFillBrowserItems() { ListBoxModel items = new ListBoxModel(); if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { @@ -471,6 +473,7 @@ public ListBoxModel doFillBrowserItems() { return items; } + @POST public ListBoxModel doFillSalesforceMetadataCacheSettingItems() { ListBoxModel items = new ListBoxModel(); if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { @@ -482,6 +485,7 @@ public ListBoxModel doFillSalesforceMetadataCacheSettingItems() { return items; } + @POST public ListBoxModel doFillResultsPathSettingItems() { ListBoxModel items = new ListBoxModel(); if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { @@ -592,6 +596,7 @@ public List getDefaultInstallers() { /** * Checks if the PROVAR_HOME is valid. */ + @POST public FormValidation doCheckHome(@QueryParameter File value) { // this can be used to check the existence of a file on the server, so needs to be protected if(!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) From 6fb7b001bc907103d0f6c7ecf9f6c4c6364e30f9 Mon Sep 17 00:00:00 2001 From: Michael Dailey Date: Wed, 14 Jun 2023 12:56:44 -0500 Subject: [PATCH 2/2] Added POST annotation for Form Validations (missing few) --- src/main/java/io/jenkins/plugins/ProvarAutomation.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/io/jenkins/plugins/ProvarAutomation.java b/src/main/java/io/jenkins/plugins/ProvarAutomation.java index 126f034..59c05d5 100644 --- a/src/main/java/io/jenkins/plugins/ProvarAutomation.java +++ b/src/main/java/io/jenkins/plugins/ProvarAutomation.java @@ -375,6 +375,7 @@ public void setInstallations(ProvarAutomationInstallation... provarAutomationIns save(); } + @POST public FormValidation doCheckBuildFile(@QueryParameter String value) throws IOException, ServletException { if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { @@ -385,6 +386,7 @@ public FormValidation doCheckBuildFile(@QueryParameter String value) return FormValidation.validateRequired(value); } + @POST public FormValidation doCheckTestPlan(@QueryParameter String value) throws IOException, ServletException { if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { @@ -396,6 +398,7 @@ public FormValidation doCheckTestPlan(@QueryParameter String value) return FormValidation.ok(); } + @POST public FormValidation doCheckTestFolder(@QueryParameter String value) throws IOException, ServletException { if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { @@ -407,6 +410,7 @@ public FormValidation doCheckTestFolder(@QueryParameter String value) return FormValidation.ok(); } + @POST public FormValidation doCheckSecretsPassword(@QueryParameter String value) throws IOException, ServletException { if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { @@ -418,6 +422,7 @@ public FormValidation doCheckSecretsPassword(@QueryParameter String value) return FormValidation.ok(); } + @POST public FormValidation doCheckProjectName(@QueryParameter String value) throws IOException, ServletException { if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { @@ -615,6 +620,7 @@ public FormValidation doCheckHome(@QueryParameter File value) { return FormValidation.ok(); } + @POST public FormValidation doCheckName(@QueryParameter String value) { return FormValidation.validateRequired(value); }