Re: "Rehabilitating Pickle" a talk at PyCon UK 2018
Jim Fulton <[email protected]> Thu, 24 Jan 2019 07:04:04 -0700
| Newsgroups | gmane.comp.web.zope.zodb |
|---|---|
| Message-ID | <CAPDm-FjW2vfBQ+nO4X6v1J4R36ei-cOoyyKXcsyev=KsA_9AUA@mail.gmail.com> |
--0000000000008cb78f058034af28 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 23, 2019 at 3:00 PM 'Juergen Herrmann' via zodb < [email protected]> wrote: > What would be necessary to limit pickling in ZODB to read only > specific/whitelisted classes? > This could be done with a storage wrapper. There is a pickle hook for getting global objects that can be used to limit what pickle is willing to call. For example, ZEO does this at the protocol level avoid accepting all but a limited number of globals in pickles in it's wire protocol. Pickle is really way more powerful than ZEO needs and I wouldn't use it today and ZEO recently got support for msgpack. > I chose ZODB as the file storage format for my speaker crossover program > and wrote a very thin wrapper around ZODB which puts a FileStorage .fs in= to > the tmp dir, opens it and copies it back when saving. Works great but now > that I hear that pickles are inherently unsafe I wonder how I can mitigat= e > this. > They aren't inherently unsafe. By default, you shouldn't accept pickles from untrusted sources. Are you doing that? If not, you have nothing to worry about. Jim > > Best regards, > J=C3=BCrgen > > Am Mi., 16. Jan. 2019 um 11:33 Uhr schrieb Christopher Lozinski < > [email protected]>: > >> I found this talk quite interesting. >> >> 9 minutes ago >> <https://twitter.com/PythonLinks/status/1085482554000580608> >> >> Pickle is a compact serialization protocol for Python objects. Great for >> communication between #distributed >> <https://twitter.com/hashtag/distributed?src=3Dhash> #Python >> <https://twitter.com/hashtag/Python?src=3Dhash> programs, but it is not >> safe. What can be done? >> >> https://pythonlinks.info/rehabilitating-pickle >> >> >> Warm Regards >> Chris >> >> -- >> You received this message because you are subscribed to the Google Group= s >> "zodb" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "zodb" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > --=20 Jim Fulton http://jimfulton.info --=20 You received this message because you are subscribed to the Google Groups "= zodb" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to [email protected]. For more options, visit https://groups.google.com/d/optout. --0000000000008cb78f058034af28 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Wed, Jan 23, 2019 at 3:00 PM '= Juergen Herrmann' via zodb <<a href=3D"mailto:[email protected]"= >[email protected]</a>> wrote:<br></div><blockquote class=3D"gmail_q= uote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,2= 04);padding-left:1ex"><div dir=3D"ltr">What would be necessary to limit pic= kling in ZODB to read only specific/whitelisted classes?</div></blockquote>= <div><br></div><div>This could be done with a storage wrapper.=C2=A0</div><= div><br></div><div>There is a pickle hook for getting global objects that c= an be used to limit what pickle is willing to call. For example, ZEO does t= his at the protocol level avoid accepting all but a limited number of globa= ls in pickles in it's wire protocol. Pickle is really way more powerful= than ZEO needs and I wouldn't use it today and ZEO recently got suppor= t for msgpack.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" styl= e=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddin= g-left:1ex"><div dir=3D"ltr"><div>I chose ZODB as the file storage format f= or my speaker crossover program and wrote a very thin wrapper around ZODB w= hich puts a FileStorage .fs into the tmp dir, opens it and copies it back w= hen saving. Works great but now that I hear that pickles are inherently uns= afe I wonder how I can mitigate this.<br></div></div></blockquote><div><br>= </div><div>They aren't inherently unsafe.=C2=A0 By default, you shouldn= 't accept pickles from untrusted sources. Are you doing that?=C2=A0 If = not, you have nothing=C2=A0to worry about.</div><div></div><div><br></div><= div>Jim</div><div><br></div><div><br></div><div><br></div><div>=C2=A0</div>= <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-= left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div></d= iv><div><br></div><div>Best regards,</div><div>J=C3=BCrgen</div></div><br><= div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail-m_-79164937160346= 77636gmail_attr">Am Mi., 16. Jan. 2019 um 11:33=C2=A0Uhr schrieb Christophe= r Lozinski <<a href=3D"mailto:[email protected]" target= =3D"_blank">[email protected]</a>>:<br></div><blockquote = class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px sol= id rgb(204,204,204);padding-left:1ex"><div><div>I found this talk quite int= eresting. =C2=A0</div><div><br></div><div><div class=3D"gmail-m_-7916493716= 034677636gmail-m_-1581236281649401542stream-item-header" style=3D"display:f= lex;color:rgb(20,23,26);font-family:"Helvetica Neue",Helvetica,Ar= ial,sans-serif;font-size:14px;font-variant-ligatures:normal;background-colo= r:rgb(255,255,255)"><small class=3D"gmail-m_-7916493716034677636gmail-m_-15= 81236281649401542time" style=3D"font-size:14px;color:rgb(101,119,134);margi= n-right:5px;white-space:nowrap"><span class=3D"gmail-m_-7916493716034677636= gmail-m_-1581236281649401542u-hiddenVisually" style=3D"background-color:tra= nsparent;color:rgb(101,119,134);text-decoration:none;border:0px;font-size:1= px;height:1px;overflow:hidden;padding:0px;width:1px"><a href=3D"https://twi= tter.com/PythonLinks/status/1085482554000580608" class=3D"gmail-m_-79164937= 16034677636gmail-m_-1581236281649401542js-nav gmail-m_-7916493716034677636g= mail-m_-1581236281649401542tweet-timestamp gmail-m_-7916493716034677636gmai= l-m_-1581236281649401542js-permalink gmail-m_-7916493716034677636gmail-m_-1= 581236281649401542js-tooltip" title=3D"2:23 AM - 16 Jan 2019" style=3D"back= ground-color:transparent;color:rgb(101,119,134);text-decoration:none" targe= t=3D"_blank">9 minutes ago</a></span></small></div><div class=3D"gmail-m_-7= 916493716034677636gmail-m_-1581236281649401542js-tweet-text-container" styl= e=3D"color:rgb(20,23,26);font-family:"Helvetica Neue",Helvetica,A= rial,sans-serif;font-size:14px;font-variant-ligatures:normal;background-col= or:rgb(255,255,255)"><p class=3D"gmail-m_-7916493716034677636gmail-m_-15812= 36281649401542TweetTextSize gmail-m_-7916493716034677636gmail-m_-1581236281= 649401542tweet-text gmail-m_-7916493716034677636gmail-m_-158123628164940154= 2js-tweet-text" lang=3D"en" style=3D"margin:0px 0px 8px;line-height:20px;wh= ite-space:pre-wrap">Pickle is a compact serialization protocol for Python o= bjects. Great for communication between <a href=3D"https://twitter.com/hash= tag/distributed?src=3Dhash" class=3D"gmail-m_-7916493716034677636gmail-m_-1= 581236281649401542twitter-hashtag gmail-m_-7916493716034677636gmail-m_-1581= 236281649401542js-nav gmail-m_-7916493716034677636gmail-m_-1581236281649401= 542pretty-link" dir=3D"ltr" style=3D"background:transparent;color:rgb(27,14= 9,224);text-decoration:none" target=3D"_blank">#distributed</a> <a href=3D"= https://twitter.com/hashtag/Python?src=3Dhash" class=3D"gmail-m_-7916493716= 034677636gmail-m_-1581236281649401542twitter-hashtag gmail-m_-7916493716034= 677636gmail-m_-1581236281649401542js-nav gmail-m_-7916493716034677636gmail-= m_-1581236281649401542pretty-link" dir=3D"ltr" style=3D"background:transpar= ent;color:rgb(27,149,224);text-decoration:none" target=3D"_blank">#Python</= a> programs, but it is not safe.=20 What can be done?</p></div></div><div><br></div><div><a href=3D"https://pyt= honlinks.info/rehabilitating-pickle" target=3D"_blank">https://pythonlinks.= info/rehabilitating-pickle</a></div><div><br></div><div><br></div><div>Warm= Regards</div><div>Chris</div></div> <p></p> -- <br> You received this message because you are subscribed to the Google Groups &= quot;zodb" group.<br> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]" target=3D"_bla= nk">[email protected]</a>.<br> For more options, visit <a href=3D"https://groups.google.com/d/optout" targ= et=3D"_blank">https://groups.google.com/d/optout</a>.<br> </blockquote></div> <p></p> -- <br> You received this message because you are subscribed to the Google Groups &= quot;zodb" group.<br> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]" target=3D"_bla= nk">[email protected]</a>.<br> For more options, visit <a href=3D"https://groups.google.com/d/optout" targ= et=3D"_blank">https://groups.google.com/d/optout</a>.<br> </blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"= class=3D"gmail_signature">Jim Fulton<br><a href=3D"http://jimfulton.info" = target=3D"_blank">http://jimfulton.info</a><br></div></div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;zodb" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">zodb+unsubscri= [email protected]</a>.<br /> For more options, visit <a href=3D"https://groups.google.com/d/optout">http= s://groups.google.com/d/optout</a>.<br /> --0000000000008cb78f058034af28--