• exec/webfileindex.ssjs

    From Rob Swindell (on Windows 11)@VERT to Git commit to main/sbbs/master on Mon Jun 1 22:25:27 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/d777bda5c58ee28593e539b2
    Modified Files:
    exec/webfileindex.ssjs
    Log Message:
    webfileindex: deflect crawlers from ?view= to prevent OOM crash

    The per-file ?view= path renders archive listings/images and explodes the crawlable URL space, while the index materializes the entire file_area on
    each request -- a large allocation in the 32-bit mozjs185 JS heap.
    Aggressive bots ignore robots.txt (webv4 already sends Disallow: /) and walk thousands of these, exhausting the heap; mozjs185 then turns the allocation failure into an access violation (0xc0000005 in mozjs185-1.0.dll) that
    crashes the whole in-process server (sbbsctrl) instead of a catchable JS OOM exception. Crashed sbbsctrl.exe on vert twice (5/29 + 6/1), each correlated with a "webfileindex.ssjs line 299: out of memory" web-log entry from a
    crawler hitting /files/...?view=...

    Deflect known crawler User-Agents with a cheap 429 *only* on ?view=
    requests, before any file_area access. Bots can still index directory
    listings; real browsers are unaffected. Stopgap until the SM128/64-bit migration, where OOM is catchable.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Wed Jul 29 20:43:50 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/3957d2aee3c84479ae2339e1
    Modified Files:
    exec/webfileindex.ssjs
    Log Message:
    webfileindex: quote the interpolated URL attributes

    Three attributes interpolated a filename into an unquoted value: the
    file-view href, the download href, and the image src that view_image()
    emits.

    The view href was the worst of them, because its opening quote sat on the
    wrong side of the ?view= token:

    <a href=?view="somefile.zip" title='View'>

    A parser reading an unquoted attribute value takes everything up to the
    first whitespace, so href became ?view="somefile.zip" - quotes included -
    which browsers then request as ?view=%22somefile.zip%22. Both forms
    resolve to the same archive listing, so every viewable file had two working URLs and crawlers walked both: 14,067 of one day's 20,583 ?view= requests
    on this host were the quoted duplicate.

    The other two were merely unquoted. encodeURIComponent leaves ' unencoded,
    and an apostrophe is not legal in an unquoted attribute value, so both
    relied on parser leniency. There is a real instance here: JAIL'M.ZIP in Cyber.Xpo.95/GOVWATCH rendered as href=JAIL'M.ZIP. Of 1412 file
    directories, 8 filenames contain a character encodeURIComponent leaves
    alone that an unquoted attribute disallows, and one of those is viewable.

    Spaces were never at risk in any of the three - encodeURIComponent had
    already turned them into %20, so nothing terminated the value early - and
    they still work; no URL that worked before stops working. Verified that the directory index still renders and that JAIL'M.ZIP both views and downloads.

    One unquoted attribute is left alone deliberately: the static href=http://www.synchro.net in the footer interpolates nothing, so its value cannot vary.

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Sun Sep 20 03:31:33 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/12504437d6e893524b5f72be
    Modified Files:
    exec/webfileindex.ssjs
    Log Message:
    webfileindex: serve archive listings from the content store

    view_archive() re-enumerated the archive on every request. It now reads the per-area content store, extracting and storing only on a miss, so a crawl of the file base pays for each archive once rather than once per view.

    Archive entry names are now HTML-encoded. Those names come from inside the archive, where ILLEGAL_FILENAME_CHARS does not constrain them, so an entry named with markup was written into the page as-is. File-base names elsewhere
    on the page are unaffected, since < > and " are illegal in those.

    'arc' joins the viewable-archive list. libarchive cannot read the format at all, so the web reported "Non-viewable file type" for every one of them and never reached the extraction path; the store's external-tool fallback lists them.

    #1247

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Mon Sep 21 22:21:21 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/cc328fcea5c7d4b48e7ccb6a
    Modified Files:
    exec/webfileindex.ssjs
    Log Message:
    webfileindex: encode archive entry names as text rather than as ANSI

    An entry name came from inside the archive and went through
    html_encode() with the ANSI and Ctrl-A conversions left enabled, so
    every listing row was wrapped in a hard-coded inline color span (black background, overriding the dark-mode style sheet), and an ESC or Ctrl-A
    in a name was rendered as markup rather than escaped.

    Extended ASCII was converted to numeric character references, which is
    correct for the CP437 names in a DOS-era archive but mangles a name a
    modern tool wrote in UTF-8: every byte of the sequence became a separate
    CP437 entity.

    Encode with only the HTML escaping enabled, then convert CP437 to UTF-8
    the way this script already does for file descriptions, skipping the
    conversion when the name is valid UTF-8 already. That is the test
    newsutil.js applies to a message body.

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Thu Nov 19 09:20:50 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/87101559123c80dfa9c3e542
    Modified Files:
    exec/webfileindex.ssjs
    Log Message:
    webfileindex.ssjs: escape file descriptions in the listing

    A file's description and extended description were written into the
    directory listing page as they are stored. Both are text the uploader
    types, so markup in one was rendered by the browser of anyone viewing
    that listing. They now go through html_encode() first, as the archive
    contents on the view page already do. File names were not affected:
    the characters that matter are not allowed in them.

    Part of #1363; the download headers described there are a separate
    change in the web server.

    Checked: the escaping on sample text under jsexec (markup shown as
    text, CP437 line drawing and the extended description's line breaks
    kept), and a live directory listing viewed by the sysop.

    Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net