为包签名
Studio 中提供包签名功能,旨在确保 Studio 中发布的流程和库均能享有安全性与完整性。
NuGet 提供两种包签名方式,即按照作者或按照存储库。
强制使用签名包
要强制使用签名包,必须将 Nuget.config
文件中的 signatureValidationMode
参数设置为 require
。该文件位于 %ProgramFiles%\UiPath\Studio
。您可以通过以下两种方式之一进行操作:
-
在安装过程中,通过在 命令行 中使用选项
ENFORCE_SIGNED_EXECUTION=1
进行安装。例如,下列命令将安装 Studio、机器人(作为 Windows 服务),并强制在 UiPath 环境中使用经签名的包:
UiPathStudio.msi ADDLOCAL=DesktopFeature,Studio,Robot,RegisterService ENFORCE_SIGNED_EXECUTION=1
。 -
安装完成后,通过手动编辑
Nuget.config
文件。如果在安装后设置参数,则更改将在您执行以下操作后生效:
- 重新启动机器人服务。
- 从
%ProgramFiles%\UiPath\Studio\Packages
和%userprofile%\.nuget\packages
删除所有现有的 .NuGet 包。 - 重新启动 Studio/Assistant。
默认情况下,UiPath 包使用存储库和作者签名。这表示您可以使用“管理包”下载并安装此类包,而无需执行任何其他操作。如需了解如何添加其他受信任的作者、存储库和/或所有者,请参阅此页面的以下部分。
添加可信来源
若要下载、安装并运行使用特定证书签名的包,请将此证书添加为可信来源。为此,可修改安装文件夹中的 nuget.config
文件,主要是 <trustedSigners>
部分。
添加可信作者
若要添加可信作者,您需要打开位于 %ProgramFiles%\UiPath\Studio\NuGet.config
的 NuGet.config
文件。然后,提供 certificatefingerprint
和 hashAlgorithm
。查阅此页面,以了解关于证书指纹的更多信息。
将 allowUntrustedRoot
设为 true
或 false
:
allowUntrustedRoot = "true"
- 应允许受信任的签名者链接到不受信任的根。allowUntrustedRoot = "false"
- 不应允许受信任的签名者链接到不受信任的根。
其条目应类似于下例所示:
<trustedSigners>
<author name="UiPath">
<certificate fingerprint="1234512345123451234512345123123123123123123123123123112312312E5" hashAlgorithm="SHA256" allowUntrustedRoot="true"/>
</author>
</trustedSigners>
<trustedSigners>
<author name="UiPath">
<certificate fingerprint="1234512345123451234512345123123123123123123123123123112312312E5" hashAlgorithm="SHA256" allowUntrustedRoot="true"/>
</author>
</trustedSigners>
有关将 UiPath 添加为受信任签名者的更多信息,请参阅机器人指南中的 包签名验证 。
添加可信存储库
添加可信存储库的方式基本与添加作者相同,区别是必须同时添加 serviceIndex
。
下例中将一个可信存储库添加到 NuGet.config
文件:
<trustedSigners>
<repository name="UiPath Repository" serviceIndex="https://uipath.repository">
<certificate fingerprint="1234512345123451234512345123123123123123123123123123112312312E5" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
</repository>
</trustedSigners>
<trustedSigners>
<repository name="UiPath Repository" serviceIndex="https://uipath.repository">
<certificate fingerprint="1234512345123451234512345123123123123123123123123123112312312E5" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
</repository>
</trustedSigners>
添加可信所有者
一个存储库可能包含多个作者签名的包。这时可以使用 <owners>
标签,以仅允许安装由可信作者签名的包。
在 <owners>
标签之间添加可信作者,如下例中所示:
<trustedSigners>
<repository name="UiPath Repository" serviceIndex="https://uipath.repository">
<certificate fingerprint="1234512345123451234512345123123123123123123123123123112312312E5" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
<owners>Author1;Author2</owners>
</repository>
</trustedSigners>
<trustedSigners>
<repository name="UiPath Repository" serviceIndex="https://uipath.repository">
<certificate fingerprint="1234512345123451234512345123123123123123123123123123112312312E5" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
<owners>Author1;Author2</owners>
</repository>
</trustedSigners>