RalphTro / epcis-event-hash-generator

ALGORITHM and SOFTWARE PROTOTYPE to uniquely identify/validate the integrity of any EPCIS event through a common, syntax-agnostic approach based on hashing. Takes an EPCIS Document (formatted in either XML or JSON-LD) and returns the corresponding hash value(s).
MIT License
8 stars 4 forks source link

Ordering issue for child elements such as bizTransactionList, sourceList, and destinationList #80

Closed ShaikDayan closed 1 year ago

ShaikDayan commented 1 year ago

Hello Everyone, While testing and comparison we came across this issue Currently pre-hash string generate bizTransaction/source/destination first and then the type which is not correct. As per the GS1 standards https://ref.gs1.org/standards/cbv/#page=96 we need to have type first.

Example

biztransactionList (biztransaction,type) Current Prehashing behaviour: biztransaction&type

Expected Prehashing behaviour: type&biztransaction

RalphTro commented 1 year ago

Dear @ShaikDayan ,

Thanks a lot for making us aware of this issue! You are correct.

@Echsecutor: e.g. when I executed the epcis even hash generator for one of our existing examples (in this case, "epcisDocWithShippingAndTransportingEvent" (no matter which of the two file extensions), the following pre-hash-string is returned: ...

bizTransactionList
bizTransaction=urn:epcglobal:cbv:bt:4012345000009:ASN1099
type=https://ref.gs1.org/cbv/BTT-desadv

... At the same time, typeshould appear prior to the corresponding bizTransactionID. (BTW: I am pretty sure that this worked fine in a previous release.)

Would you mind having a look into this matter once you have some bandwidth?

Many thanks and kind regards, Ralph

dakbhavesh commented 1 year ago

Dear @RalphTro, Came across this one while I was trying to understand various reported issues. I thought it will be quick for me to verify the history of PROP_ORDER. Below is the screenshot history which shows that the property order was altered for attributes of source list, destinationList, etc. however it looks like the order was kept as is or may be reversed during the course of drafting the CBV/EPCIS 2.0 standard.

Screenshot 2023-01-25 at 5 17 21 PM

I am happy to take the issue up and fix the property order to match it with https://ref.gs1.org/standards/cbv/#page=96.

FYI: @ShaikDayan

RalphTro commented 1 year ago

Dear @dakbhavesh , Thanks! Good catch. Yes, I think reversing it (again) should do the trick. @Echsecutor: do you remember the reason why the property order was adjusted back then? If not, I think that this was just an oversight which e.g. Bhavesh can easily fix. Kind regards, Ralph

ShaikDayan commented 1 year ago

Dear @RalphTro, I tried to change in PROP_ORDER but still the issue persists, I believe we need to make few change in the code currently looking into it. Regards, Dayan

RalphTro commented 1 year ago

Sebastian + Ralph as reviewer

Echsecutor commented 1 year ago

The problem here seems to be that type is an attribute of biztransaction which also has a value. We need to check what the expected pre hash string exactly is in this case

RalphTro commented 1 year ago

Can be closed from my POV (as also confirmed by @dakbhavesh).

Many thanks again for the related PR!