Todd,
I have started to notice that internal
data starts getting leaked when I return objects in XML format, but
returning those same objects in JSON format does not have that
(security) bug.
For example, when I utilize the same route:
server.regex(
"/db(/(?<dbName>.*))?/function/(?<inx>[0-9]+)[/\\.]{1}(?<st>[0-9]+)[/\\.]{1}(?<et>[0-9]+)([/\\.]{1}(?<format>[a-zA-Z]{3,}))?",
config.getDBController() )
.action("function", HttpMethod.GET )
.action("function", HttpMethod.POST)
.name( "Function" ) ;
If I GET from:
This is the result, as expected:
{"c":4,"ts":12,"ai":{"hs":3,"ac":1,"MAX_S":5},"MAX_AC":5}
However, if I GET from:
This is the (erroneous) result (notice the data leaking):
<HTI>
<c>4</c>
<ts>12</ts>
<ai>
<hs>3</hs>
<ac>1</ac>
<MAX__S>5</MAX__S>
<outer-class>
<config>
<port>4444</port>
<ipAddr>192.168.3.9</ipAddr>
<protocol>tcp</protocol>
<baseUrl>jdbc:mysql://192.168.3.9:4444/</baseUrl>
<username>un</username>
<password>pw</password>
</config>
</outer-class>
</ai>
<MAX__AC>5</MAX__AC>
<outer-class reference="../ai/outer-class"/>
</HTI>
Obviously, we do not want such sensitive information leaking through.
Is this a known issue? Is there a way to work around it?
Furthermore, again, my named group enhancement to your RestExpress/core/src/java/org/restexpress/url/UrlRegex.java
file is extremely beneficial, as you can see from the route definition,
above, and it greatly eases the comprehensibility of the related
controller method(s). If you would like me to check this in, just let me know how to do so.
Have a great day.
Take care,
Darwin
---------- Forwarded message ----------
From:
Darwin AirolaDate: Tue, Mar 17, 2015 at 2:54 PM
To: Todd Fredrich
Todd,
Okay,
I resolved this so that we can use named groups in our regular
expressions (when defining a regular expression based route). This only
required me to modify the
extractParameters() method in the
RestExpress/core/src/java/org/restexpress/url/UrlRegex.java file.
Would you like me to contribute those changes back to your project?Have a great day.
Take care,
Darwin
--