@@ -9,8 +9,7 @@ import * as os from "os";
99interface CommandConfig {
1010 command : string ;
1111 args : string [ ] ;
12- sanitizedArgs : string [ ] ; // args with password hidden
13- env ?: Record < string , string > ;
12+ env : Record < string , string > ;
1413}
1514
1615async function downloadSqldef ( command : string , version : string ) : Promise < string > {
@@ -72,7 +71,6 @@ function getCommandConfig(command: string): CommandConfig {
7271 const config : CommandConfig = {
7372 command : "" ,
7473 args : [ ] ,
75- sanitizedArgs : [ ] ,
7674 env : { } ,
7775 } ;
7876
@@ -89,10 +87,11 @@ function getCommandConfig(command: string): CommandConfig {
8987
9088 config . args . push ( "-h" , host , "-p" , port ) ;
9189 if ( user ) config . args . push ( "-U" , user ) ;
90+ if ( password ) {
91+ config . env . PGPASSWORD = password ;
92+ core . setSecret ( password ) ;
93+ }
9294 if ( database ) config . args . push ( database ) ;
93- if ( password ) config . env = { ...config . env , PGPASSWORD : password } ;
94-
95- config . sanitizedArgs = [ ...config . args ] ;
9695 break ;
9796 }
9897 case "mysqldef" : {
@@ -106,17 +105,16 @@ function getCommandConfig(command: string): CommandConfig {
106105 if ( user ) config . args . push ( "-u" , user ) ;
107106 // Use environment variable for password (works with empty passwords)
108107 // This avoids command line parsing issues with -p flag
109- if ( password != null ) {
110- config . env = { ...config . env , MYSQL_PWD : password } ;
108+ if ( password ) {
109+ config . env . MYSQL_PWD = password ;
110+ core . setSecret ( password ) ;
111111 }
112112 if ( database ) config . args . push ( database ) ;
113- config . sanitizedArgs = [ ...config . args ] ;
114113 break ;
115114 }
116115 case "sqlite3def" : {
117116 const database = core . getInput ( "sqlite-database" ) ;
118117 if ( database ) config . args . push ( database ) ;
119- config . sanitizedArgs = [ ...config . args ] ;
120118 break ;
121119 }
122120 case "mssqldef" : {
@@ -132,9 +130,9 @@ function getCommandConfig(command: string): CommandConfig {
132130 // Add -P flag for password if provided
133131 if ( password ) {
134132 config . args . push ( `-P${ password } ` ) ;
133+ core . setSecret ( password ) ;
135134 }
136135 if ( database ) config . args . push ( database ) ;
137- config . sanitizedArgs = config . args . map ( ( arg ) => ( arg === `-P${ password } ` ? "-P***" : arg ) ) ;
138136 break ;
139137 }
140138 default :
@@ -193,8 +191,6 @@ async function runSqldef(binaryPath: string, config: CommandConfig): Promise<str
193191 }
194192 Object . assign ( execEnv , config . env ) ;
195193
196- core . debug ( `Running command: ${ binaryPath } ${ config . sanitizedArgs . join ( " " ) } ` ) ;
197-
198194 const exitCode = await exec . exec ( binaryPath , config . args , {
199195 env : execEnv ,
200196 silent : false ,
0 commit comments