conjur list --search returns the wrong result

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Welcome Idira to LIVEcommunity!

Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.

Meet Idira

conjur list --search returns the wrong result

L1 Bithead

I have a safe in Cyberark vault named MYAPP_DEV. After it was synced to Conjur, a policy named Vault/myLob/MYAPP_DEV is created. I did

 

conjur list -k policy -s MYAPP_DEV

 

It showed the expected policy. However, I tried

 

conjur list -s DEV_MYAPP

 

It also returned the same policy, which is not what I expected. I supposed it should return empty list because we have no policy as "DEV_MYAPP".

 

We also found if we have two variables: my-secret and your-secret, whatever we --search my-secret or your-secret, Conjur returns both my-secret and your-secret.

 

It looks like the Conjur search goes to "full text" word search, which could cause unexpected results if we use this API.

 

GET /resources/conjur-dev?kind=policy&search=MYAPP_DEV HTTP/1.1

 

Conjur Enterprise Version is V13.3.2

 

Is there any config can change the "search" to ID search, or other API can use for string match?

 

Thanks!

9 REPLIES 9

L4 Transporter

Hi @river wang​ 

 

it seems the cause of this issue could be due to the special character '_' or '-' inside the Safe name or variables, that's why the 'list' returns all the data/resources fetching at least part of the name (before or after '_', '-')

 

Can you elaborate on the purpose of GETting the policy name and then using it somewhere? So then we can review internally this request more deeper 

 

Also, please specify the CLI version on your end

L1 Bithead

Thanks for the quick responses.

 

We use the "search" function because we're writing a script to automate the onboarding process, utilizing the Conjur List API.

 

Conjur API List Resources

https://docs.cyberark.com/conjur-enterprise/latest/en/content/developer/conjur_api_list_resources.ht...

 

The script retrieves policy names and then loads the policies.

 

My Conjur CLI version is 8.0.1-2a14e75.

 

We discovered this issue with the CLI months ago and checked with Conjur OSS that time since it's open source. We found that the Conjur list-search seemed built on Postgres textsearch index, which filters out all "stop words" (e.g., "I," "the," "a"), and is single-plural insensitive. Our workaround was to avoid using those stop words when naming Conjur resources. It didn't bother us too much when using the CLI, as we knew what we're looking for.

 

However, now that we want to use the search function in a script to find resource IDs, it's not easy to have a workaround. we already have many dash (-) and underscore (_) in resource names.

 

Thanks!

 

L4 Transporter

Appreciate your clarification @river wang​ 

I'll have a look deeper into this internally and will update you once I have any news

L1 Bithead

Thanks @Oleksandr Voloschuk​  Our current solution is to have our own "client side search" and do the string comparison.

L0 Member

Hi,

As you've figured out, the list command uses a simple full-text search. You're welcome to submit an enhancement request for this feature though.

L1 Bithead

I'm also having issues with the search, I expect it to work like grep but intead it returns results that don't contain the searched term in neither the id nor the annotations but substring of it.

hi @Arnau Valls Cunillera​ 

 

The list endpoint is using a simple full-text search operation. 

 

As mentioned above, please submit an enhancement request for a more comprehensive and granular search

our workaround is to search the "substrings", then do a "client-side" search again. We checked the Conjur opensource. What's behind Conjur search might be PostgreSQL text search, which cannot be used for ID search. sales-secret is a string in most programming languages, but it will be taken as two words/substrings, "sales" and "secret" in this full-text search. while my-secret will be taken as one word/substring, because Postgresql remove "my" out as a "stop word". Therefore, a naming convention for conjur resources can help too.

It would have been nice for you (Cyberark) to open it since many people had que same issue, but here it goes:

ER - Improve conjur list search

  • 276 Views
  • 9 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!