Skip to content

onlyworlds 0.158.5

Choose a tag to compare

@github-actions github-actions released this 28 Nov 13:04
· 16 commits to main since this release
  • Fixed: a folder writer no longer writes outside its folder for an element id that holds a path; such an id is refused. An element whose name gives no slug is written as <id>.json, so an id such as ../../x, from an export or a server, wrote a file outside the folder it was asked to write. write_folder now refuses, whatever the name and before anything is written, an element id that is empty (it would be the hidden file .json), holds / or \, holds a colon (on Windows D:x.json is a path on drive D), holds a control character (U+0000 to U+001F), or is . or ..: ValueError: character element id "../../x" cannot be a file name: it holds a path separator, / or \. Behind that rule, a second guard refuses any file whose path would not lie inside its folder: in write_folder (inside its type folder, both in the temp folder it writes and in the folder that temp folder becomes), in write_bundle (the OKF export, whose files are named from ids) and for the LegendKeeper import's board records. Every writer that names files by id goes through these: write_folder, export_world, export_okf and the Kanka, Campfire, LegendKeeper, Notion and World Anvil imports. The world's id names no path and is not checked. The cases are in tests/fixtures/unsafe-ids.cases.json, which the npm SDK's folder writer is held to as well.