[ 
https://issues.apache.org/jira/browse/CAMEL-17829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17844237#comment-17844237
 ] 

Jono Morris edited comment on CAMEL-17829 at 5/7/24 10:51 AM:
--------------------------------------------------------------

[~davsclaus] From the spec it seems the only thing that would cause a 'failure' 
disposition is a client requesting a signed receipt with non-standard 
Disposition-notification-options, e.g. something other than:

 Disposition-notification-options: 
             signed-receipt-protocol=required,pkcs7-signature; 
             signed-receipt-micalg=required,sha1,md5

Camel-as2 doesn't seem to validate these options at all, e.g. assumes 
pkcs7-signature and defaults to sha1, so such a failure will never occur. 

So the failure MDN block could be removed as it's never used, or we can read 
the attribute from HttpContext instead of the request in case disposition 
handling is improved in future e.g.  

        if (AS2DispositionType.FAILED.getType() 
                .equals(coreContext.getAttribute(DISPOSITION_TYPE))) {


was (Author: jono):
[~davsclaus] From the spec it seems the only thing that would cause a 'failure' 
disposition is a client requesting a signed receipt with non-standard 
Disposition-notification-options, e.g. something other than:

 Disposition-notification-options: 
             signed-receipt-protocol=required,pkcs7-signature; 
             signed-receipt-micalg=required,sha1,md5 

Camel-as2 doesn't seem to validate these options at all, e.g. assumes 
pkcs7-signature and defaults to sha1, so such a failure will never occur.  

So the failure MDN block could probably be removed as it's never used.

> camel-as2 - issue in MDN response condition
> -------------------------------------------
>
>                 Key: CAMEL-17829
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17829
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-as2
>            Reporter: João Miranda
>            Priority: Minor
>             Fix For: Future
>
>
> The MDN implementation has a field status that can be used to tell the 
> requester if the message was processed with success or if any error occurred.
> The default template has that field in {*}$dispositionType{*}.
>  
> {noformat}
> private static final String DEFAULT_MDN_MESSAGE_TEMPLATE = "MDN for -\n"
>                                                            + " Message ID: 
> $requestHeaders[\"Message-Id\"]\n"
>                                                            + "  Subject: 
> $requestHeaders[\"Subject\"]\n"
>                                                            + "  Date: 
> $requestHeaders[\"Date\"]\n"
>                                                            + "  From: 
> $requestHeaders[\"AS2-From\"]\n"
>                                                            + "  To: 
> $requestHeaders[\"AS2-To\"]\n"
>                                                            + "  Received on: 
> $responseHeaders[\"Date\"]\n"
>                                                            + " Status: 
> $dispositionType \n";{noformat}
>  
>  
> The issue is in the condition that determines if the MDN should be returned 
> with success status or error status:
>  
> {noformat}
> ResponseMDN.java
> if (AS2DispositionType.FAILED.getType()
>         .equals(HttpMessageUtils.getHeaderValue(request, 
> AS2Header.DISPOSITION_TYPE))) {...}{noformat}
> This condition is looking at the *request header* Disposition-Type which is 
> not correct. If the requester sends this header with *failed* the MDN will be 
> returned with failed status regardless of the execution status of the 
> receiver. 
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to