Uint8Array views that fail Buffer.isBuffer; READ/CLOSE/FSTAT/WRITE/READDIR were rejecting every request with SSH_FX_FAILURE. Add sftpHandleId() using DataView. OPEN: fix inner try indentation. CHANGELOG: note handle decoding + earlier SFTP hardening (vfs normalize, enqueueSftpReply, Protocol/SFTP DATA coerce).
10 lines
1.3 KiB
Markdown
10 lines
1.3 KiB
Markdown
# Changelog
|
|
|
|
## Unreleased
|
|
|
|
- **SFTP stability:** Harden `REQUEST.READ` parsing in vendored `bare-ssh2` (`handle` / `offset` / `len` must be defined before emit). Align `WRITE` and `FSETSTAT` guards with other handle-based handlers.
|
|
- **Bare OS SFTP shim:** `enqueueSftpReply` now takes `reqid` and sends `SSH_FX_FAILURE` if the queued handler throws or rejects, avoiding stalled clients and reducing risk of uncaught SFTP-path errors surfacing as native aborts (`bad_optional_access` under `-fno-exceptions`) after the serialized-reply ordering change.
|
|
- **SFTP DATA / channel binary:** Coerce `Uint8Array` (and other typed views) to `Buffer` in `SFTP.prototype.data` and `Protocol.channelData` / `channelExtData`. VFS-backed file buffers are often typed arrays; treating them as UTF-8 strings when `Buffer.isBuffer` is false corrupted SSH channel packets and could abort the runtime with `bad_optional_access`.
|
|
- **SFTP OPEN/READ:** Normalize `vfs.readFile` results to `Buffer` before storing handles; treat empty buffer as readable (`!f.buf` wrongly failed for `""` / edge cases). READ accepts `Buffer` or typed views after WRITE.
|
|
- **SFTP handles:** Decode inbound file/dir handles with `DataView` when bare-ssh2 passes `Uint8Array` / safer-buffer slices that fail `Buffer.isBuffer` — READ/CLOSE/FSTAT/WRITE/READDIR no longer always return SSH_FX_FAILURE on Bare.
|