Skip to content

echo command no longer returns html tags#28

Open
dominicbraam wants to merge 1 commit intoCveinnt:mainfrom
dominicbraam:echo_command_html_tags_rm
Open

echo command no longer returns html tags#28
dominicbraam wants to merge 1 commit intoCveinnt:mainfrom
dominicbraam:echo_command_html_tags_rm

Conversation

@dominicbraam
Copy link

Description

As stated in issue 25, you can insert html tags into the prompt and it will act as intended.

Fix

The replace function was used to replace html tags with "". On linux, by default, it does not parse characters like < and would need to escape it. Example:

2022-06-22-102033_804x217_scrot

For now it is a simple fix but as the other commands have cheesy responses, maybe instead of "removing" the tags and still outputting the text within them, respond with "Nice try!" ?

Closes: #25

@ghost
Copy link

ghost commented May 18, 2024

okay i might be a little late but i hope others see it.

export const echo = async (args: string[]): Promise<string> => {
  const string = args.join(' ');
  const regex = /<(?:(?:(?:(script|style|object|embed|applet|noframes|noscript|noembed)(?:\s+(?:"[\S\s]*?"|'[\S\s]*?'|(?:(?!\/>)[^>])?)+)?\s*>)[\S\s]*?<\/\1\s*(?=>))|(?:\/?[\w:]+\s*\/?)|(?:[\w:]+\s+(?:"[\S\s]*?"|'[\S\s]*?'|[^>]?)+\s*\/?)|\?[\S\s]*?\?|(?:!(?:(?:DOCTYPE[\S\s]*?)|(?:\[CDATA\[[\S\s]*?\]\])|(?:--[\S\s]*?--)|(?:ATTLIST[\S\s]*?)|(?:ENTITY[\S\s]*?)|(?:ELEMENT[\S\s]*?))))>/g;

  if (regex.test(string)) {
    return "nice try lmao";
  }

  return string.replace(regex, "");
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

echo command could expose app for script injection sort of...

1 participant