• Bug#1104246: [Pkg-javascript-devel] Bug#1104246: node-formidable propos

    From =?UTF-8?B?SsOpcsOpbXkgTGFs?=@21:1/5 to All on Thu Jul 24 11:50:01 2025
    Le lun. 21 juil. 2025 à 15:31, Yadd <[email protected]> a écrit :

    Hi,

    upstream chose to add a new dependency to fix CVE-2025-46653. However I
    think using "crypto" module is enough to fix this potential lack of randomness.
    Since Trixie has been frozen, I propose this little patch to fix the
    issue without changing source (adding a component).

    The proposed patch:
    - replaces hexoid (which uses Math.random) by built-in module "crypto"
    - increase id length from 25 characters to 40

    If you think it's OK to fix the issue, I'll upload and put a unblock BTS.


    Sorry for the late reply.

    There are two issues with this patch:
    - it doesn't generate a HEX string, while hexoid does
    - it could be much simpler

    function genIdTwo(len = 40) {
    return crypto.randomBytes(Math.ceil(len / 2)).toString('hex').slice(0, len);
    }

    Jérémy

    <div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 21 juil. 2025 à 15:31, Yadd &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt; a écrit :<br></div>
    <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>

    upstream chose to add a new dependency to fix CVE-2025-46653. However I <br> think using &quot;crypto&quot; module is enough to fix this potential lack of <br>
    randomness.<br>
    Since Trixie has been frozen, I propose this little patch to fix the <br>
    issue without changing source (adding a component).<br>

    The proposed patch:<br>
      - replaces hexoid (which uses Math.random) by built-in module &quot;crypto&quot;<br>
      - increase id length from 25 characters to 40<br>

    If you think it&#39;s OK to fix the issue, I&#39;ll upload and put a unblock BTS.<br></blockquote><div><br></div><div>Sorry for the late reply.</div><div><br></div><div>There are two issues with this patch:</div><div>- it doesn&#39;t generate a HEX
    string, while hexoid does</div><div>- it could be much simpler</div><div><br></div><div>function genIdTwo(len = 40) {<br>    return crypto.randomBytes(Math.ceil(len / 2)).toString(&#39;hex&#39;).slice(0, len);<br>}</div><div><br></div><div>Jérémy</
    </div></div>
    </div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)