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

Log an explicit error message when the server returns a 414 URI Too Long status #224

Open
ggrossetie opened this issue Feb 17, 2021 · 4 comments
Labels
👶 good first issue Good for newcomers 🍩 enhancement New feature or request 👋 help wanted

Comments

@ggrossetie
Copy link
Member

Most Web servers have a URI limit to prevent Denial-of-Service or malicious attacks (i.e., buffer overflow/high memory usage...).

According to RFC 2616 (Hypertext Transfer Protocol HTTP/1.1) section 3.2.1, the server should return 414 (Request-URI Too Long) status if a URI is longer than the server can handle.

It's also important to note that browsers also have a URI limit. Having said that, and if we exclude IE, the lowest value is 10240 on Edge 16. This value is relatively high and we should not exceed it.
For reference, the current URI limit on https://kroki.io is 4000.

Anyway, if the Kroki server returns a 414 URI Too Long status, we could log an explicit error message to suggest how to resolve this issue. Potential workarounds:

  • Increase the URI limit on the server (not currently possible, see Make the max URI length configurable on Vert.x (using configuration) yuzutech/kroki#555)
  • Use kroki-fetch-diagram to download (and save on the disk) images from the Kroki server. This extension will use a POST request to download images if the URI length is greater than kroki-max-uri-length (it's also possible to force POST requests using kroki-http-method attribute with the value post).
@ggrossetie ggrossetie added the 🍩 enhancement New feature or request label Feb 17, 2021
@lind
Copy link

lind commented Mar 6, 2021

Agree it would be fine to have a log message for this @Mogztter

I have tried to find a way of intercepting the 414 response in Vertx but unfortunately haven't found a way so far.
The TooLongFrameException from Netty is handled in Http1xServerConnection but I don't find a way to add a interceptor or handler to the Vertx router in any way. Any idea?

@ggrossetie
Copy link
Member Author

I have tried to find a way of intercepting the 414 response in Vertx but unfortunately haven't found a way so far.
The TooLongFrameException from Netty is handled in Http1xServerConnection but I don't find a way to add a interceptor or handler to the Vertx router in any way. Any idea?

In my opinion, we don't need to add an interceptor/handler server-side, a 414 status code is already explicit.
My idea was to log an explicit message in the Asciidoctor Kroki extension when the status code is 414.

@lind
Copy link

lind commented Mar 6, 2021

In my opinion, we don't need to add an interceptor/handler server-side, a 414 status code is already explicit.
My idea was to log an explicit message in the Asciidoctor Kroki extension when the status code is 414.

Of course! Jumped here from yuzutech/kroki#555 so I was still in Kroki server world 😉

@Riduidel
Copy link

I thinkit would be nice to have that error reporting done for all errors, since I sometimes have diagrams silently not rendered (see Riduidel/aadarchi#333)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👶 good first issue Good for newcomers 🍩 enhancement New feature or request 👋 help wanted
Projects
None yet
Development

No branches or pull requests

3 participants