Fraunhofer-AISEC / ids-clearing-house-service

This is an implementation of the IDS Clearing House
Apache License 2.0
0 stars 11 forks source link

NPE in ClearingHouseOutputProcessor #9

Closed sebplorenz closed 2 years ago

sebplorenz commented 2 years ago

If the clearing-house-api does not respond with an IDS message (because of an internal issue there #8), then the ClearingHouseProcessor fails with a NullPointerException when trying to read the IDS headers from the clearing-house-api response:

2022-02-03 07:56:21.249 DEBUG 1 --- [qtp724400266-27] d.f.a.i.d.PolicyDecisionPoint            : Transformation: de.fhg.aisec.ids.api.policy.TransformationDecision@2be8a8bc
2022-02-03 07:56:21.555 ERROR 1 --- [qtp724400266-27] o.a.c.p.e.DefaultErrorHandler            : Failed delivery for (MessageId: F04AE90F7EC7B42-0000000000000001 on ExchangeId: F04AE90F7EC7B42-0000000000000001). Exhausted after delivery attempt: 1 caught: java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "org.apache.camel.Message.getHeader(String)" is null

Message History (complete message history is disabled)
---------------------------------------------------------------------------------------------------------------------------------------
RouteId              ProcessorId          Processor                                                                        Elapsed (ms)
[CH_LOG_PID        ] [CH_LOG_PID        ] [from[jetty:http://0.0.0.0:9999/messages/log/%7Bpid%7D?httpMethodRestrict=POST]] [       561]
        ...
[CH_ROUTE_LOG      ] [process4          ] [ref:responseProcessor                                                         ] [         0]

Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------

java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "org.apache.camel.Message.getHeader(String)" is null
   at de.fhg.aisec.ids.clearinghouse.ClearingHouseOutputProcessor.process(ClearingHouseOutputProcessor.java:58) ~[clearing-house-processors.jar:na]
kragall commented 2 years ago

Currently, this only happens if the Clearing House is not configured properly. The Clearing House startup has been modified. It will now check that a signing_key exists on startup. If this is not the case, it will exit with an error message