gkellogg / rdf-distiller

Translate any RDF format to any other using Ruby RDF gems

Home Page:http://rdf.greggkellogg.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Internal server error on invalid input (circular itemrefs)

Janpot opened this issue · comments

<div itemscope>
  <div id="ref">
    <div >friend1</div>
    <div  itemscope>
      <div >friend2</div>
      <div  itemscope itemref="ref"></div>
    </div>
  </div>
</div>

This is invalid but crashes the server

I updated it to version 1.1.9, which includes a fix to the Microdata processor to look for such recursion. Thanks! Turn on validation to see the error.

(Also added as a negative syntax test to the Microdata to RDF test suite).

I might be wrong but it seems like the 'microdata to rdf' algorithm doesn't check for circular structures while the 'microdata to json' algorithm does. The microdata spec prohibits circular structures though.

I solved it for me by adding an 'ancestors' array to the context in here.

Thanks for updating the suite, I run my parser to it too.

Microdata to RDF mostly defers to the Microdata spec for processing, and it does have such checks. However, these are now in the JSON processing steps, so some amount of developer license is necessary. A formal spec would likely need to add clarity. A test will help ensure that known pathological cases are detected.

We should have a wiki on the w3c Microdata-RDF repo to catalog implementations, and perhaps, collect implementation reports.