-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improves namespace validation for Docker Notary integration #1019
Conversation
@rikatz thanks for the PR, this code change can be used to workaround the notary issue you are seeing but I don't think it universally correct as it disregard the hostname. |
@reasonerjt I've opened an issue on Docker Notary Server (notaryproject/notary#1023) to clarify this. I think this might be some kind of inconsistence, but anyway the usage of hostname on the scope is specified here: https://docs.docker.com/registry/spec/auth/scope/ I can't figure why this happens, and if Harbor should handle this on a more gentle way (like parsing its own 'hostname' configuration used on harbor bootstrap - harbor.cfg). Anyway, let's wait for the answer on the related issue. Thanks. |
@reasonerjt So guys from notary said that this behaviour (sending the whole context) is right, as notary can sign anything (including tagged repositories), and this is a part of the image. So I think it would be better to read the entire 'GUN' sended by notary, and check if the first field matches the configured hostname of Harbor, and if (and only if) this matches, it removes the first field and proceeds to the validation of the repo permission. I'm busy now, but will try to fix this with the described approach, and update the PR. Do you think this is a fine approach? Thanks! |
@rikatz Thanks for the update! This PR looks good to me. Could you
|
@reasonerjt The issue is #1012 I'm going to change the PR here to DEV branch. |
@rikatz, VMware has approved your signed contributor license agreement. |
Thanks! |
This commit solves the issue related on #1012
Basically, instead of verifying if there is a '/' character on the a.Name variable, it's applied a split function on this string with the '/' character, then verifying the size of array.
Being bigger than 1, it verifies if the array is bigger than 3 (like privaterepo.com/rpkatz/debian) and getting only the 2nd item from array (rpkatz), otherwise (as being smaller than 3, and bigger than 1, like rpkatz/debian) it gets the first item of the array.