mirror of
				https://github.com/easingthemes/ssh-deploy.git
				synced 2025-10-30 23:30:09 +08:00 
			
		
		
		
	fix: #113 limit ssh script input
This commit is contained in:
		
							parent
							
								
									c381b885db
								
							
						
					
					
						commit
						5894f5e290
					
				
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -15,16 +15,18 @@ const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Prom | ||||
|   const filename = `local_ssh_script-${label}.sh`; | ||||
|   try { | ||||
|     writeToFile({ dir: githubWorkspace, filename, content }); | ||||
|     const dataLimit = 10000; | ||||
|     const rsyncStdout = process.env.RSYNC_STDOUT.substring(0, dataLimit); | ||||
|     console.log(`Executing remote script: ssh -i ${privateKeyPath} ${sshServer}`); | ||||
|     exec( | ||||
|       `DEBIAN_FRONTEND=noninteractive ssh -p ${(remotePort || 22)} -i ${privateKeyPath} -o StrictHostKeyChecking=no ${sshServer} 'RSYNC_STDOUT="${process.env.RSYNC_STDOUT}" bash -s' < ${filename}`, | ||||
|       `DEBIAN_FRONTEND=noninteractive ssh -p ${(remotePort || 22)} -i ${privateKeyPath} -o StrictHostKeyChecking=no ${sshServer} 'RSYNC_STDOUT="${rsyncStdout}" bash -s' < ${filename}`, | ||||
|       (err, data, stderr) => { | ||||
|         if (err) { | ||||
|           const message = `⚠️ [CMD] Remote script failed: ${err.message}`; | ||||
|           console.warn(`${message} \n`, data, stderr); | ||||
|           handleError(message, isRequired, reject); | ||||
|         } else { | ||||
|           const limited = data.substring(0, 10000); | ||||
|           const limited = data.substring(0, dataLimit); | ||||
|           console.log('✅ [CMD] Remote script executed. \n', limited, stderr); | ||||
|           resolve(limited); | ||||
|         } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Dragan Filipovic
						Dragan Filipovic