Studio 中提供包签名功能,旨在确保 Studio 中发布的流程和库均能享有安全性与完整性。
NuGet 提供两种包签名方式,即按照作者或按照存储库。
强制使用签名包
要强制使用签名包,必须将 Nuget.config
文件中的 signatureValidationMode
参数设置为 require
。该文件位于 %ProgramFiles%\UiPath\Studio
。您可以通过以下两种方式之一进行操作:
- During installation, by installing from the command line with the option
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 将选择响应最快的订阅源。如果其中一个订阅源不包含已签名的包和依赖项,则 Robot 可能会收到未签名的包或依赖项,从而导致自动化失败。为避免这种情况,请确保所有已配置的订阅源都对包和依赖项进行签名。
添加可信来源
若要下载、安装并运行使用特定证书签名的包,请将此证书添加为可信来源。为此,可修改安装文件夹中的 nuget.config
文件,主要是 <trustedSigners>
部分。
添加可信作者
To add a trusted author, you need to open the NuGet.config
file located at %ProgramFiles%\UiPath\Studio\NuGet.config
. Then, provide the certificatefingerprint
and hashAlgorithm
. Check this page to get more information about the certificate fingerprint.
将 allowUntrustedRoot
设为 true
或 false
:
allowUntrustedRoot = "true"
- 应允许受信任的签名者链接到不受信任的根。allowUntrustedRoot = "false"
- 不应允许受信任的签名者链接到不受信任的根。
其条目应类似于下例所示:
<trustedSigners>
<author name="UiPath">
<certificate fingerprint="1234512345123451234512345123123123123123123123123123112312312E5" hashAlgorithm="SHA256" allowUntrustedRoot="true"/>
</author>
</trustedSigners>
For more information on adding UiPath as a trusted signer, see Package Signature Verification in the Robot guide.
添加可信存储库
添加可信存储库的方式基本与添加作者相同,区别是必须同时添加 serviceIndex
。
下例中将一个可信存储库添加到 NuGet.config
文件:
<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>

为包签名
- 在 Studio 中,可以从“发布”窗口的“证书签名”选项卡中为流程和库的程序包签名。

-
在“证书签名”选项卡中,添加本地计算机上的证书路径。如有需要,可使用
按钮导航到相应路径。
-
接着,根据需要输入“证书密码”并添加可选的证书“时间戳记程序”。单击“发布”。若有指定,生成的
.nupkg
文件将使用证书和时间戳记程序签名。
Timestamps are a secure way of keeping track of the date and time when a package was signed. To learn more about timestamping in the context of NuGet package signing, check out this link.
如果证书时间戳记程序无效,则单击“发布”按钮后 Studio 中将抛出含有项目名称的错误消息。“输出”面板中也将记录类似的错误消息。
备注:
如未强制执行签名验证,则无论程序包的签名状态如何,机器人都可正常执行使用 Studio v2019.4 先前版本创建的流程。
Use the Mass Update Command Line tool to sign multiple packages and then publish them to a location.
备注:
使用“修复依赖项”功能时,项目中包含的未签名依赖项可能会妨碍系统解决其他依赖项。从项目中删除未签名的包以解决已签名的依赖性。
约一个月前更新