Jump to content
Fabian Näf

Bug when try to create private Passwordlist by API

Recommended Posts

Hi Support-Team 

 

I think, I just found a little bug, which occures while creating (or try to) a private Passwordlist by API.

I used the following code (PowerShell) to create a Passwordlist.




        $Body = @{



            PasswordList = $Name



            Description = $Description



	        ApplyPermissionsForUserID = $UserToPermit



            CopySettingsFromTemplateID = $PasswordstateTemplateID



            LinkToTemplate = "False"



            Permission = "A"



	        PrivatePasswordList = "True"



	        NestUnderFolderID = $ParentFolderID



	        APIKey = $PasswordStateSystemWideAPIKey



        }



        $jsonBody = $Body | ConvertTo-Json







        $PasswordstateURL = "$($PasswordstateURL)/api/passwordlists"



        If ($PasswordstateWhatIf -eq $False) {



            $result = Invoke-Restmethod -Method POST -Uri $PasswordstateURL -ContentType "application/json; charset=utf-8" -Body $jsonBody



            $output = $result.PasswordListID 



        } Else {



            Write-Host $("Would Create Passwordstate-Passwordlist """ + $Name + """") -ForegroundColor Yellow



            $output = 0



        }   

I think, the important part is, that I copied settings from a Template and I also set PrivatePasswordList to true, which I shouldn't do probably :-)

This script works and creates a new PasswordList. But when I add the first Password, I get an ACL-Error (attached).

 

When I set PrivatePasswordList to false, everything works without any problem.

 

Best regards,

 

Fabian

2017-05-19 16_32_20-Passwordstate.png

Share this post


Link to post
Share on other sites

Hi Fabian.

 

Thanks and we'll need to check this out, and provide a fix in the next release. Copying settings from a template should not cause this, as it's related to the permissions table. With the folder you are nesting it under, is this folder propagating permissions down at all?

Regards

Click Studios

Share this post


Link to post
Share on other sites

Hi

 

No this folder is not using propagating permissions model. It's just a new created folder with default-settings.

I forgot to mention: After I created the PasswordList (with PrivatePasswordList = "true"), it's shown as Shared-Folder.

 

Best regards,

 

Fabian

Share this post


Link to post
Share on other sites

Hi Fabian,

 

Thanks for the information, and I think the issue is caused by you copying settings from a Template - Templates are only designed for Shared Password Lists, which I believe is why it is being set to Shared once created. If you leave the line out from copying settings from the template, do you have any issues then?

Regards

Click Studios

Share this post


Link to post
Share on other sites

Hi

 

If I don't copy settings from a template, I don't have this issue.

 

 

For my script, which I'm writing currently, I have to copy settings from the template, because I need a URL-field, which is not available by default.

 

Best regards,

 

Fabian

Share this post


Link to post
Share on other sites

Hi Fabian,

Thanks for confirming, and we're going to need to fix this in the next release - and allow you to copy from a template if specified. For now, you will need to ask your users to manually select the URL field after the Private List has been created, and we should have a new build about before the start of next week.

Regards

Click Studios

Share this post


Link to post
Share on other sites

Hi Fabian,
 
Just a quick update to mention we released Passwordstate version 7883 today, which includes a fix for this bug.
 
Thanks for reporting it and we'll also give you an email just in case you don't see this forum post:)
 
Regards,
Click Studios

Share this post


Link to post
Share on other sites

Hi

 

Thank's a lot for fixing this, you're incredibly fast! 

I've just tested it and it worked great!!

 

But unfortunately I just runned into the next problem: I used this feature for my KeePass/Passwordsafe-Import-Script (which I posted in the General FAQs in this forum). Now I'm able to create private Passwordlists by API, but I'm not able to add Passwords to this just created private Passwordlist. I think, that I  don't have access to add records to a private Passwordlist with the System-Wide API-Key. When I try to do this, I get the following error:

 

[{"errors":[{"message":"Not Found"},{"phrase":"PasswordListID '272' Not Found in the Database."}]}]

 

I've just looked into Passwordstate and I really have a PasswordList with the ID 272, but now (since, I updated and set PrivatePasswordList = "True") it's private :huh:

I know, that I could create an API-Key for each PasswordList and it would probably work with this API-Key... but this is not a suitable option for an automatic Import from KeePass/Passwordsafe.

 

Do you have an idea, what else I could do?

 

I've heard, that in Version 8, there will be an Windows-User Authentication for the API, could this be an option?

 

Best regards,

 

Fabian

 

Share this post


Link to post
Share on other sites

Hi Fabian,

 

I'm not sure what the issue is here, but it could be caused by you using a System Wide API Key with Private Lists - this is not allowed for obvious reasons, so you would need to instead create an API Key for the Private List first and use this.

 

Version 8 should help with this, as all permissions to things in the API are based on the authenticated account.


Regards

Click Studios

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×