Commit e9a7d7c
committed
fix(security): enforce user base path on all request paths
JoinBasePath returned the request path unchanged whenever it started
with "/". Since FixAndCleanPath always prepends "/", that branch
matched every request, so the user's base path was never applied and
only the exact path "/" was rebased (by User.JoinPath).
A user restricted to a base path could therefore address any path in
the tree: with the built-in guest/general role scope of "/", a guest
confined to /public could list and download other storages by
requesting their absolute paths. It also broke normal navigation for
such users, since entering a subfolder resolved to the real root
instead of a path under the base.
Restore the join. Regression introduced in 6b2d81e (#9249).
Covered by tests asserting that non-root request paths are rebased and
that relative segments are still rejected.1 parent aead76e commit e9a7d7c
2 files changed
Lines changed: 33 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | 92 | | |
99 | 93 | | |
100 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
0 commit comments