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

Bug hunt #3

Closed Echsecutor closed 4 years ago

Echsecutor commented 4 years ago

@RalphTro has found some EPCIS XML Documents for which the algorithm is not currently working. Please add example(s)!

Echsecutor commented 4 years ago

I have fixed a minor bug in https://github.com/RalphTro/epcis-event-hash-generator/commit/e36ff22745d684aab8c7f074b77e086968e9e286 . Computing hashes from prehashes was potentially in the wrong loop. (Only occured for >1 event in the same doc)

Echsecutor commented 4 years ago

Bug reproducable in test in https://github.com/RalphTro/epcis-event-hash-generator/tree/issue_3

Echsecutor commented 4 years ago
could not parse event:
<TransformationEvent><eventTime>2020-01-14T00:00:00.000+01:00</eventTime><eventTimeZoneOffset>+01:00</eventTimeZoneOffset><eventID>urn:uuid:374d95fc-9457-4a51-bd6a-0bba133845a8</eventID><errorDeclaration><declarationTime>2020-01-15T00:00:00.000+01:00</declarationTime><reason>urn:epcglobal:cbv:er:incorrect_data</reason><ns1:vendorExtension>Test1</ns1:vendorExtension></errorDeclaration><inputEPCList><epc>urn:epc:id:sgtin:4012345.011111.987</epc></inputEPCList><inputQuantityList><quantityElement><epcClass>urn:epc:class:lgtin:4012345.022222.87545GHGH</epcClass></quantityElement></inputQuantityList><outputEPCList><epc>urn:epc:id:sgtin:4012345.033333.AGHFG</epc></outputEPCList><outputQuantityList><quantityElement><epcClass>urn:epc:idpat:sgtin:4012345.044444.*</epcClass><quantity>452.0</quantity><uom>KGM</uom></quantityElement></outputQuantityList><bizStep>urn:epcglobal:cbv:bizstep:commissioning</bizStep><readPoint><id>urn:epc:id:sgln:4012345.00000.0</id></readPoint></TransformationEvent>

error: unbound prefix: line 1, column 320

i.e. <ns1:vendorExtension>Test1</ns1:vendorExtension> is the problem

Echsecutor commented 4 years ago

the problem is that the EPCISDocument tag containing the xmlns definition has been removed

Echsecutor commented 4 years ago

https://github.com/RalphTro/epcis-event-hash-generator/pull/7