bufferoverflow / verdaccio-gitlab

private npm registry (Verdaccio) using gitlab-ce as authentication and authorization provider
MIT License
161 stars 56 forks source link

Security concerns #100

Closed Telokis closed 4 years ago

Telokis commented 5 years ago

I am currently trying to implement #99 and noticed that anybody can access any package as long as they are authenticated through Gitlab. (https://github.com/bufferoverflow/verdaccio-gitlab/blob/v2.2.0/src/gitlab.js#L158)

From what I understand, to check whether the user is allowed to access a package or not, we only check if its user is set.

There is no verification made to ensure the user is accessing a scope he owns or that he has the proper access rights.

I am currently working on #99 so I could tackle this issue as well, I think. We just have to properly discuss the approach to solve it.

Here is what I planned to do to solve #99:

Doing this was easy but I didn't expect to be able to see/access my published package. That's how I found the security concern.

Proposed solution:

I think the behavior for allow_access should follow the same pattern as allow_publish: If the user doesn't have access to the group/project, it cannot access the packages within that scope.

Telokis commented 5 years ago

For the specific security concern I mentionned above, I choose this approach:

The new code can be found here.

Telokis commented 5 years ago

@bufferoverflow @dlouzan May I ask some feedback on this, please?

bufferoverflow commented 4 years ago

see https://github.com/bufferoverflow/verdaccio-gitlab/pull/101#issuecomment-597325043