Commit 8d0b480
committed
feat: Implement file transfer filtering infrastructure
Add a complete filtering infrastructure for SFTP and SCP file transfer operations:
- TransferFilter trait with check() and check_with_dest() methods
- Operation enum: Upload, Download, Delete, Rename, CreateDir, ListDir, Stat, SetStat, Symlink, ReadLink
- FilterResult: Allow, Deny, Log actions
- FilterPolicy engine with first-match-wins rule evaluation
- Matcher trait for extensible path matching
Built-in matchers:
- GlobMatcher: wildcard patterns (*.key, *.pem)
- RegexMatcher: full regex support
- PrefixMatcher: directory tree matching (/etc/*)
- ExactMatcher: specific file matching
- ComponentMatcher: match path components (.git, .ssh)
- ExtensionMatcher: file extension matching
- CombinedMatcher: OR-combine multiple matchers
- NotMatcher: invert matcher results
Configuration:
- Extended FilterConfig with default_action, rule names, operations, and users
- FilterRule supports per-user and per-operation restrictions
- YAML configuration via existing config loader
Closes #1381 parent 0862853 commit 8d0b480
6 files changed
Lines changed: 1882 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
278 | 284 | | |
279 | 285 | | |
280 | 286 | | |
| |||
285 | 291 | | |
286 | 292 | | |
287 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
288 | 300 | | |
289 | 301 | | |
290 | 302 | | |
| 303 | + | |
291 | 304 | | |
292 | 305 | | |
293 | 306 | | |
294 | 307 | | |
295 | 308 | | |
| 309 | + | |
296 | 310 | | |
297 | 311 | | |
298 | 312 | | |
299 | 313 | | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
300 | 327 | | |
301 | 328 | | |
302 | 329 | | |
303 | | - | |
| 330 | + | |
304 | 331 | | |
305 | 332 | | |
306 | 333 | | |
| 334 | + | |
307 | 335 | | |
308 | 336 | | |
309 | 337 | | |
| |||
0 commit comments