Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken, unescaped JSON data with POST Request task. #1281

Open
3 tasks done
MsVoxxie opened this issue Jan 15, 2025 · 0 comments
Open
3 tasks done

Broken, unescaped JSON data with POST Request task. #1281

MsVoxxie opened this issue Jan 15, 2025 · 0 comments
Labels

Comments

@MsVoxxie
Copy link

Operating System

Ubuntu 23.04

AMP Version and Build Date

2.6.0.6 - 20241120.1

AMP Release Stream

Mainline

I confirm that

  • I have searched for an existing bug report for this issue.
  • I am using the latest available version of AMP.
  • my operating system is up-to-date.

Intended Action

AMP's Minecraft module (and I assume others but have not tested) Send POST Request task does not sanitize it's json. When sending through an in-game chat message to said task, if the message contains quotes the json that is sent is invalid.

Example;

{"USER":"MsVoxxie","MESSAGE":""test""}
would return
SyntaxError: Unexpected token t in JSON at position 31

Expected Behaviour

I would expect AMP to escape the jsons payload as it is unreasonable to expect a user to send \"Test!\" as a message.

Actual Behaviour

AMP does not escape outgoing json data, leading to broken formatting.

Reproduction

Set up an event listener for player message and attach a send post request task to said event and send the message data as the payload, if the message contains quotes the json sends incorrectly.

@MsVoxxie MsVoxxie added the bug label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant