From langley at cs.fsu.edu Fri Feb 24 19:14:15 2012 From: langley at cs.fsu.edu (Randolph Langley) Date: Fri, 24 Feb 2012 14:14:15 -0500 Subject: [Owasp-hatkit-proxy-project] mongodb error message Message-ID: <4F47E187.4030300@cs.fsu.edu> While I seem to be able to use the hatkit proxy (version 0.6.3) for simple conversations, when I hit some longer, more complex requests I am getting various errors: java.lang.IllegalArgumentException: fields stored in the db can't have . in them at com.mongodb.DBCollection._checkKeys(DBCollection.java:1087) at com.mongodb.DBCollection._checkKeys(DBCollection.java:1093) at com.mongodb.DBCollection._checkKeys(DBCollection.java:1093) at com.mongodb.DBCollection._checkKeys(DBCollection.java:1093) at com.mongodb.DBCollection._checkObject(DBCollection.java:1076) at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:233) at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:217) at com.mongodb.DBCollection.insert(DBCollection.java:87) org.codehaus.jackson.JsonParseException: Unexpected character ('j' (code 106)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: [B at 7dc4cd9; line: 1, column: 2] at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1291) at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:385) at org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:306) at org.codehaus.jackson.impl.Utf8StreamParser._handleUnexpectedValue(Utf8StreamParser.java:1581) at org.codehaus.jackson.impl.Utf8StreamParser._nextTokenNotInObject(Utf8StreamParser.java:436) at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:322) at org.codehaus.jackson.JsonParser.nextValue(JsonParser.java:564) at se.swende.db.JsonToMongoEncoder.parseValue(Unknown Source) at se.swende.db.JsonToMongoEncoder.streamParse(Unknown Source) at se.swende.db.MongoMessageInterceptor.addParsedContent(Unknown Source) at se.swende.db.MongoMessageInterceptor.buildResponseObject(Unknown Source) at se.swende.db.MongoMessageInterceptor.storeResponse(Unknown Source) at se.swende.db.MongoMessageInterceptor$ConversationObserver$2.copyCompleted(Unknown Source) at org.owasp.proxy.http.MessageUtils$2.copyCompleted(MessageUtils.java:356) Thanks in advance... From martin.holst_swende at owasp.org Fri Feb 24 19:34:20 2012 From: martin.holst_swende at owasp.org (Martin Holst Swende) Date: Fri, 24 Feb 2012 20:34:20 +0100 Subject: [Owasp-hatkit-proxy-project] mongodb error message In-Reply-To: <4F47E187.4030300@cs.fsu.edu> References: <4F47E187.4030300@cs.fsu.edu> Message-ID: <4F47E63C.7090800@owasp.org> Hi, On 02/24/2012 08:14 PM, Randolph Langley wrote: > > > While I seem to be able to use the hatkit proxy (version 0.6.3) for > simple conversations, when I hit some longer, more complex requests I > am getting various errors: > > java.lang.IllegalArgumentException: fields stored in the db > can't have . in them > at com.mongodb.DBCollection._checkKeys(DBCollection.java:1087) > at com.mongodb.DBCollection._checkKeys(DBCollection.java:1093) > at com.mongodb.DBCollection._checkKeys(DBCollection.java:1093) > at com.mongodb.DBCollection._checkKeys(DBCollection.java:1093) > at com.mongodb.DBCollection._checkObject(DBCollection.java:1076) > at > com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:233) > at > com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:217) > at com.mongodb.DBCollection.insert(DBCollection.java:87) > This one occurs because one of the dynamically generated fields in the object contains ".". I fixed a similar issue in cookies [1], which cropped up when e.g. encountering cookies called "ASP.NET". The generated object would then have request.url.cookies.ASP.NET which is ambigous and therefore disallowed in MongoDB. Without looking closer at your traffic, I can't say what field is causing this. But if you find out, please let me know so I can fix it. [1]https://bitbucket.org/holiman/hatkit-proxy/changeset/a763d0c174fd > > org.codehaus.jackson.JsonParseException: Unexpected character ('j' > (code 106)): expected a valid value (number, String, array, object, > 'true', 'false' or 'null') > at [Source: [B at 7dc4cd9; line: 1, column: 2] > at > org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1291) > at > org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:385) > at > org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:306) > at > org.codehaus.jackson.impl.Utf8StreamParser._handleUnexpectedValue(Utf8StreamParser.java:1581) > at > org.codehaus.jackson.impl.Utf8StreamParser._nextTokenNotInObject(Utf8StreamParser.java:436) > at > org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:322) > at org.codehaus.jackson.JsonParser.nextValue(JsonParser.java:564) > at se.swende.db.JsonToMongoEncoder.parseValue(Unknown Source) > at se.swende.db.JsonToMongoEncoder.streamParse(Unknown Source) > at > se.swende.db.MongoMessageInterceptor.addParsedContent(Unknown Source) > at > se.swende.db.MongoMessageInterceptor.buildResponseObject(Unknown Source) > at se.swende.db.MongoMessageInterceptor.storeResponse(Unknown > Source) > at > se.swende.db.MongoMessageInterceptor$ConversationObserver$2.copyCompleted(Unknown > Source) > at > org.owasp.proxy.http.MessageUtils$2.copyCompleted(MessageUtils.java:356) > Jackson is used to parse JSON constructs. If the JSON is invalid, the error message is shown, but the dialog should be saved as usual. If the JSON-parse succeeds, the response object will have an additional node called json. >From the error above, it seems that the JSON got a 'j'-character instead of any of the listed allowed values. A json value can never start with 'j', so make sure it is in fact valid json. > > > Thanks in advance... > > You're welcome, Regards, Martin Holst Swende -------------- next part -------------- An HTML attachment was scrubbed... URL: