Bug 1373448 - [atomic registry]Should not show 'docker tag' and 'docker push' message on ImageStream page when user without push role
Summary: [atomic registry]Should not show 'docker tag' and 'docker push' message on Im...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Registry Console
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: ---
Assignee: Martin Pitt
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On: 1418979
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-06 10:03 UTC by zhou ying
Modified: 2019-11-21 12:56 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-21 12:56:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
cockpit test case for this bug (2.80 KB, patch)
2017-02-01 12:18 UTC, Martin Pitt
no flags Details | Diff

Description zhou ying 2016-09-06 10:03:21 UTC
Description of problem:
Project admin add second user with only 'pull' role, when the second user login, should not show 'docker tag' and 'docker push' message on imagestream page.

Version-Release number of selected component (if applicable):
openshift3/registry-console:3.3

How reproducible:
Always

Steps to Reproduce:
1. Login to registry console with user1;
3. Create a new project "test" which allow only specific user or groups to pull images and create some imagestreams;
4. Go to Projects page and select "test" from list;
5. Click "Add Member";
6. Assign Pull role to user "userpull";
7. Login to registry console with "userpull";
8. Go to Images page and select one Image Stream

Actual results:
8.  Show  'docker tag' and 'docker push' message on Image Stream page;

Expected results:
8. Should not show the 'docker tag' and 'docker push' message when user with only 'pull' role.

Additional info:

Comment 2 Martin Pitt 2017-01-20 11:08:50 UTC
Confirming. Just to make sure that I understand this right, this does not only affect the image stream page (e. g. http://localhost:9090/kubernetes/registry#/images/default/busybox) but also the "Image Registry → Overview" page (http://localhost:9090/kubernetes/registry), it has a very similar info at the bottom.


Note to self: The former page is generated by <https://github.com/openshift/registry-image-widgets>, not by cockpit.git)

Comment 3 Martin Pitt 2017-02-01 12:18:45 UTC
Created attachment 1246626 [details]
cockpit test case for this bug

I'm afraid this is tricky to fix. When being logged in as a user which is not admin, but only has registry-view or -editor (i. e. "Pull" vs. "Push" role), then you can't get any kind of information about your own role even. In this example (cockpit openshift test image), "amanda" is a push user:

[root@f1 ~]# oc whoami
amanda
[root@f1 ~]# oc get images
User "amanda" cannot list all images in the cluster
[root@f1 ~]# oc describe roleBindings -n marmalade
User "amanda" cannot list rolebindings in project "marmalade"
[root@f1 ~]# oc describe policyBindings :default -n marmalade
Error from server: User "amanda" cannot get policybindings in project "marmalade"

This also reflects in the fact that https://SERVER:9090/kubernetes/registry#/projects does not show any users/projects, not even the ones from the user.

I attach the cockpit test case which reproduces this, to avoid losing it.

Comment 4 Martin Pitt 2017-02-03 10:42:09 UTC
I filed bug 1418979 about the underlying permissions issue in OpenShift. Could someone with the right privileges make this bug block on 1418979, please?

Comment 5 Yadan Pei 2017-02-04 01:04:51 UTC
Not sure If added correctly

Comment 6 Yadan Pei 2017-02-04 02:44:29 UTC
Hi Martin,

Seems we should add 1373448 to 'Blocks' fields in bug 1418979

What I did was wrong I think

Comment 7 Martin Pitt 2017-02-04 22:13:43 UTC
yapei: Exactly the other way around: This block depends on 1418979, or that bug blocks this one (it doesn't matter on which you set it, I think, the other bug will then get the opposite relation).

Comment 8 Martin Pitt 2017-02-08 09:10:22 UTC
Dan gave me the right hint: "oc policy can-i update imagestreamimages" does the trick.

Comment 9 Martin Pitt 2017-02-28 11:04:23 UTC
Fix in progress at https://github.com/cockpit-project/cockpit/pull/5985

Comment 10 Martin Pitt 2017-03-22 22:48:04 UTC
First part of the fix now landed: https://github.com/cockpit-project/cockpit/commit/d3d9802aeb4 . This covers the necessary API and the Registry Overview page. I'll work on the corresponding fix on the image stream page soon.

Comment 11 Martin Pitt 2017-04-18 07:48:37 UTC
Second half of the fix: https://github.com/cockpit-project/cockpit/pull/6351

Comment 14 Martin Pitt 2018-09-04 19:57:55 UTC
This was fixed in cockpit-kubernetes 139. I really hope that current OCP releases have a newer version than that?

Comment 15 Yanping Zhang 2018-09-05 02:04:01 UTC
# oc rsh registry-console-1-htbfm rpm -qa|grep cockpit
cockpit-bridge-155-1.el7.x86_64
cockpit-kubernetes-155-1.el7.x86_64
cockpit-ws-155-1.el7.x86_64
cockpit-dashboard-172-2.el7.x86_64
cockpit-system-155-1.el7.noarch
Checked on ocp env with above cockpit packages. It's "Log Out" button on page now. The bug has been fixed.

Comment 16 Yanping Zhang 2018-09-05 02:06:43 UTC
Sorry, the verification is for other bug, pasted in wrong place. pls ignore Comment 15.

Comment 17 Yanping Zhang 2018-09-05 02:49:38 UTC
# oc rsh registry-console-1-htbfm rpm -qa|grep cockpit
cockpit-bridge-155-1.el7.x86_64
cockpit-kubernetes-155-1.el7.x86_64
cockpit-ws-155-1.el7.x86_64
cockpit-dashboard-172-2.el7.x86_64
cockpit-system-155-1.el7.noarch
Checked on ocp env with above cockpit packages. There are still 'docker tag' and 'docker push' message on imagestream page when user only have pull role.
The bug is not fixed on the cockpit version.

Comment 19 Stephen Cuppett 2019-11-21 12:56:39 UTC
OCP 3.6-3.10 is no longer on full support [1]. Marking un-triaged bugs CLOSED DEFERRED. If you have a customer case with a support exception or have reproduced on 3.11+, please reopen and include those details. When reopening, please set the Version to the appropriate version where reproduced.

[1]: https://access.redhat.com/support/policy/updates/openshift


Note You need to log in before you can comment on or make changes to this bug.