File: secure-tmp-name.patch

package info (click to toggle)
node-temp 0.8.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 160 kB
  • sloc: makefile: 6; sh: 2
file content (22 lines) | stat: -rw-r--r-- 682 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Description: improve hard-to-guess temp names
Author: Jérémy Lal <kapouer@melix.org>
Last-Update: 2019-01-10
Forwarded: https://github.com/bruce/node-temp/pull/81
--- a/lib/temp.js
+++ b/lib/temp.js
@@ -1,5 +1,6 @@
 var fs   = require('fs'),
     path = require('path'),
+    crypto = require('crypto'),
     cnst = require('constants');
 
 var rimraf     = require('rimraf'),
@@ -18,7 +19,7 @@
               '-',
               process.pid,
               '-',
-              (Math.random() * 0x100000000 + 1).toString(36),
+              crypto.randomBytes(6).toString('hex'),
               affixes.suffix].join('');
   return path.join(affixes.dir || exports.dir, name);
 };