n4bb12/verdaccio-github-oauth-ui

Team group doesn't work with team with whitespace in its name

Closed this issue · 1 comments

ranqn commented

Bug Report

Versions

Version
Verdaccio 5.10
This plugin 3.2.7
Node.js 14.18.2

Environment

Name Version
Package manager npm 8.3.0
Browser Microsoft Edge 102.0.1245.33 (64-bit)
Operating system Windows 11 22000.708

Observed behavior

Can't assign package access to a GitHub team with whitespace in its name.

Expected behavior

Package access config should work with team with whitespace in its name.

Steps to reproduce

  1. Create a GitHub team with whitespaces in its name, Package Publisher in organization MyOrg for example.
  2. With a working verdaccio instance, add package access config to this team, like:
    publish: 'github/owner/MyOrg/team/Package Publisher', then restart verdaccio server.
  3. Login with a user in this team, in server log, notice group of the team does not appear in real_groups
  4. Try npm publishing a package as a member of Package Publisher.
  5. npm fail with 403 Forbidden
  6. Change team name to PackagePublisher on GitHub.
  7. Change group name in config file to publish: 'github/owner/MyOrg/team/PackagePublisher' and restart server.
  8. Login again, group of the team shows up in server log.
  9. Do npm publish again.
  10. npm publish succeed.

Thanks for reporting.

It appears values with spaces aren't read from the verdaccio config correctly, even when quoted with single or double quotes. This seems to be a bug in Verdaccio or one of the libraries it uses.

We can still support team names with spaces by using the team slug instead of the raw team name. They should be the same in most cases, except the slug uses dashes instead of spaces. The switch to using the team slug is implemented in https://github.com/n4bb12/verdaccio-github-oauth-ui/releases/tag/3.2.8

In your case, this means you need to use: github/owner/MyOrg/team/Package-Publisher