Skip to content
This repository was archived by the owner on Jun 26, 2026. It is now read-only.

Add BeyondTrust plugin - #10

Open
AndreiCristeaUiPath wants to merge 15 commits into
UiPath:masterfrom
AndreiCristeaUiPath:BeyondTrust
Open

Add BeyondTrust plugin#10
AndreiCristeaUiPath wants to merge 15 commits into
UiPath:masterfrom
AndreiCristeaUiPath:BeyondTrust

Conversation

@AndreiCristeaUiPath

Copy link
Copy Markdown

No description provided.

@cosminvlad cosminvlad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also remove the .DS_Store files.

Comment thread Orchestrator-CredentialStorePlugins-Samples.sln Outdated
@cosminvlad cosminvlad changed the title Migrate from local to Forked Repo Add BeyondTrust plugin Apr 27, 2021
Comment thread src/SecureStore.BeyondTrust/BeyondTrustDynamicSystemSecureStore.cs
Comment thread src/SecureStore.BeyondTrust/SecureStore.BeyondTrust.csproj
{
public class BeyondTrustVaultClientFactory
{
private static BeyondTrustVaultClient client;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't cache a single static client for the lifetime of the app. That means you can only configure a single credential store of this type per application (not per tenant), which is not a restriction we currently have. Also, caching a static instance means changing the configuration will have no effect until you restart the app.
See the Hashicorp implementation, which does caching of client per context: https://github.com/UiPath/Orchestrator-CredentialStorePlugins/blob/master/src/SecureStore.HashicorpVault/HashicorpVaultClientFactory.cs#L25

Comment thread .gitignore

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
src/SecureStore.BeyondTrust/.DS_Store

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would ignore files with this name from all folders

Suggested change
src/SecureStore.BeyondTrust/.DS_Store
.DS_Store

var config = JsonConvert.DeserializeObject<Dictionary<string, object>>(context);
var client = BeyondTrustVaultClientFactory.GetClient(context);
var semaphore = SemaphoreFactory.SemaphoreSlim;
await semaphore.WaitAsync();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use a timeout, so as not to wait forever in case there is a block somewhere.

Suggested change
await semaphore.WaitAsync();
await semaphore.WaitAsync(TimeSpan.FromSeconds(60));

Comment on lines +12 to +16
if (client == null)
{
var config = JsonConvert.DeserializeObject<Dictionary<string, object>>(context);
client = new BeyondTrustVaultClient(config);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not guarantee a single client is ever created. If two calls to BeyondTrustSingleSystemSecureStore.ValidateContextAsync are made at the same time, you can reach the null check on two threads at the same time and they both proceed to create a client and then return it.


namespace UiPath.Orchestrator.Extensions.SecureStores.BeyondTrust
{
public class SemaphoreFactory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This is not a factory. Call it SemaphoreHolder

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants