python-patch icon indicating copy to clipboard operation
python-patch copied to clipboard

Support for patches that add or remove files

Open GoogleCodeExporter opened this issue 10 years ago • 4 comments

I noticed that patch.py does not support patches that add or remove files.
Following patch against v245 adds support for this.

Original issue reported on code.google.com by [email protected] on 12 Dec 2014 at 4:25

Attachments:

GoogleCodeExporter avatar Apr 18 '15 09:04 GoogleCodeExporter

Very nice! would you mind adding a few tests to your patch?

Original comment by [email protected] on 12 Dec 2014 at 5:39

GoogleCodeExporter avatar Apr 18 '15 09:04 GoogleCodeExporter

Hi, this update contains the support for new files and deleting of files and 
also has a testcase for it. 

Original comment by [email protected] on 14 Dec 2014 at 6:13

Attachments:

GoogleCodeExporter avatar Apr 18 '15 09:04 GoogleCodeExporter

Hello. I was wondering if there was any timescale for applying and making a release with the create/remove functionality. I'd love to use patch.py (just testing it out for the first time today), and this is a blocker. Is there anything missing in the last patch attached here which is lacking/missing which you need a hand with?

Kind regards, Roger

ghost avatar Mar 24 '16 18:03 ghost

@rleigh-dundee hi, glad you find it useful. The last patch lacks a proper security research:

  1. that created files do not fall outside of scope of patch local directory
  2. that API still allows to use patches with absolute paths if people really need them

Patching existing files is already a danger, but creating them opens several new attack vectors. I am not getting time for it, because I am actively looking for a solution to refill my living cost funds, and so far no proposal included the work on patch.py

Actionable items include:

  1. review that filename normalization function is secure https://github.com/techtonik/python-patch/blob/e659ebd079157418e13ba36a64cfd90bb21d62e3/patch.py#L683
  2. write missing tests for it
  3. run it against existing test suites for filename sanitization (and find those suites)

techtonik avatar Mar 31 '16 07:03 techtonik