Skip to content

Add tests for files, tls, system and machine-media #6

Closed

Description

@nixfred

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).

Activity

  1. added a commit that references this issue on Nov 14, 2026
  2. MyOwnDataCenter commented on Nov 14, 2026

    @MyOwnDataCenter
    Owner

    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.


    Generated by Claude Code

  3. nixfred commented on Nov 14, 2026

    @nixfred
    CollaboratorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions