File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { field, logger } from "@coder/logger";
22import { ServerMessage , SharedProcessActiveMessage } from "@coder/protocol/src/proto" ;
33import { Command , flags } from "@oclif/command" ;
44import { fork , ForkOptions , ChildProcess } from "child_process" ;
5+ import { randomFillSync } from "crypto" ;
56import * as fs from "fs" ;
67import * as os from "os" ;
78import * as path from "path" ;
@@ -136,13 +137,9 @@ export class Entry extends Command {
136137 let password = flags [ "password" ] ;
137138 if ( ! password ) {
138139 // Generate a random password
139- const passwordLength = 12 ;
140- const possible = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ;
141- const chars = [ ] ;
142- for ( let i = 0 ; i < passwordLength ; i ++ ) {
143- chars . push ( possible [ Math . floor ( Math . random ( ) * possible . length ) ] ) ;
144- }
145- password = chars . join ( "" ) ;
140+ const buffer = Buffer . alloc ( 12 ) ;
141+ randomFillSync ( buffer ) ;
142+ password = buffer . toString ( "hex" ) ;
146143 }
147144
148145 const hasCustomHttps = certData && certKeyData ;
You can’t perform that action at this time.
0 commit comments