@@ -149,6 +149,10 @@ func (s *SingleRuntime) ExecuteRaw(command string) (string, error) {
149149
150150// Execute executes command on runtime API
151151func (s * SingleRuntime ) Execute (command string ) error {
152+ // Make sure to only execute a single command.
153+ if strings .ContainsAny (command , ";" ) {
154+ return ErrRuntimeInvalidChar
155+ }
152156 rawdata , err := s .ExecuteRaw (command )
153157 if err != nil {
154158 return fmt .Errorf ("%w [%s]" , err , command )
@@ -163,6 +167,10 @@ func (s *SingleRuntime) Execute(command string) error {
163167}
164168
165169func (s * SingleRuntime ) ExecuteWithResponse (command string ) (string , error ) {
170+ // Make sure to only execute a single command.
171+ if strings .ContainsAny (command , ";" ) {
172+ return "" , ErrRuntimeInvalidChar
173+ }
166174 rawdata , err := s .ExecuteRaw (command )
167175 if err != nil {
168176 return "" , fmt .Errorf ("%w [%s]" , err , command )
@@ -177,15 +185,15 @@ func (s *SingleRuntime) ExecuteWithResponse(command string) (string, error) {
177185}
178186
179187func (s * SingleRuntime ) ExecuteMaster (command string ) (string , error ) {
188+ // Make sure to only execute a single command.
189+ if strings .ContainsAny (command , ";" ) {
190+ return "" , ErrRuntimeInvalidChar
191+ }
180192 // allow one retry if connection breaks temporarily
181193 return s .executeRaw (command , 1 , masterSocket )
182194}
183195
184196func (s * SingleRuntime ) executeRaw (command string , retry int , socket socketType ) (string , error ) {
185- // Make sure to only execute a single command.
186- if strings .ContainsAny (command , ";" ) {
187- return "" , ErrRuntimeInvalidChar
188- }
189197 result , err := s .readFromSocket (command , socket )
190198 if err != nil && retry > 0 {
191199 retry --
0 commit comments