Skip to content

Security: dev365code/aas-submodel-validate

SECURITY.md

Security

Report vulnerabilities via GitHub's private reporting on this repository.

The validator's own attack surface is the files it reads: AASX (ZIP/OPC) containers and AAS JSON/XML from arbitrary suppliers. Inputs are treated as hostile — parsing failures become findings, not crashes, and the test suite carries deliberately broken containers and documents. What this reader takes in is bounded: one document at 64 MiB, and a container's parts at 64 MiB each and 256 MiB together — so a container may deliver four times what a bare document may. The total is asked of what has been read so far, before each next part is decompressed -- so a container stops costing once it is past the bound, having read the part that crossed it: the ceiling in practice is the bound plus one part, and what it buys is that the cost cannot keep growing. A part counts once however many relationships name it.

--template reads a second file, and it is bounded separately because it is a separate file: the same 64 MiB, and additionally a limit of ten thousand rows on what the template may declare. The row limit is not decoration. Bytes do not bound the work a template costs — rows do, and a template of 46 MiB sits comfortably inside the byte bound while declaring far more rows than anything published. A template above the byte limit is refused before it is parsed -- the reader stops at the bound, so what it holds is bounded by the limit and not by the size of the file; one above the row limit is refused at the row that crosses it, so what a template can cost is bounded by ten thousand rows rather than by its size. Both leave at the exit code that means the input could not be judged. A container's directory of names is bounded too, at 16 MiB, and separately: a ZIP is indexed whole before any of it is read, so the cost falls on how many names the archive declares rather than on what its entries hold — an archive of 800,000 empty entries weighed 69 MiB on disk and 523 MiB in memory, and was otherwise perfectly conformant. One bound is not about bytes at all: a document that nests more than 200 levels deep is refused before it is parsed -- JSON or XML, bare or a part in a package -- by one scan that keeps its place in memory rather than on the stack. Before it, how deep a document could nest was the machine's limit, the interpreter's stack, which the browser's build of Python reaches far sooner than the command line's; the bound is this reader's, and the answer the same wherever it runs. What the bound does not cover: the memory a parse then costs, which is a multiple of the bytes read. What it refuses to read, it does not judge, and the report says so; where nothing could be judged, the run leaves by the could-not-run exit code rather than reporting a verdict it does not have. Validation performs no network access.

What a bug report carries, and what it does not. smtv FILE --bug-report writes a diagnostic bundle for that run: it prints a summary of it, writes it where you ran the check, and sends nothing; --show-bundle prints all of it and writes nothing. It carries the shape of the file -- its size and SHA-256, and for each member of a package its size and compressed size, compression method and flags as the archive declares them, the length of its name and which earlier member has the same one, never the name -- what the run said by rule id and count, the release, metamodel library, Python, operating system and console encoding it ran on, the options it was given by name, the names but not the values of the environment variables that change how it writes, and a sentence of your own if you add one with --note. It does not carry a member's name, a file path, an idShort, an identifier or a value from the file, a finding's message, subject, detail or remedy, any byte of the document or of a file the package holds, a ZIP comment or what an extra field holds, or a user or host name. What it reads again to describe the file is held to the bounds the run holds the file to. When this tool fails on a file with an error of its own, it writes the same bundle without being asked, adding the error's type, where in this tool it happened and a SHA-256 of its message -- which, for a message as short as a missing key's name, can be checked against a guess -- says so, and then stops as it always has; --no-bundle stops the writing. After the report on an input this reader refused -- a package or a document it would not take in, or a rule that could not run for any reason but running out of memory -- one sentence says how to report it.

From 0.3.0 on, a security fix that ships in a release has a GitHub security advisory on this repository, naming the versions it reaches and the release that fixes it, and one earlier fix has one as well:

  • GHSA-m8g8-xjhr-x529: a DTD refused at any smaller size could be processed in an oversized UTF-16 relationships part. 0.1.3 and 0.1.4; fixed in 0.1.5.
  • GHSA-8w4g-mg5q-c4m4: a control sequence in a file-supplied idShort reached the terminal through the summary line. 0.4.0 to 0.5.1; fixed in 0.6.0.

Two earlier repairs have a changelog entry only, and no advisory: 0.1.3, where an LZMA member with one byte changed crashed the reader with nothing on its output, and four thousand submodels in 5.4 MB took minutes of CPU; and 0.2.0, where an archive naming one part twice was read past the duplicate and could pass as complete.

Learn more about advisories related to dev365code/aas-submodel-validate in the GitHub Advisory Database