如果带有 GitLab Runner shell 执行程序的 GitLab 是不安全的,GitLab SSH Runner 是否可以免受 MITM 的攻击以用作安全替代品,或者使用 Docker?

If GitLab with a GitLab Runner shell executor is insecure, can GitLab SSH Runner be secure from MITM to use as a safe alternative, or use Docker?

我想使用 GitLab 为 PHP 设置 CI 代码测试。它在文档中说,https://docs.gitlab.com/runner/, that the shell executor is not secure, https://docs.gitlab.com/runner/executors/shell.html, but also states that SSH is vulnerable to MITM attacks, https://docs.gitlab.com/runner/executors/ssh.html. What is recommended to use as a GitLab runner if these options are not secure options? I want to test PHP code w/ PHPUnit, https://phpunit.de/,上面两个选项似乎是最直接的。换句话说,Docker 是设置 GitLab CI Runner 的最常见或推荐的方法吗?

我在本地使用 Ubuntu 18.04,还在 PHP7.2 环境中使用 RHEL 进行 GitLab 测试代码。

TLDR。 是的,Docker是推荐选项

原因是shell和ssh有可能跳出Runner作用域。此外,此执行类型可能会留下文件,这些文件是在您的 CI 作业期间创建的。这本质上是使用容器解决的,因为这些容器在每次作业后都会被删除。 使用 Docker 执行器的另一个原因是不同的 feature sets,例如它允许您在执行命令的 gitlab-ci.yml 中定义图像。