Monday, 2018-03-12

*** dmsimard has quit IRC06:34
*** dmsimard has joined #openstack-infra-incident06:42
*** panda|off is now known as panda09:40
*** myoung has joined #openstack-infra-incident12:17
*** myoung is now known as myoung|ruck12:18
*** rlandy has joined #openstack-infra-incident12:31
*** panda is now known as panda|lunch13:05
*** panda|lunch is now known as panda13:35
*** rosmaita has joined #openstack-infra-incident15:59
*** rlandy is now known as rlandy|afk17:29
*** myoung|ruck is now known as myoung|afk18:01
*** myoung|afk is now known as myoung|biab18:01
-openstackstatus- NOTICE: Most jobs in zuul are currently failing due to a recent change to zuul; we are evaluating the issue and will follow up with a recommendation shortly. For the moment, please do not recheck.18:17
*** ChanServ changes topic to "Most jobs in zuul are currently failing due to a recent change to zuul; we are evaluating the issue and will follow up with a recommendation shortly. For the moment, please do not recheck."18:17
*** panda is now known as panda|off18:20
*** ChanServ changes topic to "Situation normal | OpenStack Infra team incident handling channel | Find us in #openstack-infra for more stimulating conversation"18:40
-openstackstatus- NOTICE: Zuul has been restarted without the breaking change; please recheck any changes which failed tests with the error "Accessing files from outside the working dir ... is prohibited."18:40
corvushi18:55
tobiashhi18:55
dmsimardo/18:56
corvusi can't concentrate on something important like a security bugfix with more that one conversation going one18:56
corvusso... to recap18:56
corvushttp://logs.openstack.org/22/551822/1/gate/openstack-tox-py27/623f25c/job-output.txt.gz#_2018-03-12_18_05_21_24580018:56
corvushttp://logs.openstack.org/22/551822/1/gate/openstack-tox-py27/623f25c/ara/file/71b64ee4-f5b4-49ef-aed3-419a39127f07/#line-418:56
corvusand https://review.openstack.org/552110 is a proposed fix18:57
corvustobiash: i wonder whether that will actually fix it though18:58
tobiashcorvus: nope18:58
tobiashI don't think anymore18:58
tobiashwell it solves one part I think18:58
corvusfind_needle is going to find .../playbook_0/project/....18:58
corvusand playbook_0 isn't under work/, so it will fail the path check18:58
tobiashbut currently the symlink makes the check for .../work/... work for the repo under test18:58
corvustobiash: yes, and any untrusted repo involved in testing (ie, via depends-on)18:59
tobiashso they are located in /work/src...18:59
tobiashright?18:59
corvustobiash: yes18:59
tobiashso the symlink actually makes that work19:00
tobiashso if this assumption is correct, 552110 should break tox-remote19:00
corvusnice19:00
corvusso yeah, the hard link will both (a) not fix the trusted context, and (b) further break the untrusted context19:01
*** rlandy|afk is now known as rlandy19:01
tobiashI think we need a combination of hard link and allow the playbook dir19:02
tobiashbut with the current implementation it'll be more complicated to make reading from playbook dir work and restrict writes to work19:02
corvustobiash: or we could leave the symlinks and allow trusted/19:02
corvus(but only for reading, not writing)19:03
tobiashI think we still need to split between reading and writing19:03
corvustobiash: oh, because we're overriding find_needle, and we don't know whether find_needle is being used for src or dest...?19:03
tobiashand then we;re safer with hard links19:03
tobiashyah19:03
fungiis there any reason to disallow reading of files under trusted/? content we want to avoid getting copied/exposed?19:04
corvusfungi: no, trusted/ only contains git repos, so should be okay.19:04
corvusthe playbook directory gets secrets.yaml.  it still may be okay to allow that, but will require a bit more thought (like, it's probably okay to read any file in the *current* playbook directory, but we shouldn't allow reading from *other* playbook directories)19:05
corvusfor reference: http://git.openstack.org/cgit/openstack-infra/zuul/tree/zuul/executor/server.py#n29019:05
tobiashok, so allowing trusted/ is most easiest19:06
corvustobiash: but we should only do so for reads :/19:07
tobiashbut I have no good idea how to differenciate that currently19:07
tobiashwithout forking the complete modules19:07
corvustobiash: could we do something like the old version of the patch checking, where we explicitly pull out the arguments and call find_needle ourselves?19:08
corvuss/patch/path/19:08
tobiashcorvus: maybe there is a possibility:19:10
tobiashhttps://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/action/copy.py#L44819:11
tobiashjust noticed that the args are in self19:11
tobiashas well as find_needle19:11
corvusso we can compare the argument to figure out which is which?19:12
corvusif needle==src permit trusted19:12
*** myoung|biab is now known as myoung|ruck19:13
tobiashhrm, actually I think find_needle is never used for writing19:13
corvussome modules will need some custom comparators there -- like the script module manipulates 'source' before it passes it to find_needle, but that work was already done....19:13
tobiashfind_needle doesn't make sense for specifying a dest19:13
corvusnow that you say that, it makes perfect sense19:13
tobiashso in find_needle we can always allow trusted19:13
tobiashjust need to adjust the path checker with a allow_trusted=False19:14
corvusyeah, so find_needle can use that, and the existing dest patch checks will not19:15
tobiashcool19:17
corvusi need to grab some food now; i can help with some test cases, etc, when i get back19:28
tobiashremote: Allow trusted for find_needle  https://review.openstack.org/55212719:31
tobiashwithout test case yet19:31
corvustobiash: good news!  the hard lik change failed tests :)20:06
tobiashYeah, just looked at that20:07
corvustobiash: though it looks like it was because the hardlink operation itself failed20:08
tobiashYah20:08
corvustobiash: what can i help with?20:10
tobiashcorvus: what do you think about the approach in 552127?20:12
corvustobiash: lgtm20:13
tobiashcorvus: latest ps of 552127 adds a skelleton of a tes for that20:16
tobiashit probably won't work yet20:17
tobiashbut I think at least something similar could mimick the trusted repo problem20:17
corvustobiash: i'm running that test locally now20:21
corvustobiash: the patch has a typo, but also, the new test fails20:21
tobiashjust updated20:22
corvus                                "msg": "Accessing files from outside the working dir /tmpfs/tmpt77h7s_d/zuul-test/c45c9f22f10144d28433c8ac1acd3583/work is prohibited. Invalid path: /tmpfs/tmpt77h7s_d/zuul-test/c45c9f22f10144d28433c8ac1acd3583/trusted/project_0/review.example.com/common-config/roles/common-copy/files/common-file"20:22
corvusis what i got20:22
tobiashok, ran it too now20:23
tobiashI got that too20:23
corvusfound the bug20:24
corvustobiash: left comments on change20:24
corvuson ps320:24
tobiashah, so the leading / breaks it?20:25
corvusit passes with that fix.  and i think that helps confirm that it's a working test.20:25
corvustobiash: yeah, it ends up as '/trusted'20:25
tobiashoh cool, local test worked :)20:25
corvushttps://docs.python.org/2/library/os.path.html#os.path.join20:25
tobiashthat was easier than expected20:25
corvus" If a component is an absolute path, all previous components are thrown away and joining continues from the absolute path component."20:25
tobiashah, didn't read the docs ;)20:26
dmsimardSorry for not being more helpful, I get lost quickly in the Zuul speculative things. I'll cheer on from the sidelines.20:27
tobiashbut at least the leading / proved that the test case is correct :)20:28
corvusdmsimard: keep asking questions :)20:28
corvustobiash: agreed20:28
tobiashso I should pretend the leading / was intended ;)20:29
dmsimardcorvus: yeah, I ask a lot of questions and the intent is not always to get an answer, it's often to make people think and hopefully spark ideas :D20:30
dmsimardI'll take a look at the patch and see if I have any useful input20:31
* dmsimard gets 500 errors looking up the ansible github repo..20:32
dmsimardCould/should we overload "find_file_in_search_path" ? https://github.com/ansible/ansible/blob/5c7f203c33b60de98cc30d5f04150e2bacfa4a84/lib/ansible/plugins/lookup/__init__.py#L11120:35
dmsimardI feel like that's sort of the intent with the work we're doing in paths.py but I'm not sure where/how that file ends up being used20:36
dmsimardI admit it's kind of tricky to try and prevent any/all modules from accessing things it's not supposed to20:41
dmsimardMaintaining our own module forks with "embedded" security checks doesn't scale very well though20:41
dmsimardI wonder what's the plan for that moving forward, especially with the talks around supporting different versions of Ansible but that's a question for #zuul :)20:42
corvusdmsimard: it looks like our lookup plugins either call find_file_in_search_path and checking the value before handing off to the originals, or override a lower-level method and perform a check there20:47
corvusdmsimard: we might be able to save some code and simplify things by overriding that in the same way we're doing find_needle20:48
fungiif memory serves, there are ongoing discussions upstream about integrating some of our safety/security work20:48
fungithough i don't know which parts20:48
dmsimardfungi: the more we can push upstream as appropriate, the better indeed20:48
corvusdmsimard: also, that might allow those plugins to benefit from the ability to read files in their own directories like we're about to get with the find_needle thing20:49
dmsimardI talked with upstream about making ansible_search_path configurable a few weeks ago20:49
corvusdmsimard: if you want to hack on that, i think it could be beneficial20:49
corvusdmsimard: at the moment, i don't see a vulnerability there, but also, if you wanted to double check and audit those, that would be good too :)20:50
dmsimardcorvus: ansible_search_path, as I understand it, defines a hierarchy where Ansible tries to find things -- for example when using include_vars20:50
dmsimardIt doesn't prevent Ansible from looking at a place if you tell it to look there explicitely though20:51
dmsimardbut I could see a "feature" where ansible_search_path could be enforced, perhaps ?20:51
dmsimardIt's probably a bit more complicated than that, because you need something that'd prevent, say, the command module to do a "cat /etc/shadow"20:52
dmsimardThere's a feature they call "command nanny" (I think?), it's the stuff that tells you "you should use the yum module instead of putting yum in a command" for example. Maybe we could hook into that, I'm not sure how it works.20:53
dmsimardHmm, it's basically this. I remember it being something else: https://github.com/ansible/ansible/blob/5a80375be998a854013c4237e3494bc4a3a438fd/lib/ansible/modules/commands/command.py#L124-L15320:55
corvuswe seem to be winding down here, let's move further discussion back to #zuul21:04
fungithanks!21:06
*** SergeyLukjanov has quit IRC21:52
*** SergeyLukjanov has joined #openstack-infra-incident21:55
*** myoung|ruck is now known as myoung|bbl22:16
*** rlandy is now known as rlandy|bbl23:12

Generated by irclog2html.py 2.15.3 by Marius Gedminas - find it at mg.pov.lt!