{"id":16777614,"url":"https://github.com/r9295/parserkiosk","last_synced_at":"2025-11-02T09:30:42.976Z","repository":{"id":42464810,"uuid":"464550022","full_name":"R9295/parserkiosk","owner":"R9295","description":"A Proof of Concept multi-lingual test generation suite intended for parsers","archived":false,"fork":false,"pushed_at":"2022-05-01T16:19:31.000Z","size":224,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T09:32:36.022Z","etag":null,"topics":["parsers","security-tools","testing","testing-tools"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/R9295.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-28T16:03:35.000Z","updated_at":"2022-07-25T15:45:00.000Z","dependencies_parsed_at":"2022-09-26T17:31:15.562Z","dependency_job_id":null,"html_url":"https://github.com/R9295/parserkiosk","commit_stats":null,"previous_names":["r9295/parser-kiosk"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R9295%2Fparserkiosk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R9295%2Fparserkiosk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R9295%2Fparserkiosk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R9295%2Fparserkiosk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/R9295","download_url":"https://codeload.github.com/R9295/parserkiosk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239392963,"owners_count":19630926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parsers","security-tools","testing","testing-tools"],"created_at":"2024-10-13T07:25:19.751Z","updated_at":"2025-11-02T09:30:42.928Z","avatar_url":"https://github.com/R9295.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ParserKiosk: A Proof of Concept multi-lingual test generation suite intended for parsers\n[![Coverage Status](https://coveralls.io/repos/github/R9295/parserkiosk/badge.svg)](https://coveralls.io/github/R9295/parserkiosk)\n![](https://img.shields.io/github/commit-activity/w/R9295/parserkiosk?style=flat-square)\n![](https://img.shields.io/github/issues/R9295/parserkiosk?style=flat-square)\n![](https://img.shields.io/pypi/v/parserkiosk?style=flat-square)\n[![Downloads](https://pepy.tech/badge/parserkiosk/week)](https://pepy.tech/project/parserkiosk)\n![](https://img.shields.io/pypi/format/parserkiosk?style=flat-square)\n![](https://img.shields.io/badge/code%20style-black-000000.svg)\n\n### Motivation\nAfter reading this [article](https://seriot.ch/projects/parsing_json.html) and [this one](https://bishopfox.com/blog/json-interoperability-vulnerabilities), I am now paranoid and under the assumption that implementations of data serialization and deserialization have a lot of quirks that differ from language to language, and implementation to implementation.\n\nThis _could_ lead to serious security issues as applications, especially web applicatons _usually_ utilize multiple services, written in multiple languages that use the same format to communicate. \n\nReference implementations usually provide tests, but translating them from language to language is tiresome and tedious. I wanted to compose a library to generate **simple**, functional tests for multiple languages with minimal repitition. \n\n### Usage\n1. Install \n``` bash\n$ pip install parserkiosk\n```\n2. Define a ``config.yaml``\n``` yaml\n# config.yaml\n---\nimport_string: \"from my_parser import serialize, deserialize\"\nserialize_function: \"serialize\"\nde_serialize_function: \"deserialize\"\nassert_functions:\n  - my_assert_function\n```\n3. Define a yaml file prefixed with ``test_`` in the same directory as ``config.yaml``\n``` yaml\n# test_serialize.yaml\ntype: \"SERIALIZE\"\ntests:\n  test_something:\n      info: \"Example Test\"\n      input:\n        type: \"str\"\n        arg: \"hello, world\"\n      assert:\n        func: \"my_assert_function\"\n        arg: \"[\\\"hello\\\", \\\" world\\\"]\"\n```\n4. Run parserkiosk in the same directory as ```config.yaml``` and ``test_serialize.yaml``\n``` bash\n$ parserkiosk . --builtin python\n```\n5. See output directory ```tests/```\n``` bash\n$ ls tests/\ntest_serialize.py\n```\n\n\n#### See [HOWTO](HOWTO.md) for a complete guide.\n\n### How does it work?\nParserkiosk uses ``jinja2`` templates to generate test cases from ``yaml`` file(s). You can either expect something to fail(raise an \"exception\" or \"error\") or use a function that you define in a special file called ```commons``` to assert if the parsed data matches the expected internal representation. \n\nLet's say you've written a reference implementation of your data de/serialization format in ``Go`` and I wanted to implement it in ``Python``.  \nAll I would need to do to implement your test-suite is:\n1. Write a ```commons.py``` file implementing the same assertion functions that you've written in your ``commons.go`` file\n2. Adapt your parserkiosk config to use my implementation\n3. Run ```$ parserkiosk folder_with_yaml_test_files/ --builtin python``` and _voila_ I have your entire test suite implemented!\n\nFor more on this, see ```examples/json/```\n\n### Languages supported\n- [x] Python / pytest / ``python``\n- [x] NodeJS / jest (sync) / ``node_js``\n- [x] Ruby / rspec / ``ruby``\n- [ ] Lua \n- [ ] Go\n- [ ] Java\n- [ ] PHP\n- [ ] Perl\n- [ ] ...\n\n### FAQ\n#### See [FAQ](FAQ.md) \n\n### License\nAll work is licensed under ```GPL-3.0``` excluding the example JSON test-suite which is licensed under ```MIT```\n\n### Contributing\nIssues, feedback and pull requests are welcome. I have tried _my best_ to keep the code simple. Please keep in mind that I wish to limit features that we accomodate to keep it simple. Tests should be simple and readable.\n\n### Installing for development\n``` bash\n$ git clone https://github.com/you/your-fork-of-parserkiosk.git\n$ cd your-fork-of-parserkiosk\n$ poetry install\n$ poetry run pre-commit install\n# do some changes\n$ ./runtests.sh\n# you are ready!\n```\n### Thanks\nSpecial thanks to [nst](https://github.com/nst/) for inspiring Parserkiosk. All test cases in ``examples/json`` come from his [incredible work](https://github.com/nst/JSONTestSuite)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr9295%2Fparserkiosk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr9295%2Fparserkiosk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr9295%2Fparserkiosk/lists"}