personium / personium-core

Core module of Personium
https://personium.io
Apache License 2.0
88 stars 16 forks source link

Some Exception that occurred in library could not be caught. #261

Open SawamiWataru opened 6 years ago

SawamiWataru commented 6 years ago

PersoniumCoreExceptionMapper can not catch, so we need to consider other means.

e.g.

curl "https://demo-fi.personium.io/sawami/__token" -X POST -i -k -d "grant_type=password&username=admin&password=password" -H "content-type: aaaaaaaaaa"

HTTP/1.1 400 Bad Request
Date: Fri, 19 Oct 2018 02:48:32 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 1033
Connection: keep-alive
Content-Language: en
Server: Personium

<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.48 - Error report</title><style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style> </head><body><h1>HTTP Status 400 - Bad Request</h1><div class="line"></div><p><b>type</b> Status report</p><p><b>message</b> <u>Bad Request</u></p><p><b>description</b> <u>The request sent by the client was syntactically incorrect.</u></p><hr class="line"><h3>Apache Tomcat/8.0.48</h3></body></html>

content-typeが不正な場合、現状のソースではPersoniumCoreExceptionでCatch出来ずに突き抜けてtomcatのエラーレスポンスが返る。 その他同様の現象が起きるエラーがないかの調査を含めて、修正する必要がある。

shimono commented 4 years ago

This occurs when a servlet container cannot receive the incoming HTTP request properly. We cannot fix this problem inside any java WebApp such as personium-core.

yoh1496 commented 2 years ago

This issue is not Personium problem. Can we close this?

yoh1496 commented 2 years ago

I implement test and confirm the response is html which is not generated by Personium.

https://github.com/yoh1496/personium-core/blob/d4efc230489bc2174b9c6636bff164834dffefbb/src/test/java/io/personium/test/jersey/cell/auth/token/TokenIssuanceTest.java#L138-L173

yoh1496 commented 2 years ago

If we can specify handle in web.xml, implement this.