Skip to content

Conversation

midchildan
Copy link

Issue

Unrelated websites can issue requests to register/modify shortlinks.

How to reproduce

  1. Run go on localhost:8067
  2. Access https://jsfiddle.net/tcm5vjwy/
  3. Shortlink :1 is set to https://example.com without any user interaction

The fix

  • Attach an X-Requested-With header in client requests
  • Make sure client POST requests have a content type of "application/json"

Added two mitigations for this issue:

- Attach an 'X-Requested-With' header in client requests
- Make sure client POST requests have a content type of "application/json"
@midchildan
Copy link
Author

I initially wrote the server side checks to mandate X-Requested-With be set to XMLHttpRequest, but I've now relaxed it a bit to accept any non-empty value.

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.

1 participant