Friday, 2021-02-12

openstackgerritLance Bragstad proposed openstack/glance master: Cleanup remaining tenant terminology in glance API docs  https://review.opendev.org/c/openstack/glance/+/77529900:07
*** zzzeek has quit IRC00:08
*** zzzeek has joined #openstack-glance00:10
*** rcernin has quit IRC02:19
*** rcernin has joined #openstack-glance02:33
*** rcernin has quit IRC02:42
*** rcernin has joined #openstack-glance02:42
*** udesale has joined #openstack-glance03:25
*** zzzeek has quit IRC03:57
*** zzzeek has joined #openstack-glance03:58
*** k_mouza has joined #openstack-glance04:06
*** k_mouza has quit IRC04:11
*** gyee has quit IRC04:30
*** zzzeek has quit IRC04:43
openstackgerritAbhishek Kekane proposed openstack/glance_store stable/victoria: Adjust requirements and lower-constraints  https://review.opendev.org/c/openstack/glance_store/+/77519004:44
*** zzzeek has joined #openstack-glance04:45
*** k_mouza has joined #openstack-glance04:54
openstackgerritMerged openstack/glance master: Uncap PrettyTable  https://review.opendev.org/c/openstack/glance/+/77514104:56
*** k_mouza has quit IRC04:58
*** udesale_ has joined #openstack-glance05:09
*** udesale__ has joined #openstack-glance05:10
*** udesale has quit IRC05:11
*** udesale_ has quit IRC05:14
*** zzzeek has quit IRC05:15
*** zzzeek has joined #openstack-glance05:16
*** zzzeek has quit IRC06:03
*** zzzeek has joined #openstack-glance06:04
*** k_mouza has joined #openstack-glance06:07
*** k_mouza has quit IRC06:11
*** zzzeek has quit IRC06:13
*** zzzeek has joined #openstack-glance06:14
*** nikparasyr has joined #openstack-glance06:21
*** rchurch has quit IRC06:24
*** zzzeek has quit IRC06:24
*** zzzeek has joined #openstack-glance06:30
*** zzzeek has quit IRC06:37
*** zzzeek has joined #openstack-glance06:37
openstackgerritMerged openstack/glance master: Remove unused option "owner_is_tenant"  https://review.opendev.org/c/openstack/glance/+/76392006:43
*** zzzeek has quit IRC07:01
*** zzzeek has joined #openstack-glance07:02
*** rcernin has quit IRC07:37
*** zzzeek has quit IRC07:44
*** zzzeek has joined #openstack-glance07:46
*** ralonsoh has joined #openstack-glance07:50
*** zzzeek has quit IRC08:05
*** zzzeek has joined #openstack-glance08:07
*** rcernin has joined #openstack-glance08:18
*** zzzeek has quit IRC08:43
*** zzzeek has joined #openstack-glance08:46
*** zzzeek has quit IRC08:55
*** zzzeek has joined #openstack-glance08:56
*** zzzeek has quit IRC09:05
*** zzzeek has joined #openstack-glance09:07
*** zzzeek has quit IRC09:19
*** zzzeek has joined #openstack-glance09:21
*** rcernin has quit IRC09:55
*** k_mouza has joined #openstack-glance10:02
*** rcernin has joined #openstack-glance10:09
*** rajivmucheli has joined #openstack-glance10:11
*** rcernin has quit IRC10:23
*** k_mouza has quit IRC10:56
*** k_mouza has joined #openstack-glance10:56
*** k_mouza has quit IRC11:02
*** zzzeek has quit IRC11:42
*** zzzeek has joined #openstack-glance11:45
*** rcernin has joined #openstack-glance11:48
*** k_mouza has joined #openstack-glance11:53
*** udesale_ has joined #openstack-glance12:02
*** udesale__ has quit IRC12:04
*** rcernin has quit IRC12:08
*** rcernin has joined #openstack-glance12:22
*** udesale__ has joined #openstack-glance12:44
*** udesale_ has quit IRC12:46
*** rcernin has quit IRC12:53
*** k_mouza has quit IRC13:04
*** k_mouza has joined #openstack-glance13:21
*** rcernin has joined #openstack-glance13:27
openstackgerritAbhishek Kekane proposed openstack/glance master: Expand tasks database table to add more columns  https://review.opendev.org/c/openstack/glance/+/76373913:43
openstackgerritAbhishek Kekane proposed openstack/glance master: Utilize newly added tasks database fields  https://review.opendev.org/c/openstack/glance/+/77461513:43
openstackgerritAbhishek Kekane proposed openstack/glance master: WIP: New API /v2/images/{id}/tasks to show tasks associated with image  https://review.opendev.org/c/openstack/glance/+/77483013:43
*** zzzeek has quit IRC13:48
*** zzzeek has joined #openstack-glance13:49
*** zzzeek has quit IRC13:59
*** zzzeek has joined #openstack-glance14:04
*** sangeet has quit IRC14:04
*** sangeet has joined #openstack-glance14:10
sangeetI have glance (Train) deployed as wsgi with Nginx. I am not able to upload images bigger than 5GB via cli (--file option). I get "Command error: HTTP 504 Gateway Time-out: nginx". But in glance log I see traceback with error " ERROR glance.common.wsgi Got error from Swift: put_object('glance', 'e7b58c3e-3894-46bb-b8a8-a3798ca6446c-00023', ...) failure and no ability to reset contents for reupload." Please help14:10
*** rajivmucheli has quit IRC14:17
*** rcernin has quit IRC14:30
dansmithgmann: what's the preferred way to signal that a user doesn't have access to a subresource? Meaning:15:28
dansmithGET /v2/images/$image_id/tasks15:28
dansmithif the user doesn't have access to $image_id, shouldn't we return 404 for this ^ ?15:28
gmanndansmith: yes, 404 is recommended as 403 can tell them it exist and they do not have access but 404 hide that info15:29
dansmithyeah, okay thanks15:30
openstackgerritMerged openstack/glance-specs master: New Image API /v2/images/{id}/tasks for task information  https://review.opendev.org/c/openstack/glance-specs/+/76374015:31
*** lbragstad_ has joined #openstack-glance15:46
*** lbragstad has quit IRC15:50
*** nikparasyr has left #openstack-glance15:53
openstackgerritMerged openstack/glance master: trivial: Fix a typo in devstack plugin.sh  https://review.opendev.org/c/openstack/glance/+/77527616:04
openstackgerritLance Bragstad proposed openstack/glance-tempest-plugin master: Implement API protection testing for images  https://review.opendev.org/c/openstack/glance-tempest-plugin/+/77356816:17
lbragstad_dansmith gmann fwiw - i think we took a different approach in keystone16:25
*** lbragstad_ is now known as lbragstad16:25
*** k_mouza has quit IRC16:26
lbragstadi think we check explicitly if a user has access to something, if they don't we return a 403, regardless of the resource existing16:26
lbragstadwe return a 404 if the user is authorized to access something, but it doesn't exist16:26
lbragstadhttps://review.opendev.org/c/openstack/keystone-tempest-plugin/+/686305/48/keystone_tempest_plugin/tests/rbac/v3/test_domain.py#187 is an example of the former16:27
lbragstadhttps://review.opendev.org/c/openstack/keystone-tempest-plugin/+/686305/48/keystone_tempest_plugin/tests/rbac/v3/test_domain.py#125 is an example of the later16:27
dansmithso they get a 403 if they ask for something that doesn't exist, or something they don't have access to right?16:27
lbragstadlatter*16:27
dansmithhow do you know if something doesn't exist that they _do_ have access to? :)16:27
dansmithor rather, how can someone have access to something that doesn't exist16:29
lbragstadbacking up a bit16:32
lbragstadhttps://github.com/openstack/keystone/blob/master/keystone/api/domains.py#L37 is where we populate the target data16:32
lbragstadand if the domain doesn't exist the target is empty - which fails with the domain check in the policy https://github.com/openstack/keystone/blob/master/keystone/common/policies/domain.py#L4416:32
dansmiththat means if the domain doesn't exist you can't prove they have access, so 403 right?16:33
lbragstadyes16:34
lbragstadwe have some of this captured in an old bug report because we were bleeding existence checks depending on if a 404 or a 403 was returned16:35
lbragstadand it allowed someone to fish for resources they didn't have access to16:35
dansmithlbragstad:  for context, the code I was reviewing was returning an empty list of sub resources in both cases of "the base resource does not exist" and "the base resource is not allowed to the current user"16:35
lbragstadbut - the way you phrase "how can someone have access to something that doesn't exist" is a good point16:36
dansmithso 403 or 404 would be better, but it seems like 404 is the preferred thing elsewhere.. I didn't know keystone did that differently though16:36
dansmithlbragstad: right, I get the 403-if-not-exists, but I don't see how you can return 404 if they have access to the base resource, but it doesn't exist16:36
lbragstadi'm having a hard time understanding the last part of ^16:38
lbragstadshouldn't we return a 404 when someone is authorized to do something, but the resource doesn't exist?16:39
dansmithwell, you said "we return a 404 if the user is authorized to access something, but it doesn't exist"16:39
lbragstadoh16:39
lbragstadok - so here16:40
lbragstadhttps://review.opendev.org/c/openstack/keystone-tempest-plugin/+/686305/48/keystone_tempest_plugin/tests/rbac/v3/test_domain.py#10316:40
lbragstadtechnical system-administrators represent god-mode=True, right?16:40
lbragstadin that case we return a 404 because we know they're technically authorized to view any domain in the deployment, but the one they are looking for doesn't exist16:41
dansmithwell, I dunno how you factor that in.. super admins are a bit of a different thing16:41
dansmithsure, that's fine16:41
dansmithlbragstad: here's the code I was reviewing, for context: https://review.opendev.org/c/openstack/glance/+/774830/2/glance/api/v2/images.py16:43
dansmiththis is /v2/images/$image_id/tasks16:43
dansmithI don't think they have anything that will have short-circuited if $image_id doesn't exist, and if they did, he wouldn't have written that code I think16:44
lbragstadok - so iiuc that would be calling https://github.com/openstack/glance/blob/master/glance/api/policy.py#L12016:47
lbragstadfrom a policy perspective16:47
dansmithI don't even know that means.. checking to see if image get is possible ever for that user?16:48
dansmithbut I guess that's the answer to "is authorized to see something that doesn't exist"  :)16:50
dansmithlike x perms on the directory or something16:50
lbragstadif i'm reading this right, which might not be the case, the policy will enforce an empty target if the database returns a NotFound16:52
dansmithright, but what is the point of that?16:52
dansmithjust so you can override the result of a nonexistent image with 403 instead of 404?16:52
dansmithbecause that seems like a bad thing if one cloud gives you a 404 for missing images and another 40316:53
lbragstadbecause their policies are different you mean16:53
lbragstador their policies could potentially be different because of override behavior16:54
dansmithright, one cloud decides that show on a nonexistent image should be 403 for everyone, where another cloud decides it should be 40416:55
lbragstadi see what you mean16:56
dansmithyou write your client to poll for deletion until you get 404, and that breaks when you move to another cloud where that never happens16:57
dansmithor you report "you don't have access to this thing, but it definitely exists, because I didn't get a 404" to the user16:57
gmannyeah that is ^^ main issue and info leak.16:58
dansmithgmann: but because of that override, it might *not* exist16:58
dansmithcan be different on two different glances16:58
dansmithbecause that policy override, AFAICT16:58
dansmiththe converse is the info leak, where we return 403 for a thing that *does* exist, which tells the user it's there16:59
gmannso if image exist then check the policy right16:59
dansmithgmann: but also if the image doesn't exist, check the policy, which could return 403 instead of 40416:59
lbragstadthe second case you just mentioned dansmith is what we try and prevent in keystone16:59
lbragstad(specifically, we don't want to leak information)17:00
dansmithlbragstad: well, it's what returning 404 for unauthorized does,17:00
dansmithbut if you return 403 for "does not exist" and "unauthorized" that's the same difference, it's just upside down, IMHO17:00
*** udesale__ has quit IRC17:01
lbragstadi found a separate example in keystone that doesn't use the domain API17:02
lbragstadhttps://github.com/openstack/keystone/blob/master/keystone/tests/protection/v3/test_projects.py#L696-L71017:02
dansmithI think that's in line with your always-403 strategy17:03
lbragstadthat test is written running as a domain administrator17:03
dansmithI think it's okay to pick "default to 404" or "default to 403"  -- both avoid the leak, but IMHO 404 is more correct17:04
lbragstadok17:04
dansmithbut you probably also have more complex permission structures and relations than we do17:04
gmannwell 404 can be non-exist or url does not exist. but 403 is clear that you do not have access to things which might or might not exist17:04
gmannyeah i feel 403 in all cases is more info leak then 40417:04
dansmithagreed, but if you're consistent about always 403 then it's probably not exposing anything too badly17:05
dansmithbut from a client design perspective,17:05
dansmithI think 403 means "you need to do something to gain access" which is confusing if the thing really doesn't exist17:05
dansmithwhereas 404 promises less to the user17:05
dansmith"this thing doesn't exist, but it might just not exist FOR YOU"17:05
lbragstadyeah...17:06
lbragstadgdi17:06
gmanntrue17:06
dansmithbut what seems to be the case here for glance is... "ask your cloud administrator how they have configured their policy to know what this really means"17:06
dansmithI think that's a 6xx error code: "601: Call your operator"17:07
lbragstadi've seen that statement sprinkled through the docs17:07
dansmithor maybe 602: Software engineer failed you here17:07
lbragstadok - so for glance, can we pursue the 404-always strategy?17:09
dansmithI would think we should be headed in that direction, yeah17:09
dansmithbut glance does also have some finer-grained permissions which may now depend on people being able to see something after it's shared or something, I dunno17:10
dansmithI bet rosmaita knows :)17:10
dansmithbut definitely for anything new, the goal should be default to 404, IMHO17:10
lbragstadthinking back on the keystone example again17:12
lbragstadwe didn't want to expose information outside of the domain (for domain users) because we didn't want to violate tenancy at that level17:12
lbragstadand that drove us to the 403-always strategy17:13
dansmithit really comes down to what you do for nonexistent things.. if you report 403 for nonexistent things you should have access to, then you can't deduce whether something exists or not from the 40317:13
dansmithif you do return 404 in those cases, but 403 for unauthorized, then I think you're exposing existence17:14
dansmiththat's why I said consistency and what you promise to the user matters17:14
lbragstadbut - i suppose we could have implemented the 404-always strategy if we 1.) check if the resource existed - if not 404 (this is normal) 2.) check if the resource exists, it does, return 404 if policy enforcement returns a 40317:14
dansmithI think that exposes more than you want,17:15
dansmithunless you know that this user is granted enough permission to know if something exists within their domain or whatever17:15
dansmiththat doesn't really exist for nova at least, and I kinda doubt for glance too17:15
dansmithbut that's why I said keystone may have situations where you're an admin for your group, so it's okay to know if something exists that you can't access *within* that group17:15
lbragstadyeah - so #1 would pull the resource, check if the user has access, if they don't policy would return a 403, if they don't it would return a 404(?)17:15
dansmithbut you don't want to expose that info across pepsi/coke17:16
dansmithI think it's 200 if authorized and exists, else 40417:16
lbragstadyea17:16
dansmithlike email, the internet was a much nicer place when they came up with 401, 403, etc17:17
dansmithand like I said,17:17
dansmithif you're in the same tenant, but your *user* doesn't have access, 403 is probably fine17:17
dansmithyou're telling the pepsi marketing team that they can't access pepsi HR files17:18
dansmithbut you don't want to tell coke anything about that17:18
lbragstadin which case coke should see 404s, is what you're saying17:21
dansmithright total lack of acknowledging anything "huh? images? what are images? I dispense kitkat bars here"17:22
* lbragstad nods17:22
lbragstadmakes sense17:22
dansmiththe easier thing though, is to just play dumb with everyone,17:22
dansmithand not introduce the middle layer of 403-if-you're-friendly17:22
lbragstadwe should have taken that approach in keystone17:24
openstackgerritRajat Dhasmana proposed openstack/glance_store master: Validate volume type during volume create  https://review.opendev.org/c/openstack/glance_store/+/77470317:28
gmannnice example17:28
openstackgerritRajat Dhasmana proposed openstack/glance_store master: Validate volume type during volume create  https://review.opendev.org/c/openstack/glance_store/+/77470317:33
lbragstaddansmith gmann ok - i tried to distill things in a bug report https://bugs.launchpad.net/keystone/+bug/1915540 so we at least document it17:36
openstackLaunchpad bug 1915540 in OpenStack Identity (keystone) "HTTP 403s are more confusing than HTTP 404s when evaluating authorization of a non-existent resource" [Undecided,New]17:36
gmannlbragstad: +1, thanks. may be we can document it in api-wg repo guidelines17:37
dansmithyeah17:37
*** k_mouza has joined #openstack-glance17:38
dansmithI guess I thought we had the default-to-404 approach codified as the goal already, openstack-wide17:38
dansmithI was asking gmann instead of looking, because I rudely depend on him instead of doing my own research :)17:38
gmannwe might have there. i just remember as I had same question/discussion form neutron (amotoki) when I was in Tokyo :)17:39
*** gmann is now known as gmann_afk17:40
*** k_mouza has quit IRC17:41
lbragstadare these still the guidelines? https://specs.openstack.org/openstack/api-wg/guidelines/http/response-codes.html17:45
lbragstador have they moved somewhere else?17:45
dansmithseems legit, but yeah, surprised to not see anything in there about this,17:49
dansmithespecially since I thought this had been discussed a lot17:50
lbragstadyeah - same here17:54
jokkedansmith: lbragstad: Could you point me to where this 403/404 confusion happens? It should always be 404 for the very reasons dansmith laid down and that has been the approach we've been living on. So if we're returning 403 for non-existing resource, that's a bug breaking our API and we should fix it18:10
dansmithjokke: it's not that we _are_ returning 403, I think it's that an operator could configure it that way, because we run enforce on a NotFound18:11
dansmithlbragstad linked above, let me find it18:11
dansmithjokke: https://github.com/openstack/glance/blob/master/glance/api/policy.py#L12018:12
dansmithunless that's doing something other than what we expect,18:12
dansmithit seems like that offers the opportunity for a policy rule that would return something like 401 or 403 instead of 404 in the case where we fail to look up an instance18:12
dansmithjokke: and most of the discussion above was about keystone, FWIW because lbragstad is lonely and hanging out in the glance channel :)18:13
jokkeyeah, I got that much ... I was just wondering how is that a case, but I had no idea we would do that. So the enforce is actually raising Forbidden in that case?18:22
jokkeas from that code we are handling the NotFound exception, but the raise would push forward what ever exception the enforce() raised rather than the NotFound we caught, right?18:23
dansmithjokke: I think it would if the operator wrote a rule that denied access to a non-existent target object18:23
dansmithright18:23
dansmithI don't know why else that enforce would be there, other than to allow the operator to write such a rule, which I expect is just legacy from someone wanting to be able to override that behavior18:24
jokkeMe neither, and I'm not sure why do we allow that in the first place18:25
dansmithbecause some cloud vendor wanted it at some point I'm sure :)18:25
jokkebut, I can't recall at least writing nor reviewing that code so I have no idea of the intentions of it18:25
dansmithbut yeah, I dunno how you feel about just removing it, vs deprecating it18:25
dansmithwe could try..except around it and then just warn that this isn't supported anymore, or you could just remove it and reno it18:26
jokkedansmith: that's probably it "No but our security guy, yeah that on left with folio hat, told us that this is the right way we need to do it" :P18:26
dansmithjokke: right, obviously 403 is more "secure" than 404 :P18:26
dansmithI can remove it and see if any tests fail18:27
jokkesounds like a good start.18:27
jokkeMaybe we should shoot mail to the list and check if we'd be breaking anyone removing it. If no-one yells hard, get rid of it18:28
dansmithglance.tests.unit.v2.test_images_resource.TestImagesControllerPolicies.test_show_unauthorized18:28
dansmithhttps://github.com/openstack/glance/blob/2c893fbd80d0241fad2515221b61266ced12f92d/glance/tests/unit/v2/test_images_resource.py#L3480-L348518:29
jokkeuuh so we even test that it does the stuupid thing so we've definitely been deliberate about it18:29
dansmithyeah18:29
jokkegr818:29
dansmithbeen there a looooong time: https://review.opendev.org/c/openstack/glance/+/1141218:30
jokkethought so18:31
jokkealmost from the nova times18:31
dansmithI'll remove the test too and push it up for comment I guess18:31
jokkeThat almost looks like test that was written because it was the behaviour out of the test case rather than intentionally make sure we do forbidden on notFound18:36
dansmithyeah could be, it doesn't have a comment that says "this is definitely how it should be"18:37
jokkeAs it's not mentioned anywhere that it's the desired behaviour, it's all about "This is mess, all over the place and not consistent"18:37
dansmithyeah, a common mistake when adding tests after code.. testing the code and not the desired behavior18:37
jokkehappens _a_lot_ over here18:38
jokkePeople adding "test coverage" not reading docs or checking what the intended behaviour is, just testing that " True == True"18:38
dansmiththis one too: https://github.com/openstack/glance/blob/2c893fbd80d0241fad2515221b61266ced12f92d/glance/tests/functional/v2/test_images.py#L1943-L194318:38
dansmithatually,18:39
dansmithlooking at that test,18:39
dansmithI think we probably are *always* returning 403,18:39
dansmithfor any get_image rule that looks at the image properties, we'd always fail that enforce since we don't pass an object18:40
dansmiththat test doesn't intend to test this behavior, but fails because it can't check {}['owner']18:40
dansmithlbragstad: right?18:40
jokkehttps://docs.openstack.org/api-ref/image/v2/index.html?expanded=list-image-members-detail#list-image-members we should be returning 40418:47
jokkeVery clear in the API docs if tenant that is not a member tries to list the members, they will get 40418:47
dansmiththat's good18:48
dansmithif we're always returning 403 right now, then less good in that it's quite likely that people will notice18:49
jokkeyeah, well it looks like we're returning forbidden at least for the image that exists, not sure if the image does not exists18:50
dansmithoh duh, right I see18:51
dansmithwe're probably getting notfound from the db layer because of permissions,18:51
dansmithbut that's getting converted to 403 in the middle so that the http user never sees it18:51
jokkeSo it might be that the idea has been right, to homogenize those two, _but_ the implementation has been left half way and instead of returning Fobidden to the client, we'd supposed to translate that to NotFound in the API layer18:52
*** gmann_afk is now known as gmann18:52
dansmithI think it's the other way,18:52
dansmithwe're raising notfound from the lower layer,18:52
jokkeohh18:52
jokkecrap18:52
dansmithbut we're translating that to 403 when we shouldn't18:52
jokkethat's stupid18:53
jokkeLike I'd be ok with that if it was the actual documented API behaviour, like fine. But the fact that we're translating the response to something which really doesn't make sense, test it and then document it in the opposite way ... ffs18:54
dansmithsounds like keystone has intentionally gone that direction, which if you're consistent, isn't terrible, but I think it's less desirable from the client perspective because you end up doing things like "delete and poll until 403" instead of 40418:58
jokkeOhh we're even better18:58
jokkeIIRC we just happily tell you the delete request was successful, even if you do delete on resource that was already deleted18:59
openstackgerritDan Smith proposed openstack/glance master: RFC: Stop raising 403 when image is not found  https://review.opendev.org/c/openstack/glance/+/77543518:59
dansmithjokke: ^ for comments and discussion18:59
dansmithbug probably needs more words and link to the api docs18:59
dansmithsurely we have a test somewhere that makes sure we get a 404 for a non-existent image though19:09
dansmithso there must be something else going on here19:09
dansmithmaybe only if we fetch the image as part of a call other than a direct show or something19:10
jokkeI'm wondering that too19:11
jokkehave no idea tbh19:11
dansmithI get a 404 from devstack with a nonexistent image id, so... it's clearly not *always* a 40319:11
*** k_mouza has joined #openstack-glance19:13
jokke;)19:13
jokkeThis is getting better19:13
jokkeYeah, I'm pretty sure you should most of the times get 40419:13
jokkeJust worried that it's clearly not always19:14
dansmithyeah, so I can make my policy such that I get a 403 for a non-existent image:19:14
dansmithdan@guaranine:~$ cat /etc/glance/policy.json19:15
dansmith{"get_image": "false"}19:15
dansmithdan@guaranine:~$ glance image-show 39398e72-ff56-40ca-878f-43c58c43763419:15
dansmithHTTP 403 Forbidden: You are not authorized to complete get_image action.19:15
dansmiththat image-id should be not found19:15
jokkeyup19:15
*** k_mouza has quit IRC19:17
openstackgerritDan Smith proposed openstack/glance master: Stop raising 403 when image is not found  https://review.opendev.org/c/openstack/glance/+/77543519:27
dansmithadded back the test, but changed and commented to validate the *desired* behavior19:27
* lbragstad reads up19:36
lbragstadabout the lower layer thing...19:36
lbragstadglance's db layer definitely has some code that tacks SQL queries together depending on the project in the request - which results in a 404 when you're looking for an image outside your project19:37
lbragstadand that behavior is a little different for people with the admin role19:38
lbragstadbecause of the _is_visible logic - which special cases the admin role in the database layer before returning the image19:38
lbragstadhttps://github.com/openstack/glance/blob/2c893fbd80d0241fad2515221b61266ced12f92d/glance/db/sqlalchemy/api.py#L28619:41
lbragstadhttps://github.com/openstack/glance/blob/2c893fbd80d0241fad2515221b61266ced12f92d/glance/db/utils.py#L4419:41
jokkeyeah, the voodoo going on around the db is bit out of my comfort zone19:41
lbragstadyou and me both :)19:42
lbragstadideally - it would be nice to write a check string that makes these obsolete https://github.com/openstack/glance/blob/2c893fbd80d0241fad2515221b61266ced12f92d/glance/db/utils.py#L45-L7419:50
lbragstadand then just rely on https://github.com/openstack/glance/blob/2c893fbd80d0241fad2515221b61266ced12f92d/glance/api/policy.py#L123-L124 after removing https://github.com/openstack/glance/blob/2c893fbd80d0241fad2515221b61266ced12f92d/glance/api/policy.py#L120 (hypothetically)19:51
lbragstadand i think there is a discrepancy with existing images19:55
lbragstadhttps://review.opendev.org/c/openstack/glance-tempest-plugin/+/773568/15/glance_tempest_plugin/tests/rbac/v2/test_images.py#562 (project-member case)19:55
lbragstadhttps://review.opendev.org/c/openstack/glance-tempest-plugin/+/773568/15/glance_tempest_plugin/tests/rbac/v2/test_images.py#993 (project-admin case)19:56
lbragstadin both of those cases - we should be returning a 404, right?20:08
*** rcernin has joined #openstack-glance20:35
*** ralonsoh has quit IRC20:37
*** k_mouza has joined #openstack-glance20:40
*** k_mouza has quit IRC20:41
*** k_mouza has joined #openstack-glance20:43
sangeetI have glance (Train) deployed as wsgi with Nginx. I am not able to upload images bigger than 5GB via cli (--file option). I get "Command error: HTTP 504 Gateway Time-out: nginx". But in glance log I see traceback with error " ERROR glance.common.wsgi Got error from Swift: put_object('glance', 'e7b58c3e-3894-46bb-b8a8-a3798ca6446c-00023', ...) failure and no ability to reset contents for reupload." Please help20:45
*** k_mouza has quit IRC20:48
*** rcernin has quit IRC21:22
lbragstaddansmith jokke ok - i'm working on converting this conversation into glance_tempest_plugin tests - to be clear, regardless if an image exists in a project, a user from another project should always see a 404 when they attempt to fetch that image, right?21:28
dansmithlbragstad: I would think so yeah.. only hedging because I'm not super familiar with the sharing model in glance21:29
dansmithmeaning, if you're not granted permission to see an image, you should get 404, yes21:29
dansmithhowever in some permission models, you can deny someone access they would have otherwise inherited from group membership21:30
dansmithin which case you might want them to see a 403 in that case since you're explicitly denying them21:30
dansmithI doubt there's  anything like that in glance, but I'm hedging because I don't know21:30
lbragstadyeah - that makes sense21:30
lbragstadso - anything raising a Forbidden from glance's database layer is going to result in a 404 ultimately from the API21:31
lbragstad(assuming we fix the bug you opened)21:31
dansmithwell, the bug was actually the opposite, that anything resulting in a NotFound could result in a 40321:32
dansmithanything that is Forbidden from the lower layers would be a different path21:32
lbragstadyeah - different path, same outcome21:33
lbragstadif a project-admin tries to get an image in a project that isn't their own, they get a 40321:33
dansmiththey do? or you're asking if they should?21:34
lbragstadthey do21:34
lbragstadproject members get a 404 in the same situation21:34
dansmithokay that seems wrong too, because that's like exposing pepsi secrets to the sysadmin for coke right?21:34
lbragstadyes21:34
lbragstadhttps://review.opendev.org/c/openstack/glance-tempest-plugin/+/773568/15/glance_tempest_plugin/tests/rbac/v2/test_images.py#99321:35
dansmithjust because they are a coke sysadmin doesn't mean they should know any more about pepsi than coke regulars21:35
lbragstadright - i agree21:35
dansmithyeah, seems broken21:35
lbragstadbut i think it's because of a mismatch in the assumptions of what an admin is between the database and new policy defaults we're working on21:36
dansmithwell, this is why I was saying earlier that it's easier if you don't try to expose a little more rich information to admins just because they're admins, because you can get unintentional leaks like this21:36
dansmitheasier to just say "either 200 or 404"21:36
lbragstadyeah - that makes sense, but i'm struggling to find a case where we would use a 403 now with image_get21:37
dansmithcan't really think of one21:38
lbragstadok - so... good21:38
dansmithif glance has a "transfer ownership" option, then maybe after you've given the image away, 403 for you until they accept or something21:38
dansmithbut yeah, otherwise I think not21:38
lbragstadok - and that might just be a side-effect of get_image, too?21:38
lbragstadbecause that might be different is someone is a project-reader and they're trying to create private images21:39
lbragstadin that case, 403 makes sense i think21:39
dansmithyeah, I dunno, and like I say I don't know if glance has that21:39
dansmithso I'm really speaking from my posterior21:39
dansmithprobably best to get an answer from the elders21:39
lbragstadagreed - i'll go with that for now, translate it to tests, and then post a patch21:40
dansmithyeah, asking for reviews on tests is very concrete, so a good plan :)21:41

Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!