Conversation
Xuanwo
left a comment
There was a problem hiding this comment.
Thank you, @bxb100, for creating this; it's really great!
One suggestion I have is to add a CI check to verify that dist/core_bg.wasm and dist/index.js haven't been changed. I understand they are generated by js tools, and I trust all of you (@bxb100 and 1Password team members). However, it always makes me a bit concerned that someone might change the dist files by mistake. By adding CI checks, we ensure that the dist files are exactly what we expect to see and haven't been altered.
|
NOTE to other reviewers: This PR is large due to the generated |
|
@Xuanwo Thank you for the review. I have learned a lot from your comments about the CI check. I have added a new workflow, |
Thank you, mostly LGTM now! |
|
Inviting @edif2008 and @SimonBarendse for a review. |
|
Hi folks, really appreciate your efforts on this! ❤️ 🙌 Definitely aligned with the direction we'd like to move in for this and other integrations. We've build SDKs exactly because we saw such large desire from all of you to build integrations, and friction from doing so with CLI (e.g. performance, support for self-hosted runners, Windows support and it removes complexity from the implementation, making it easier to maintain and less error-prone). Excited to see you already help us move in that direction! 🚀 A couple things we'll want to look at to get this merged and deployed:
|
|
Thank you @SimonBarendse for the bravo comments! @bxb100 led the entire effort, so I will leave the final decision to him on how to implement changes. I'm here to explain why we need For every The entry point is defined here: load-secrets-action/action.yml Lines 14 to 16 in 0a30992 Additional documentation can be found here: https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-javascript-action |
|
I am not sure if there are some dependencies in 1Password SDK that require |
I'm guessing 1Password has written their logic in Rust, with the JS SDK being just a wrapper. |
Yes, this is exactly it. We're using WASM to share a single implementation (in Rust) between all languages we support SDKs in. Right now that's Go, Python and JS, and we've built it with the intention to grow to more languages (in a scalable & sustainable way). |
|
Thanks for the explanation on why |
|
update 11/23: force update with minimal changes. the original version lives in branch #82-bak Thank you @Xuanwo, @SimonBarendse, and @yafanasiev for your reviews and discussions. I would like to provide some explanations and background information regarding the submitted content in this PR:
Footnotes |
Hi @SimonBarendse, I suggest we avoid taking this direction since switching from CLI-based to JS-based does introduce a breaking change. I can foresee multiple ways this action could fail. It's common and expected for GitHub Actions users to upgrade actions between major versions (every Node version bump will trigger one). Adopting I am willing to create a migration guide for users to follow if there are any break happened.
Hi @bxb100, I understand the concern from @SimonBarendse's side. To make the PR review smoother, do you think it would be a good idea to simply remove all files except for |
Thank you @bxb100! 🙌 This is very helpful. Followed up in separate issues
Rewrite specific changes - Discussing in this PRBackwards Compatibility
@Xuanwo could you help me see these too? I'm currently under the impression that the new version of this action built on SDK will be fully compatible with the current version built on CLI, after addition of Auth Prompts. As @bxb100 mentioned as well:
Could you please help me see and understand what I'm missing? What are the failures you foresee? DistYes, I'm less concerned about this now and okay with proceeding with checking in the WASM binary into the code here after @Xuanwo's explanation why this is necessary. Apologies that I not explicitly mentioned that before. I assume and hope when using the action that GitHub only fetches the referenced commit and not the full Git history, similar to the checkout action, by using So the larger repo size from historic binaries checked in would only affect new contributors checking out the full repo, including all historic WASM binaries. But it won't affect using the action. With that in mind, I believe we can pull back in the changes to Code ReviewI've requested a review from @Marton6 and @edif2008 for the specific code changes made in this PR. |
|
Thank you, @SimonBarendse, for the detailed explanation.
I believe we can proceed after #83 #84 .
base on https://github.com/actions/runner/blob/078eb3b381939ee6665f545234e1dca5ed07da84/src/Runner.Worker/ActionManager.cs#L784C1-L792C1 I think it direct download like |
There was a problem hiding this comment.
Hey @bxb100!
First of all, thank you for doing all of this rewrite. I really appreciate it and it looks great so far.
A couple of pieces that I wanted to raise here:
-
Backwards compatibility
I've re-read the code for the current version of this GitHub Action and the desktop app integration has never been an authentication method supported by this action. It will error if neither of the connect nor service account environment variables are configured. This should, therefore, smoothen this migration to a pure JS action and significantly decrease the risk of this not being backwards compatible. -
Windows support
Since with this change we can (finally) add support for Windows runners, would you mind adding this OS in thetest.ymlfile in theosmatrix? It should look like this:strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] auth: [connect, service-account] exclude: - os: macos-latest auth: connect - os: windows-latest auth: connect
-
Code review
The overall approach of the changes in this PR look really good. A couple of them are nitpicks and improvements in naming and such, but a couple of key areas to look at are:- erroring when duplicate fields are found.
- identifying environment variables that have secret references and validating them.
- simplifying the code for validating the authentication and building the client that will resolve the secret references.
Co-authored-by: Eduard Filip <eddy.filip@agilebits.com>
- throw error when multiple fields found
- move `ref_regex` test to `util.test.ts`
Co-authored-by: Eduard Filip <eddy.filip@agilebits.com>
|
@edif2008 done, PTAL |
|
/ok-to-test sha=6cdba15 |
|
Hey @bxb100! Could it be that you forgot to update the |
|
@edif2008 sry for this, already done, PTAL |
|
/ok-to-test sha=b6ea213 |
|
Hey @bxb100! Based on the latest tests run I've identified the following regressions:
There's no action for you at the moment unfortunately. I'm currently re-reviewing the PR itself from a code perspective to ensure all the pieces are in a good shape and then will let you know on the next steps. Once that's done, I think we're good to go with this rewrite. |
There was a problem hiding this comment.
Code review: ✅
Things look great now and I feel more confident on this version of the rewrite. This PR is good to go acknowledging the following regressions:
- Both clients
- Successfully resolving a secret reference when the item has duplicate sections, but the field is unique in the entire item.
- SDK Client only
- Successfully resolving a secret reference when there's a duplicate item that is archived.
- Query parameters - only
attribute=otp/totpandssh-formatare supported at the moment in the SDKs. File supportSSH key item support
The last 2 regression points can be addressed by upgrading the SDK from 0.1.7 to 0.2.0. The second regression point (related to attribute in the reference) will support SSH key format now, but nothing else. I will leave it up to you whether you want to upgrade to 0.2.0 as part of this PR or not.
Other notes
When checking this branch, npm was telling me the following:
2 vulnerabilities (1 moderate, 1 high)
To address all issues, run:
npm audit fix
Therefore, it might be worth running npm audit fix on your branch, update the dist directory and push those changes.
|
@edif2008 Thanks for your reviewing, all done, PTAL |
|
/ok-to-test sha=417a5bb |
edif2008
left a comment
There was a problem hiding this comment.
Things look great in this MR now. Thank you so much for the patience and the great effort in making this rewrite! 💪🏻
|
Hey @bxb100! I have two things to raise with you:
|
|
As a 1Password user, I’m thrilled to see your team introducing so many new features. However, I’ve noticed that the update cycles for onepassword-sdk-js and connect-sdk are not aligned. This inconsistency, combined with my limited understanding of certain features in these SDKs, has made rewriting actions more challenging. Additionally, the recent supply chain attack involving Given these concerns, I’d like to propose reconsidering a CLI-based approach instead. For example, something like KamaranL/1password-load-secrets-action might be a viable alternative. @edif2008 @Xuanwo @SimonBarendse @yafanasiev I sincerely apologize for the time and effort spent reviewing this code, and I appreciate your understanding. Thank you! |
|
Thank you so much @bxb100 for working on this. I respect his decision to stop working on this, but I still believe implementing actions in pure JS with a well-maintained codebase is a good direction and benefits the overall community. cc @edif2008, This PR is almost ready, and we now have a solid starting point. I suggest merging it into Some concerns raised by @bxb100 are valid. I believe the 1Password team should conduct a thorough audit of all actions and SDK dependencies to prevent such issues from occurring. |
|
This PR also teaches us about the collaboration methods between open-source contributors and maintainers. Both of our teams put their best efforts and kindness into this PR. We even got it approved and nearly ready to be merged, but it ended up being closed. I can relate to @bxb100's feelings of complete burnout after working on this three-month-long PR, continuously receiving new review comments, and even being asked to implement entirely new features that never existed before. Don't get me wrong—I really appreciate @SimonBarendse's and especially @edif2008's work on this PR as well. However, if we get another opportunity, maybe we could take a different approach—one that's more incremental and positive. |
My understanding of this attack is that a PAT from a bot account was leaked, then used to commit malicious code to the repo. I don't see how the language used for the action has any relation to this. Once a PAT is leaked that can push code, that's a problem regardless of the language used for the action. Could you help me understand how using JavaScript would be different? I believe preventing these attacks comes down to protecting all credentials that allow pushing code. We currently have these protections in place for this:
If you have any additional recommendations, feel free to share them.
Thank you @Xuanwo ! Fully agreed that we're learning a lot from this PR and improving the collaboration and experience for contributors. We're keen to enable the open source community, and appreciate all you've both done to enhance the experience, including providing this and prior feedback! I just gave this MR a quick scan, and see 5 improvements to the contributor experience made b/o learnings from this PR:
I really appreciate you helping us uncover these, and believe this will create a better experience for next contributors! 💙
First off: I'm sorry you haven't had a good experience working on this PR. Definitely not our intention that this is burning you out. And I agree that there's been more effort than we had originally anticipated. There's been the hurdles you've ran into as first external contributor to this repo that I mentioned above, and additionally, I believe we had overestimated how far along the new version 0 1Password SDKs already were in achieving parity with 1Password CLI.
I fully agree. This is also still in full alignment with the direction we're heading across all integrations (see earlier comment). Migrating integrations from CLI to SDKs is still something we want to pursue as a team. |
as mentioned in #80, this is a PR for rewriting to js
PS. I can't pass the default lint config, so I choose to use the GitHub action template eslint.yml
I tested Service Accounts and 1Password Connect locally using
npm run local-action. If any reviewer is interested, you can test it locally by copying.env.exampleto.env.