clarus-proxy / proxy

The proxy component
Other
2 stars 3 forks source link

Error while using proxy for e-health anonymization #14

Open rmulero opened 7 years ago

rmulero commented 7 years ago

I'm having some troubles for inserting data into the database using the proxy on anonymization mode. Although the proxy runs properly and I can connect to the databse, when I run the script for creating the tables and insert the data, the following exception appears in my proxy console:

10:18:40.425 WARN - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception. io.netty.handler.codec.DecoderException: io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1 at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98) ~[netty-all-4.1.4.Final.jar:4.1.4.Final] at eu.clarussecure.proxy.protocol.plugins.pgsql.message.PgsqlMessageHandler.channelRead(PgsqlMessageHandler.java:79) ~[proxy-plugin-pgsql-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) ~[netty-all-4.1.4.Final.jar:4.1.4.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358) ~[netty-all-4.1.4.Final.jar:4.1.4.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350) ~[netty-all-4.1.4.Final.jar:4.1.4.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) ~[netty-all-4.1.4.Final.jar:4.1.4.Final] at eu.clarussecure.proxy.protocol.plugins.pgsql.message.PgsqlMessageHandler.channelRead(PgsqlMessageHandler.java:79) ~[proxy-plugin-pgsql-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) ~[netty-all-4.1.4.Final.jar:4.1.4.Final] at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:38) ~[netty-all-4.1.4.Final.jar:4.1.4.Final] at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:363) ~[netty-all-4.1.4.Final.jar:4.1.4.Final] at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) ~[netty-all-4.1.4.Final.jar:4.1.4.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:877) [netty-all-4.1.4.Final.jar:4.1.4.Final] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) [netty-all-4.1.4.Final.jar:4.1.4.Final] at java.lang.Thread.run(Unknown Source) [na:1.8.0_151] Caused by: io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1 at io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:111) ~[netty-all-4.1.4.Final.jar:4.1.4.Final] at eu.clarussecure.proxy.spi.CString.release(CString.java:142) ~[proxy-common-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at eu.clarussecure.proxy.protocol.plugins.pgsql.message.sql.SQLSession.setTransactionErrorDetails(SQLSession.java:809) ~[proxy-plugin-pgsql-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at eu.clarussecure.proxy.protocol.plugins.pgsql.message.sql.PgsqlEventProcessor.processReadyForQueryResponse(PgsqlEventProcessor.java:8928) ~[proxy-plugin-pgsql-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at eu.clarussecure.proxy.protocol.plugins.pgsql.message.QueryResponseHandler.lambda$process$12(QueryResponseHandler.java:79) ~[proxy-plugin-pgsql-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at eu.clarussecure.proxy.protocol.plugins.pgsql.message.QueryResponseHandler.processDetails(QueryResponseHandler.java:151) ~[proxy-plugin-pgsql-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at eu.clarussecure.proxy.protocol.plugins.pgsql.message.QueryResponseHandler.processDetails(QueryResponseHandler.java:132) ~[proxy-plugin-pgsql-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at eu.clarussecure.proxy.protocol.plugins.pgsql.message.QueryResponseHandler.process(QueryResponseHandler.java:78) ~[proxy-plugin-pgsql-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at eu.clarussecure.proxy.protocol.plugins.pgsql.message.QueryResponseHandler.process(QueryResponseHandler.java:12) ~[proxy-plugin-pgsql-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at eu.clarussecure.proxy.protocol.plugins.pgsql.message.PgsqlMessageHandler.decode(PgsqlMessageHandler.java:119) ~[proxy-plugin-pgsql-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at eu.clarussecure.proxy.protocol.plugins.pgsql.message.PgsqlMessageHandler.decode(PgsqlMessageHandler.java:37) ~[proxy-plugin-pgsql-1.0.2-SNAPSHOT.jar:1.0.2-SNAPSHOT] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) ~[netty-all-4.1.4.Final.jar:4.1.4.Final] ... 13 common frames omitted

The scripts I have used are attached in the following file: scripts.zip I have tried the security policy as it is in the zip file and also using what is commented too.

Just a question, I tried running the proxy for creating a single table and insert data to it and it worked without problems so, can it be related with the database structure? The e-health case uses more than one table instead of only one.

rmulero commented 7 years ago

I have changed the database structure for using a single table instead of multiple tables and it has worked. Maybe this was the problem.

dieriver commented 7 years ago

It seems the bug involves the allowed operations for the Anonimization Module that are defined in "AnonimizationCapabilities.java"

I will contact Thierry to validate my solution.

dieriver commented 7 years ago

An initial fix is available in the commit fb395c3b6d8c3f63fa2629b25554b5343baa766e. We are waiting for the validation of this fix before merging the branch into develop