<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Horacio Rivero</title>
    <description>The latest articles on Forem by Horacio Rivero (@hume).</description>
    <link>https://forem.com/hume</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F337053%2Fc5f056a4-b1b0-4ac6-ba21-d26b5f1e400c.png</url>
      <title>Forem: Horacio Rivero</title>
      <link>https://forem.com/hume</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/hume"/>
    <language>en</language>
    <item>
      <title>Upload file using Fetch and calc the progress using readable streams not work as expected (Browser)</title>
      <dc:creator>Horacio Rivero</dc:creator>
      <pubDate>Sun, 02 Jan 2022 04:18:42 +0000</pubDate>
      <link>https://forem.com/hume/upload-file-using-fetch-and-calc-the-progress-using-readable-streams-not-work-as-expected-browser-cgh</link>
      <guid>https://forem.com/hume/upload-file-using-fetch-and-calc-the-progress-using-readable-streams-not-work-as-expected-browser-cgh</guid>
      <description>&lt;p&gt;I am trying to upload a file using fetch streams, I need can calculate the upload progress.&lt;/p&gt;

&lt;p&gt;But on the server I receive an corrupt file of 0 bytes, I really don't know how to use the ReadableStreams feature, that is a really new feature.&lt;/p&gt;

&lt;p&gt;Client (Browser)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fileReadble&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;ReadableStream&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;pump&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
      &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;pump&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;read&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="nx"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
              &lt;span class="k"&gt;return&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;

          &lt;span class="nx"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;enqueue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;pump&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;})&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;uploadVideo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fileReader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;getReader&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://localhost:3005&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
      &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   
      &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;fileReadble&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fileReader&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`unexpected response &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;statusText&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Server (Node)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;node:http&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createWriteStream&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;node:fs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="nx"&gt;http&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createWriteStream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./video.mp4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3005&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: I am using tus-js-client on the server to upload videos to vimeo, this is for security reasons and others related to tus-client, I need to send the file using Fetch API.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>help</category>
    </item>
    <item>
      <title>#help React-spring transition problem</title>
      <dc:creator>Horacio Rivero</dc:creator>
      <pubDate>Fri, 24 Apr 2020 05:12:50 +0000</pubDate>
      <link>https://forem.com/hume/react-spring-transition-problem-22h2</link>
      <guid>https://forem.com/hume/react-spring-transition-problem-22h2</guid>
      <description>&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;I have a question; how i can  achieve a progressive delay in the entry of each element, using &lt;strong&gt;react-spring&lt;/strong&gt; transition.&lt;/p&gt;

&lt;p&gt;The first example shown on the react-spring transition oficial page is wrong, the code does not correspond to the animation shown:&lt;br&gt;
&lt;a href="https://www.react-spring.io/docs/hooks/use-transition"&gt;https://www.react-spring.io/docs/hooks/use-transition&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How could I achieve that same effect?, how I can insert a delay between the input of each component, using a spring easing, like the example?.&lt;/p&gt;

&lt;p&gt;When I try the example code, all components enter at the same time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([...])&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;transitions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useTransition&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;translate3d(0,-40px,0)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;enter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;translate3d(0,0px,0)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;leave&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;translate3d(0,-40px,0)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;transitions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;animated&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/animated.div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Excuse me if it's an absurd question, but the documentation of this library is poor, and I think setting a setTimeout is not the best way...&lt;/p&gt;

&lt;p&gt;What method do you currently use to perform the animations in conjunction with React; pure css/sass animations, javascript, styled components, animate.js?&lt;/p&gt;

</description>
      <category>help</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>Analizando un método de bypass de sistemas WAF</title>
      <dc:creator>Horacio Rivero</dc:creator>
      <pubDate>Thu, 26 Mar 2020 18:26:55 +0000</pubDate>
      <link>https://forem.com/hume/analizando-un-metodo-de-bypass-de-sistemas-waf-3opl</link>
      <guid>https://forem.com/hume/analizando-un-metodo-de-bypass-de-sistemas-waf-3opl</guid>
      <description>&lt;p&gt;El método que se muestra en la imagen es comúnmente utilizado en ofuscación de código javascript malicioso para realizar ataques de XSS, para los que se preguntar para que ofuscar este código?, bueno los Firewalls o los sistemas conocidos como WAF por ejemplo los de Clouflare, Akamai, filtran todo tipo de código malicioso antes de que este llegue a a una servidor/servicio/gateway/proxy reverso de backend, pero gracias algunas técnicas es posible pasar alguno de estos filtros.&lt;/p&gt;

&lt;p&gt;El código a continuación es capaz de pasar varios tipos de filtros:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QcXWC7PN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/36adfw8l2ge3yjcowkwk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QcXWC7PN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/36adfw8l2ge3yjcowkwk.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ahora lo interesante es saber por que este segmento de código es capaz de ejecutarse y saber que esta ocurriendo en el fondo.&lt;/p&gt;

&lt;h3&gt;
  
  
  Analicemos que esta ocurriendo por partes
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="c1"&gt;// obtiene el valor unicode representado de forma decimal &lt;/span&gt;
&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;charCodeAt&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// 40&lt;/span&gt;

&lt;span class="c1"&gt;// se pasa de valor unicode decimal a su repretacion hexadecimal base 16&lt;/span&gt;
&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;charCode&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 28&lt;/span&gt;

&lt;span class="c1"&gt;// se pasa de su valor expresado de forma hexadecimal a su presetacion decimal base 10&lt;/span&gt;
&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0x0028&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 40&lt;/span&gt;

&lt;span class="c1"&gt;// representación de valores unicode hexadecimales a string, siguiendo el ejemplo anterior entoces podemos representar los valores de esta forma reemplazado "0" por "/" y "x" por "u"&lt;/span&gt;
&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s1"&gt;u0028&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// '(' &lt;/span&gt;
&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s1"&gt;u0029&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// ')'&lt;/span&gt;

&lt;span class="c1"&gt;// ahora realicemos la representación corta y ocultemos los paréntesis ya que estos van a ser detectados por los filtros &lt;/span&gt;
&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s1"&gt;x28&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// '(' &lt;/span&gt;
&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s1"&gt;x29&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// ')'&lt;/span&gt;

&lt;span class="c1"&gt;// gracias a los template string incorporados en ES6, ahora las funciones pueden ser invocadas de esta forma ``, esto es algo que ya muchos saben. &lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="s2"&gt;`hello wold`&lt;/span&gt;

&lt;span class="c1"&gt;// como todos saben el constructor de Set y de cualquier funcion es Function, por ende cada función va a heredan el comportamiento de invocación que se muestra en la función test&lt;/span&gt;
&lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;constructor&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nb"&gt;Function&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;constructor&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nb"&gt;Function&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;

&lt;span class="c1"&gt;// entonces si creamos una función y luego la invocamos comprenderemos que ocurre cuando se invoca al contructor de esta forma Function``&lt;/span&gt;
&lt;span class="nb"&gt;Function&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;console.log("hello")&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;console.log("world")&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])()&lt;/span&gt; &lt;span class="c1"&gt;// hello world&lt;/span&gt;

&lt;span class="c1"&gt;// lo que realiza el constructor de la función de arriba es algo muy similar a esto&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fns&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nx"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;console.log('hello')&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;console.log('world')&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])()&lt;/span&gt; &lt;span class="c1"&gt;// hello world&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Ahora expresamos la función del principio de otra forma para que se vea todo más claro, creamos una función y pasamos como argumento un bloque de instrucciones y luego invocamos la función resultante.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rjaqZnZ9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fqbw77gz6ryenzkhk6hk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rjaqZnZ9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fqbw77gz6ryenzkhk6hk.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Bueno como lo ven no es tan complejo, existen algunos métodos que realmente contiene bastante complejidad, pueden ver alguno de ellos en este enlace:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://owasp.org/www-community/xss-filter-evasion-cheatsheet"&gt;xss filter evasion cheatsheet&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>javascript</category>
      <category>xss</category>
    </item>
    <item>
      <title>
One of the dark sides of open source software </title>
      <dc:creator>Horacio Rivero</dc:creator>
      <pubDate>Fri, 28 Feb 2020 21:32:33 +0000</pubDate>
      <link>https://forem.com/hume/one-of-the-dark-sides-of-open-source-software-1i5k</link>
      <guid>https://forem.com/hume/one-of-the-dark-sides-of-open-source-software-1i5k</guid>
      <description>&lt;p&gt;This time I will tell you about a bookstore which is one of the most used in the world of web development called &lt;strong&gt;Terser&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The programmers of this library have created a new repository with an attractive logo and that has 90% of the old code, but why is the code of such poor quality?.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: I am not going to focus this time on talking about a security problems, only i focused on speak about code quality problems.&lt;/p&gt;

&lt;p&gt;This library has a method that contains &lt;strong&gt;208&lt;/strong&gt; lines of code with a cyclomatic complexity of &lt;strong&gt;76&lt;/strong&gt;. It is obviously a huge bloater smell, it has 46 if, 4 else, several nested if, variables that perform hoisting, 2 throw statements, mutates the values of some variables multiple times, including those of the input parameters, it returns two totally different values, all that within a try catch block, this library is undermined by this type of problem in all of his code.&lt;/p&gt;

&lt;p&gt;This is just an example, much of the open source code that me, you and you great company use every day, is undermined by all kinds of code smells and design problems.&lt;/p&gt;

&lt;p&gt;This library for those who do not know is the successor of UglifyJS, has 9,310,994 weekly downloads, I guess the developers, probably see these problems, but decided not to do &lt;strong&gt;Yak shaving&lt;/strong&gt;, but well I think nobody wanted to refactor that for obvious reasons.&lt;/p&gt;

&lt;p&gt;Those who want to see the specific method here i leave the link:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/terser/terser/blob/9e2ff84d05eaa25ca63197fe5e2622f0b397a72e/lib/minify.js#L66"&gt;Terser smell code&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Conclusión: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This is a library that is used in the development environments, &lt;br&gt;
the impact that this problem can cause, will only affect the processing times, &lt;br&gt;
but what would happen if it were a library that is used in productive environments, what impact would it have?.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If someone wants to collaborate or improve aspects of this library, they will find a code very difficult to understand, test and maintain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Should be a law that every programmer must understand and know how create clean code o or understand about refactoring, and obviously the basic principles of software design.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Although it is ghost and unpaid work, it does not have to be of poor quality, remember that this represents what type of programmer you are.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Leave me your comment, and tell me, you use libraries without first reviewing the  code, are you guided by his reputation, or maybe for the many stars they have on github?.&lt;/p&gt;

&lt;p&gt;Maybe in my next articles write more in depth of other problems of the open source code.&lt;/p&gt;

&lt;p&gt;Greetings to all!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>opensource</category>
      <category>node</category>
    </item>
    <item>
      <title>🧟 Emojis can be wicked </title>
      <dc:creator>Horacio Rivero</dc:creator>
      <pubDate>Thu, 27 Feb 2020 08:43:11 +0000</pubDate>
      <link>https://forem.com/hume/emojis-can-be-wicked-3phl</link>
      <guid>https://forem.com/hume/emojis-can-be-wicked-3phl</guid>
      <description>&lt;p&gt;This is a brief history of two great applications that provide similar services, which own similar problems.&lt;/p&gt;

&lt;p&gt;All started as a kind of joke, it occurred to me when try create an account with a user name that contains an unicode character of atral plane  emm for example a typical emoji, assuming that the sanitization system was going to correctly remove these especial characters and then was going to issue an error, as expected of course, to my surprise this never was happeneds.. &lt;br&gt;
I found something more interesting.&lt;/p&gt;

&lt;p&gt;If you are wondering what the hell is an astral plane unicode character, u can read this great article and understand how those little bastards work in javascript 🙃.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jXv1Mc33--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/500/1%2Ac2pd0xefZkRdWTNL5L9qLw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jXv1Mc33--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/500/1%2Ac2pd0xefZkRdWTNL5L9qLw.jpeg" alt="emojis in js"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://medium.com/reactnative/emojis-in-javascript-f693d0eb79fb"&gt;Emojis in javascript&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The stage:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The system doesn't care that the email address that you entered really exist, as some say in the mexican glossary "les vale verga",&lt;br&gt;
while u respecting the pattern: &lt;a href="mailto:asdasd@asdasd.com"&gt;asdasd@asdasd.com&lt;/a&gt; everything would be valid.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They didn't have a captcha system, i could create all the accounts i wanted necesary, &lt;strong&gt;thousands&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They don't have a correct param sanitization method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Point in favor had a clouflare WAF system, &lt;br&gt;
so I could not use Tor nodes to create thousands of accounts, i would need rotary proxies or botnets etc.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The result:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t-GzR0_I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/nil2dhkn2s0zn19st2m8.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t-GzR0_I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/nil2dhkn2s0zn19st2m8.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Eager to continue having fun, I decided to go try another delivery system, &lt;br&gt;
following the same steps.&lt;/p&gt;

&lt;p&gt;I entered the registration page and introduced my evil emoji 🦄, i have baptized this fuzzimoji (fuzzing whit emojis 🥴).&lt;br&gt;
Guess what happened?, yes exactly the same but the result was worse.&lt;/p&gt;

&lt;h3&gt;
  
  
  The stage:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Information disclosure,the emoji had free passage and it can make an exception directly in the ORM system 😂, due to a fault in the Mysql database 💣, is it exploitable?, yes in some contexts, i found this:
&lt;a href="https://speakerdeck.com/mathiasbynens/hacking-with-unicode?slide=98"&gt;Hacking with unicode&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;The error: org.hibernate.exception.GenericJDBCException: could not execute statement&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;They didn't have a captcha system, i could create all the accounts i wanted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They don't have a correct param sanitization method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They have a WAF system, you are going to have to use some systems like, &lt;a href="https://github.com/Ekultek/WhatWaf"&gt;Bypass and detect WAF system&lt;/a&gt; for bypass the WAF, bullshit! 🤭, Nop, they does not have one, or some fraud detection system like &lt;a href="https://www.maxmind.com/en/home"&gt;Maxmind&lt;/a&gt;, you can create thousands of acounts using diferentes Tor nodes it is a really simple task, then they would be a very difficult task for theys to filter or find a search pattern to remove all bot accounts. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Point in favor, you must enter a valid email account, but can used a temporal account generator &lt;a href="https://temp-mail.org"&gt;temp-mail&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Second point in favor, you will need many phone numbers, &lt;br&gt;
but it is possible to pass this limitation 😉.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The result:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SoPlAepZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ev6zusbso7abtki84gqs.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SoPlAepZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ev6zusbso7abtki84gqs.jpeg" alt="result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I already assumed that this could happen, it was no accident, but investigating among other cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You might wonder what produced the good mistake&lt;/strong&gt;, it is something very simple.&lt;/p&gt;

&lt;p&gt;Turns out MySQL’s utf8 charset only partially implements proper UTF-8 encoding. It can only store UTF-8-encoded symbols that consist of one to three bytes; encoded symbols that take up four bytes aren’t supported.&lt;/p&gt;

&lt;p&gt;Since astral symbols (whose code points range from U+010000 to U+10FFFF) each consist of four bytes in UTF-8, you cannot store them using MySQL’s utf8 implementation.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can read about this in &lt;a href="https://mathiasbynens.be/notes/mysql-utf8mb4"&gt;mysql-utf8mb4&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Conclusion what is for my the real impact of this
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Someone could create thousands of accounts and place thousands of orders to different places generating huge losses, since it is possible to make payments at the door or at home, no credit card is required.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Someone could raise the position of your business doing, placing auto orders.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Someone could send a few deliverys to my worst enemy 👻.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Someone could make the largest congregation of al times of deliveries in Latin America by sending all to the same place at the same time. &lt;br&gt;
If you are some person of marketing team, you can make it happen, simply say it was a mistake, simply blame it was the programmers fault, think in this, is free publicity, then sit in your chair to wait for your boss's thanks 😉.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go deeper and exploit some vulnerability with the data obtained.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note 🚨&lt;/strong&gt;: I do not want to make an apology for the crime or improper use of the application, on the contrary i hope they will solve it, &lt;br&gt;
if they think it necessary. &lt;br&gt;
I also don't take responsibility for what the people can do with this information, take it with humor, everything is a joke.&lt;/p&gt;

&lt;p&gt;For me it was just a funny and interesting anegdota that I wanted to share with all. These are two large Latin American companies with thousands of employees, test departments and systems engineers, people who detect fraud etc, but it seems that sometimes the smallest details can escape their hands and can cause huge connotations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Leave me your opinion greetings!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>database</category>
      <category>javascript</category>
    </item>
    <item>
      <title>✋ Avoid EventEmitter Inheritance</title>
      <dc:creator>Horacio Rivero</dc:creator>
      <pubDate>Mon, 17 Feb 2020 16:21:33 +0000</pubDate>
      <link>https://forem.com/hume/avoid-eventemitter-inheritance-1cmh</link>
      <guid>https://forem.com/hume/avoid-eventemitter-inheritance-1cmh</guid>
      <description>&lt;p&gt;For a long time I have been observing how a large number of libraries, modules, frameworks, etc. made for Node.js solve a need that arises as follows:&lt;/p&gt;

&lt;p&gt;They see the need to add the behavior of the EventEmitter class and what they do is make a complete inheritance of this class 💩, which generates on the one hand, that a class as simple as Person, which can be seen in the image From below, grow unnecessarily in complexity, inheriting all EventEmitter behavior. Now what relationship exists between a Person and the rawListeners method?, &lt;br&gt;
they don't have real neither logical relationship.&lt;/p&gt;

&lt;p&gt;It is evident that a person generates events and that he can possess this behavior, but the prototype of a person logically is not EventEmitter, surely many will realize how to solve this problem, applying composition over inheritance.&lt;/p&gt;

&lt;p&gt;Here is an example in Express.js, an object called app is created that inherits all EventEmitter behavior:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/expressjs/express/blob/e1b45ebd050b6f06aa38cda5aaf0c21708b0c71e/lib/express.js#L42"&gt;Express.js example&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now if we see it in this image that I did, it is clearer what I want to express, someone who has to analyze the behavior of a class or quickly visualize the methods and properties, he will meet this context:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HBjje1ZH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/h0qq7huudrnz1jiff5md.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HBjje1ZH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/h0qq7huudrnz1jiff5md.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
    </item>
  </channel>
</rss>
