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

Add support for publishing private packages #4247

Merged
merged 7 commits into from
Nov 8, 2023
Merged

Conversation

Michael-F-Bryan
Copy link
Contributor

This updates the wasmer publish command to allow users to publish private packages. When a package is private, you will only be able to access it if you have contributor access (e.g. because you are the owner, have been added as a contributor, or are part of a namespace that owns the package).

@Michael-F-Bryan Michael-F-Bryan requested review from theduke and ayys and removed request for syrusakbary October 10, 2023 07:38
Copy link
Contributor

@theduke theduke left a comment

Choose a reason for hiding this comment

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

One concern I have here is that we are duplicating the responsibility for marking a package as private.

Is it the private setting in wasmer.toml?
Is it the CLI flag and the GraphQL argument?

What happens when the GraphQL specifies private, but not the package manifest?
Will the backend alter the manifest before persisting it?

What happens on a re-publish when you forget the private flag?
Does the API return an error then because the package is private?
Does it just accept it?

This all sounds quite confusing from a user stand point.

It would be cleaner, I think, if the manifest was the source of truth.
An additional --private flag or the CLI arg could make sure the package is set to private in the manifest and error out. Similar for the GraphQL API.

Thoughts, @Michael-F-Bryan , @ayys ?

@ayys
Copy link
Member

ayys commented Oct 10, 2023

I agree that wasmer.toml should be the source of truth,

What happens when the GraphQL specifies private, but not the package manifest?

the graphql private field and CLI argument --private should still exist, but they will be validated against wasmer.toml. If the config file does not have private = true set, then the backend should throw an error.

What happens on a re-publish when you forget the private flag?

For visibility, right now piblic packages cannot be made private, but private packages can be made public. So if you remove the private = true field from the config, the package should become public (the CLI should confirm this change with the user?)

An additional --private flag or the CLI arg could make sure the package is set to private in the manifest and error out. Similar for the GraphQL API.

I agree that the private field for the CLI and for GraphQL should be there to make sure wasmer.toml has private = true set and then use that..

@Michael-F-Bryan
Copy link
Contributor Author

@theduke this is my understanding. @ayys feel free to correct me if I'm wrong.

Is it the private setting in wasmer.toml?

Yep. We added a private flag to the [package] table in wasmerio/wasmer-toml#31 (released as wasmer-toml v0.9.1) and the webc crate also added support for it in https://github.com/wasmerio/pirita/pull/186 (released as webc v5.6.0).

It would be cleaner, I think, if the manifest was the source of truth.

100% agreed. It's traceable and immediately obvious to anyone consuming the packages.

What happens when the GraphQL specifies private, but not the package manifest?

If there is disagreement between the manifest and the GraphQL mutation, the backend should return an error and publishing will fail.

Will the backend alter the manifest before persisting it?

To the best of my knowledge, no. Altering the manifest that someone has published is something we should try to avoid as much as possible.

When I publish something, I want to be confident that my users get exactly what I published.

What happens on a re-publish when you forget the private flag?
Does the API return an error then because the package is private?
Does it just accept it?

@ayys probably knows better than me, but I think this would silently make the package public.

An additional --private flag or the CLI arg could make sure the package is set to private in the manifest and error out. Similar for the GraphQL API.

I'd like to avoid a --private flag if we can. It feels like we could confuse users by having a --private flag which doesn't actually mark the package as private, but instead acts as a sort of validation. It also leads to ambiguities over whether the wasmer.toml or --private is the way you should mark a package as private, a lot of people won't read docs and will instead check wasmer publish --help, so they'll probably see the --private flag first.

@Michael-F-Bryan Michael-F-Bryan merged commit 28ed6ac into master Nov 8, 2023
53 checks passed
@Michael-F-Bryan Michael-F-Bryan deleted the private-packages branch November 8, 2023 09:17
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

Successfully merging this pull request may close these issues.

3 participants