The Unified and Autonomous Development Platform
refactor: Update security settings descriptions in JobExecutor and ServerDockerExecutor
Robin Shene6856d10ae23
diff --git a/server-core/src/main/java/io/onedev/server/model/support/administration/jobexecutor/JobExecutor.java b/server-core/src/main/java/io/onedev/server/model/support/administration/jobexecutor/JobExecutor.javaindex d27b7f055c..60803af32f 100644--- a/server-core/src/main/java/io/onedev/server/model/support/administration/jobexecutor/JobExecutor.java+++ b/server-core/src/main/java/io/onedev/server/model/support/administration/jobexecutor/JobExecutor.java@@ -53,8 +53,10 @@ public abstract class JobExecutor implements Serializable {this.name = name;}- @Editable(order=30, name="Enable Site Publish", group = "Security Settings", description="Enable this to allow to run site publish step. OneDev will serve project "- + "site files as is. To avoid XSS attack, make sure this executor can only be used by trusted jobs")+ @Editable(order=30, name="Enable Site Publish", group = "Security Settings", description="""+ Enable this to allow to run site publish step. OneDev will serve project+ site files as is. To avoid XSS attack, make sure executor with this+ option enabled can only be used by trusted jobs""")public boolean isSitePublishEnabled() {return sitePublishEnabled;}@@ -63,8 +65,9 @@ public abstract class JobExecutor implements Serializable {this.sitePublishEnabled = sitePublishEnabled;}- @Editable(order=40, name="Enable Html Report Publish", group = "Security Settings", description = "Enable this to allow to run html report publish step. To avoid XSS attack, " +- "make sure this executor can only be used by trusted jobs")+ @Editable(order=40, name="Enable Html Report Publish", group = "Security Settings", description = """+ Enable this to allow to run html report publish step. To avoid XSS attack,+ make sure executor with this option enabled can only be used by trusted jobs""")public boolean isHtmlReportPublishEnabled() {return htmlReportPublishEnabled;}diff --git a/server-plugin/server-plugin-executor-serverdocker/src/main/java/io/onedev/server/plugin/executor/serverdocker/ServerDockerExecutor.java b/server-plugin/server-plugin-executor-serverdocker/src/main/java/io/onedev/server/plugin/executor/serverdocker/ServerDockerExecutor.javaindex de0df57682..2fb88eae18 100644--- a/server-plugin/server-plugin-executor-serverdocker/src/main/java/io/onedev/server/plugin/executor/serverdocker/ServerDockerExecutor.java+++ b/server-plugin/server-plugin-executor-serverdocker/src/main/java/io/onedev/server/plugin/executor/serverdocker/ServerDockerExecutor.java@@ -202,11 +202,11 @@ public class ServerDockerExecutor extends JobExecutor implements DockerAware, Tethis.alwaysPullImage = alwaysPullImage;}- @Editable(order=520, group="Security Settings", description="Whether or not to mount docker sock into job container to "- + "support docker operations in job commands<br>"- + "<b class='text-danger'>WARNING</b>: Malicious jobs can take control of whole OneDev "- + "by operating the mounted docker sock. Make sure this executor can only be used by "- + "trusted jobs if this option is enabled")+ @Editable(order=520, group="Security Settings", description="""+ Whether or not to mount docker sock into job container to+ support docker operations in job commands. To avoid malicious jobs taking control of whole OneDev+ by operating the mounted docker sock, make sure executor with this option enabled can only be used+ by trusted jobs""")public boolean isMountDockerSock() {return mountDockerSock;}@@ -215,10 +215,11 @@ public class ServerDockerExecutor extends JobExecutor implements DockerAware, Tethis.mountDockerSock = mountDockerSock;}- @Editable(order=530, name="Enable Buildx Image Build", group="Security Settings", description="Enable this to allow to run the build image step which uses buildx. "- + "The build image step using kaniko can still be used even this option is disabled<br>"- + "<b class='text-danger'>WARNING</b>: Malicious jobs can read arbitrary host files by running this step. Make sure this executor can only be used by "- + "trusted jobs if this option is enabled")+ @Editable(order=530, name="Enable Buildx Image Build", group="Security Settings", description="""+ Enable this to allow to run the image build step using buildx.+ The image build step using kaniko can still be used even this option is disabled.+ To avoid malicious jobs reading arbitrary host files by running this step,+ make sure executor with this option enabled can only be used by trusted jobs""")public boolean isImageBuildEnabled() {return imageBuildEnabled;}@@ -227,20 +228,10 @@ public class ServerDockerExecutor extends JobExecutor implements DockerAware, Tethis.imageBuildEnabled = imageBuildEnabled;}- @Editable(order=540, name="Enable Builder Cache Prune", group="Security Settings", description="Enable this to allow to run prune builder cache step<br>"- + "<b class='text-danger'>WARNING</b>: Clearing shared builder cache can affect other jobs using same builder. Make sure this executor can only be used by "- + "trusted jobs if this option is enabled")- public boolean isBuilderCachePruneEnabled() {- return builderCachePruneEnabled;- }-- public void setBuilderCachePruneEnabled(boolean builderCachePruneEnabled) {- this.builderCachePruneEnabled = builderCachePruneEnabled;- }-- @Editable(order=550, name="Enable Buildx Image Tools", group="Security Settings", description="Enable this to allow to run the buildx image tools step<br>"- + "<b class='text-danger'>WARNING</b>: Malicious jobs can read or write arbitrary host files by running this step. Make sure this executor can only be used by "- + "trusted jobs if this option is enabled")+ @Editable(order=550, name="Enable Buildx Image Tools", group="Security Settings", description="""+ Enable this to allow to run the buildx image tools step.+ To avoid malicious jobs reading or writing arbitrary host files by running this step,+ make sure executor with this option enabled can only be used by trusted jobs""")public boolean isImagetoolsEnabled() {return imagetoolsEnabled;}@@ -249,6 +240,18 @@ public class ServerDockerExecutor extends JobExecutor implements DockerAware, Tethis.imagetoolsEnabled = imagetoolsEnabled;}+ @Editable(order=540, name="Enable Builder Cache Prune", group="Security Settings", description="""+ Enable this to allow to run prune builder cache step. To avoid shared builder cache being+ cleared by malicious jobs, make sure executor with this option enabled can only be used+ by trusted jobs""")+ public boolean isBuilderCachePruneEnabled() {+ return builderCachePruneEnabled;+ }++ public void setBuilderCachePruneEnabled(boolean builderCachePruneEnabled) {+ this.builderCachePruneEnabled = builderCachePruneEnabled;+ }+@Editable(order=40, group="Resource Settings", placeholder = "No limit", description = "" +"Optionally specify cpu limit of each job/service using this executor. This will be " +"used as option <a href='https://docs.docker.com/config/containers/resource_constraints/#cpu' target='_blank'>--cpus</a> " +diff --git a/server-product/system/incompatibilities/incompatibilities.md b/server-product/system/incompatibilities/incompatibilities.mdindex 70eee6ae88..fa7b43517c 100644--- a/server-product/system/incompatibilities/incompatibilities.md+++ b/server-product/system/incompatibilities/incompatibilities.md@@ -2,7 +2,7 @@### CI/CD-The `Build Image`, `Prune Builder Cache`, and `Run Buildx Image Tools` steps are now disabled by default because malicious jobs can access arbitrary host files by running these steps. After upgrading, jobs using these steps will fail unless the corresponding option (`Enable Buildx Image Build`, `Enable Builder Cache Prune`, or `Enable Buildx Image Tools`, respectively) is enabled under **Security Settings** of the relevant server or remote Docker executor. When enabling any of these options, make sure the executor can only be used by trusted projects. The build image step using kaniko remains available without enabling these options.+The `Build Image`, `Run Buildx Image Tools`, and `Prune Builder Cache` steps are now disabled by default because malicious jobs can access arbitrary host files by running these steps. After upgrading, jobs using these steps will fail unless the corresponding option (`Enable Buildx Image Build`, `Enable Builder Cache Prune`, or `Enable Buildx Image Tools`, respectively) is enabled under **Security Settings** of the relevant server or remote Docker executor. When enabling any of these options, make sure the executor can only be used by trusted projects. The build image step using kaniko remains available without enabling these options.# 16.8.0