{"id":18694128,"url":"https://github.com/mischau8/rtt-fuzzer","last_synced_at":"2025-04-12T06:54:21.587Z","repository":{"id":190618490,"uuid":"682987217","full_name":"MischaU8/rtt-fuzzer","owner":"MischaU8","description":"Fuzzer for Rally the Troops!","archived":false,"fork":false,"pushed_at":"2025-01-13T15:25:34.000Z","size":65,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T06:54:16.067Z","etag":null,"topics":["boardgames","fuzzing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MischaU8.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-25T10:27:21.000Z","updated_at":"2025-04-09T09:24:07.000Z","dependencies_parsed_at":"2023-11-23T04:38:56.638Z","dependency_job_id":"4e622227-c320-4eeb-88af-a6e293e74b76","html_url":"https://github.com/MischaU8/rtt-fuzzer","commit_stats":{"total_commits":40,"total_committers":1,"mean_commits":40.0,"dds":0.0,"last_synced_commit":"0e7af3c6ae2b61a2a02a4a1dfbcd63f714a505a1"},"previous_names":["mischau8/rtt-fuzzer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MischaU8%2Frtt-fuzzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MischaU8%2Frtt-fuzzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MischaU8%2Frtt-fuzzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MischaU8%2Frtt-fuzzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MischaU8","download_url":"https://codeload.github.com/MischaU8/rtt-fuzzer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530587,"owners_count":21119595,"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":["boardgames","fuzzing"],"created_at":"2024-11-07T11:08:16.596Z","updated_at":"2025-04-12T06:54:21.566Z","avatar_url":"https://github.com/MischaU8.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rtt-fuzzer\n\nFuzzer for [Rally The Troops!](https://rally-the-troops.com/) boardgame rules.\n\nIt uses [Jazzer.js](https://github.com/CodeIntelligenceTesting/jazzer.js/) as a coverage-guided, in-process fuzzer for node.js.\n\n## What is fuzzing?\n\nFuzzing or fuzz testing is an automated software testing technique that involves providing invalid, unexpected, or random data as inputs to a computer program. With rtt-fuzzer you can test the rules for any RTT module. It will play random moves and check for unexpected errors.\n\nCurrently rtt-fuzzer can detect the following errors:\n* A game taking an excessive number of steps, this could indicate infinite loops and other logical flaws in the rules. This is configurable via the `MAX_STEPS` environment variable, set it to a positive value to crash and to a negative value to skip \u0026 ignore.\n* Dead-end game states where no other actions are available (besides `undo`).\n* Any crashes of the rules.js module\n\n## Quickstart\n\nTo use `rtt-fuzzer` to fuzz any RTT module follow these few simple steps:\n\n1. Install  dependency\n\n```\nnpm install\n```\n\n2. Start the rtt-module fuzzer:\n\n```\nRTT_RULES=../server/public/field-cloth-gold/rules.js npx jazzer rtt-module\n```\n\nYou can specify the RTT `rules.js` file with the `RTT_RULES` environment variable, it uses `rules.js` from the current directory by default.\n\n3. Enjoy fuzzing!\n\n## Example output\n\nThe following output shows a potential bug in the `move_persian_army` function of `300-earth-and-water/rules.js`:\n\n```\n$ RTT_RULES=../server/public/300-earth-and-water/rules.js npx jazzer rtt-module\nLoading rtt-fuzzer RTT_RULES='../server/public/300-earth-and-water/rules.js' with MAX_STEPS=2048\nINFO: New number of coverage counters 1024\nINFO: New number of coverage counters 2048\nDictionary: 4 entries\nINFO: Running with entropic power schedule (0xFF, 100).\nINFO: Seed: 1668133216\nINFO: Loaded 3 modules   (2048 inline 8-bit counters): 512 [0x148050000, 0x148050200), 512 [0x148050200, 0x148050400), 1024 [0x148050400, 0x148050800),\nINFO: Loaded 3 PC tables (2048 PCs): 512 [0x1124b4000,0x1124b6000), 512 [0x1124b6000,0x1124b8000), 1024 [0x1124b8000,0x1124bc000),\nINFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes\n\nGAME { seed: 1, scenario: 'Standard', options: {} }\nVIEW {\n  log: [\n    'Start Campaign 1',\n    '',\n    'Persian Preparation Phase',\n    'Persia bought 6 cards.',\n    'Persia raised:\\n 6 armies in Abydos',\n    '.hr',\n    'Greek Preparation Phase',\n    'Greece bought 6 cards.',\n    'Greece raised:\\nnothing.',\n    '.hr',\n    'Persia played card 10 for movement.',\n    'Persia moved p armies:\\nAbydos to E.'\n  ],\n  active: 'Persia',\n  campaign: 1,\n  vp: 0,\n  trigger: {\n    darius: 0,\n    xerxes: 0,\n    artemisia: 0,\n    miltiades: 0,\n    themistocles: 0,\n    leonidas: 0,\n    hellespont: 0,\n    carneia_festival: 0,\n    acropolis_on_fire: 0\n  },\n  units: {\n    Abydos: [ 0, NaN, 0, 0 ],\n    Athenai: [ 1, 0, 1, 0 ],\n    Delphi: [ 0, 0 ],\n    Ephesos: [ 0, 2, 0, 1 ],\n    Eretria: [ 0, 0, 0, 0 ],\n    Korinthos: [ 1, 0 ],\n    Larissa: [ 0, 0 ],\n    Naxos: [ 0, 0, 0, 0 ],\n    Pella: [ 0, 0, 0, 0 ],\n    Sparta: [ 1, 0, 1, 0 ],\n    Thebai: [ 0, 0, 0, 0 ],\n    reserve: [ 6, 14, 3, 5 ]\n  },\n  g_cards: 6,\n  p_cards: 5,\n  discard: 10,\n  deck_size: 4,\n  discard_size: 1,\n  prompt: 'Persian Land Movement: Select armies to move and then a destination.',\n  land_movement: 'Abydos',\n  actions: { city: [ 'Ephesos' ] },\n  hand: [ 4, 1, 8, 2, 3 ],\n  draw: 0\n}\nSTEP=24 ACTIVE=Persia ACTION: city \"Ephesos\"\nSTATE dumped to 'crash-state.json'\n\n==63262== Uncaught Exception: Jazzer.js: TypeError: Cannot read properties of undefined (reading '1')\nTypeError: Cannot read properties of undefined (reading '1')\n    at move_persian_army /home/user/projects/rtt/server/public/300-earth-and-water/rules.js:448:12)\n    at Object.city (/home/user/projects/rtt/server/public/300-earth-and-water/rules.js:1159:3)\n    at Object.action (/home/user/projects/rtt/server/public/300-earth-and-water/rules.js:3448:12)\n    at module.exports.fuzz (/home/user/projects/rtt/rtt-fuzzer/rtt-module.js:65:27)\n    at result (/home/user/projects/rtt/rtt-fuzzer/node_modules/@jazzer.js/core/core.ts:357:15)\nMS: 0 ; base unit: 0000000000000000000000000000000000000000\n\n\nartifact_prefix='./'; Test unit written to ./crash-da39a3ee5e6b4b0d3255bfef95601890afd80709\nBase64:\n```\n\n## What does the status output mean?\n\n```\n#2\tINITED cov: 387 ft: 387 corp: 1/1b exec/s: 0 rss: 151Mb\n#3\tNEW    cov: 408 ft: 490 corp: 2/2b lim: 4 exec/s: 0 rss: 151Mb L: 1/1 MS: 1 ChangeBinInt-\n#4\tNEW    cov: 412 ft: 532 corp: 3/3b lim: 4 exec/s: 0 rss: 151Mb L: 1/1 MS: 1 ChangeBinInt-\n#6\tNEW    cov: 417 ft: 555 corp: 4/5b lim: 4 exec/s: 0 rss: 151Mb L: 2/2 MS: 2 ShuffleBytes-InsertByte-\n```\n\nSee the LibFuzzer documentation for more details on the output\nhttps://llvm.org/docs/LibFuzzer.html#output\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmischau8%2Frtt-fuzzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmischau8%2Frtt-fuzzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmischau8%2Frtt-fuzzer/lists"}