Repository navigation
sftp: confine REALPATH, refuse unsafe roots - #1387
Open
ejohnstown wants to merge 2 commits into
Open
ejohnstown wants to merge 2 commits into
ejohnstown wants to merge 2 commits into
Conversation
Contributor
Author
|
@claude review |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1387
Scan targets checked: wolfssh-src, wolfssh-bugs
Coverage: 5 of 6 in-scope changed file(s) opened by the reviewer; not opened: wolfssh/internal.h
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Max
REALPATH now runs its answer through the same confinement check as the other path requests and answers PERMISSION_DENIED for a name outside the root. The check, split out of GetAndCleanPath as SFTP_CheckConfined, compares every byte of the root before testing the boundary. - a start path outside the root, or through a link below it, resolves as the root, so a confined session still opens - prefix compare uses wolfSSH_ConstantCompare; Windows folds ASCII case in a fixed loop - api.c: REALPATH of an escaping path and through an in-jail link Issue: F-10599, F-11669
wolfSSH_SFTP_SetConfinePath returns WS_NOT_COMPILED for any root but "/" where a link below the root cannot be refused: WOLFSSH_NO_SYMLINK_CHECK, WOLFSSH_USER_FILESYSTEM, or POSIX without O_NOFOLLOW. The root is still stored, so a caller that ignores the error keeps the lexical jail. - port.h defines WOLFSSH_NO_SFTP_CONFINE for those builds - OPEN and OPENDIR walk down from the root with O_NOFOLLOW where openat() and O_PATH or O_SEARCH exist; _GNU_SOURCE on Linux for O_PATH - wolfsftp.h states what still acts by name after the check - tests expect the refusal under WOLFSSH_NO_SFTP_CONFINE, swap in a link between check and open, and start a session outside the root Issue: F-8860, F-15661
ejohnstown
force-pushed
the
sftp-confinement
branch
from
November 11, 2026 23:37
7a0a4d2 to
241dedd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
REALPATH answers PERMISSION_DENIED outside the confinement root, and the
root compare runs in fixed time. Builds that cannot refuse a link below
the root now refuse confinement itself.
a start path outside the root resolves as the root
user filesystem or the symlink check off, but still stores the root;
OPEN and OPENDIR walk from the root with O_NOFOLLOW
Issue: F-8860, F-10599, F-11669, F-15661