@@ -143,6 +143,10 @@ func (s *SingleRuntime) ExecuteRaw(command string) (string, error) {
143143
144144// Execute executes command on runtime API
145145func (s * SingleRuntime ) Execute (command string ) error {
146+ // Make sure to only execute a single command.
147+ if strings .ContainsAny (command , ";" ) {
148+ return ErrRuntimeInvalidChar
149+ }
146150 rawdata , err := s .ExecuteRaw (command )
147151 if err != nil {
148152 return fmt .Errorf ("%w [%s]" , err , command )
@@ -157,6 +161,10 @@ func (s *SingleRuntime) Execute(command string) error {
157161}
158162
159163func (s * SingleRuntime ) ExecuteWithResponse (command string ) (string , error ) {
164+ // Make sure to only execute a single command.
165+ if strings .ContainsAny (command , ";" ) {
166+ return "" , ErrRuntimeInvalidChar
167+ }
160168 rawdata , err := s .ExecuteRaw (command )
161169 if err != nil {
162170 return "" , fmt .Errorf ("%w [%s]" , err , command )
@@ -171,15 +179,15 @@ func (s *SingleRuntime) ExecuteWithResponse(command string) (string, error) {
171179}
172180
173181func (s * SingleRuntime ) ExecuteMaster (command string ) (string , error ) {
182+ // Make sure to only execute a single command.
183+ if strings .ContainsAny (command , ";" ) {
184+ return "" , ErrRuntimeInvalidChar
185+ }
174186 // allow one retry if connection breaks temporarily
175187 return s .executeRaw (command , 1 , masterSocket )
176188}
177189
178190func (s * SingleRuntime ) executeRaw (command string , retry int , socket socketType ) (string , error ) {
179- // Make sure to only execute a single command.
180- if strings .ContainsAny (command , ";" ) {
181- return "" , ErrRuntimeInvalidChar
182- }
183191 result , err := s .readFromSocket (command , socket )
184192 if err != nil && retry > 0 {
185193 retry --
0 commit comments