You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add tests for files, tls, system and machine-media #6
No test file is named for omarchyd/files.mjs (345 lines, works on the user's real home folder), omarchyd/tls.mjs (283), omarchyd/system.mjs (207) or omarchyd/machine-media.mjs (175). test/server.test.mjs may cover parts of them through the API. The web app has no tests.
Suggested first step: tests for path handling in files.mjs (../, symlinks, the Trash).
Thank you. File handling was the right place to start, and it found a real problem. Accepted in part in aefa930.
test/files.test.mjs now covers:
../, ./, NUL bytes and relative paths;
symlinks pointing out of Home, for listing, reading, creating folders and copying;
bad names;
an upload over an existing link, which replaces the link and never the file it points to;
trash and restore.
It caught a bug: a crafted .trashinfo (/home/u/../../somewhere, or a path through a symlinked folder) could restore a file outside Home. Restores are now normalised and checked with symlinks followed, and otherwise land in Home.
Since this issue was opened, tls.mjs and system.mjs also got tests (test/security.test.mjs and others). Keeping this open for machine-media.mjs, which still has none.
I am taking the machine-media.mjs tests with a pull request. One thing they have already turned up: hostnameFor can return a name that ends in a hyphen for a 64-character machine name, which is not a valid hostname. The pull request fixes that too.
Activity
0.9.12: process issues #1-#4, #6-#8
MyOwnDataCenter commentedon Nov 14, 2026
Thank you. File handling was the right place to start, and it found a real problem. Accepted in part in aefa930.
test/files.test.mjsnow covers:../,./, NUL bytes and relative paths;It caught a bug: a crafted
.trashinfo(/home/u/../../somewhere, or a path through a symlinked folder) could restore a file outside Home. Restores are now normalised and checked with symlinks followed, and otherwise land in Home.Since this issue was opened,
tls.mjsandsystem.mjsalso got tests (test/security.test.mjsand others). Keeping this open formachine-media.mjs, which still has none.Generated by Claude Code
nixfred commentedon Nov 14, 2026
I am taking the machine-media.mjs tests with a pull request. One thing they have already turned up: hostnameFor can return a name that ends in a hyphen for a 64-character machine name, which is not a valid hostname. The pull request fixes that too.