Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Passbolt v5 API #23

Open
speatzle opened this issue Jan 10, 2025 · 9 comments
Open

Support Passbolt v5 API #23

speatzle opened this issue Jan 10, 2025 · 9 comments

Comments

@speatzle
Copy link
Collaborator

Full Support for Resource Types, Encrypted Metadata and the v5 API.

This will Most likely mean Breaking the go-passbolt API by just exposing a Maps in the Resource Struct to Support Resource Types and Encrypted Metadata Properly.

https://www.passbolt.com/blog/the-road-to-passbolt-v5-encrypted-metadata-and-other-core-security-changes-2

https://docs.google.com/document/d/1yuucNxUJYcYFqsLUORTRqd4HZs1vROmtQQ6stGbdwpU/edit?pli=1&tab=t.0

@Nelwhix
Copy link
Contributor

Nelwhix commented Jan 23, 2025

Hi @speatzle, I would love to work with you on this. When do we start?

@speatzle
Copy link
Collaborator Author

Hi, Sorry for the delay.

Thank you for your interest in helping out.

The big thing that v5 brings is encrypted metadata, but its probably also gonna expand on the Resource Types introduced in v3.

Back then i was already struggling to find time so instead of Properly implementing Resource Types i just made it work for the few types that exist with the existing go-passbolt Resource struct.

Since Encrypted metadata is going to change the Format of a Resource again i don't think we can just Expand the Struct anymore.

The current plan i have in mind up would be to have just the few unaffected fields Directly in the Resource Struct (id, folder_parent_id, ???) and have one map for the Metadata and one map for the Secret data which we both check against the Resource Type Json Schema from the Server.

We could then have Generic Resource Type variants which expose helper functions to get the Various values of the fields the Resource Type in Question has.

This would allow for Ergonomic programming with the usual Resource Types and still allow for all custom or new and currently unknown (to go-passbolt) Resource Types to be used.

Since all of this has just been in the Back of my head since the v5 announcement i would appreciate any suggestion / improvements on these ideas or alternative solutions.

@Nelwhix
Copy link
Contributor

Nelwhix commented Feb 18, 2025

I think your idea is sound. When you are ready to start just create issues and we will tackle them together

@Nelwhix
Copy link
Contributor

Nelwhix commented Mar 4, 2025

@speatzle Hi man, what v5 instance do we use to test. Community edition's last release is v4.11 https://github.com/passbolt/passbolt_api/releases/tag/v4.11.1

@speatzle
Copy link
Collaborator Author

speatzle commented Mar 4, 2025

@Nelwhix since v4.10 there should be a flag PASSBOLT_V5_ENABLED to enable the new API Version, you can test against that.

I managed to get some time approved at work to get this moving forward.
I also had a meeting with the Passbolt team Today since i had some Questions after reading the google doc.

After Talking with them, i have decided to delay the more Generic approach since Custom Resource Type are still a while of and the more Hard coded approach is currently preferred by them due to downgrade security concerns which will be solved in the future.

Ill make a v5 Branch for now, all PR's should go against that till v5 support is ready for main.

I plan to work on #26 tomorrow and maybe even #27 which are fundamental for most of the Work.

If you want to work on something in the next few days, you could take a look at #28

@Nelwhix
Copy link
Contributor

Nelwhix commented Mar 4, 2025

Okay thanks

@speatzle
Copy link
Collaborator Author

speatzle commented Mar 5, 2025

@Nelwhix @stripthis I have made the Integration tests run only if the Environment Variable REG_URL is set, This way you can test all other unit tests locally if you don't have a Passbolt instance running on your system.

Also Github Actions have been enabled for the v5 branch and pull's targeting v5.

Output should look like this:

go-passbolt/helper took 4s ➜  go test -v
REG_URL Env Variable Empty, Skipping integration tests
=== RUN   TestResourceCreate
--- SKIP: TestResourceCreate (0.00s)
=== RUN   TestGenerateOTPCode
=== RUN   TestGenerateOTPCode/generates_otpcode_from_token_with_padding
=== RUN   TestGenerateOTPCode/generates_otpcode_from_token_without_padding
=== RUN   TestGenerateOTPCode/invalid_token_format
--- PASS: TestGenerateOTPCode (0.00s)
    --- PASS: TestGenerateOTPCode/generates_otpcode_from_token_with_padding (0.00s)
    --- PASS: TestGenerateOTPCode/generates_otpcode_from_token_without_padding (0.00s)
    --- PASS: TestGenerateOTPCode/invalid_token_format (0.00s)
PASS
ok  	github.com/passbolt/go-passbolt/helper	0.004s

@Nelwhix
Copy link
Contributor

Nelwhix commented Mar 5, 2025

Well done

@Nelwhix
Copy link
Contributor

Nelwhix commented Mar 5, 2025

Done with #28, can I pick any or are we doing them in order?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants