question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

invokeMethods and echoCommand

See original GitHub issue

Expected behavior

When entering a command which contains text to invoke methods, the command is processed (in my case, sent to the server via socket.io). The cmd or method invocations should not fire at this point. In terms of user expectations, the command just typed is not being echoed back - it’s just remaining behind.

Actual behavior

In fact the prompt and the command just entered is echoed back and cmd/method invocations fire immediately. This behavior interferes with entering any text containing cmd/method invocation strings. Furthermore, there is no opportunity to sanitize or escape the entered command before it is echoed back, which means the user’s commandline is a vector for social-engineering attack (getting people to type [[ terminal::pause() ]] for example). This appears to be a “hole” in the ability to use these invocations safely.

My workaround is to turn off echoCommand and echo the prompt + sanitized command via code. I escape brackets thusly and insert zero-width non-join characters: command.replace(/\[/g, '[‌').replace(/\]/g, ']‌');

However this means I must replace all cases where echoCommand: true would apply such as with terminal.read.

Steps to reproduce

In an interpreter with invokeMethods: true; echoCommand: true; enter: [[ terminal::clear() ]]

Browser and OS

firefox 60.8.0esr (64-bit), Debian stretch

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jcubiccommented, Aug 13, 2019

Sorry, you’re right, echo command is invoking methods, it should not execute the command, I was testing with prism enabled that was escaping brackets. This should be easy to fix, because echo have option exec that can be set to false.

0reactions
jcubiccommented, Aug 13, 2019

Released in version 2.7.1 will publish to npm soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CMD /C and echo on a remote machine invoking command
i got a mysterious phenomena if i am going to write a file to the share folder on a remote machine. object[] theProcessToRun2...
Read more >
JQuery Terminal Emulator Plugin - Api Reference
invokeMethods boolean — enable using terminal and cmd methods in extended commands of echo, default is false because of security (an attacker could...
Read more >
Use the Application Services Agent - TechDocs - Broadcom Inc.
Monitor messages from J2EE JMS queues and topics. Directly invoke methods on Java classes in the agent class path. Make Java Remote Method...
Read more >
How to use Echo Command in Linux (With Examples)
The echo command in Linux is used to print out a string of text you provide as the output. Here is how to...
Read more >
Core Libraries - Oracle Help Center
do arbitrary reflective actions such as create classes and invoke methods on them. If ... environment variable HOME) with the echo command:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found