Skip to content

Commit 8b53475

Browse files
committed
Initial release: jailed-path v0.0.1
- Add PathValidator for defining jail boundaries - Add JailedPath for validated paths within jails - Add JailedPathError for comprehensive error handling - Implement zero-dependency path validation - Add cross-platform support (Windows, macOS, Linux) - Include comprehensive documentation and examples - Add CI/CD pipeline with GitHub Actions - Add local CI script for development Features: - Type-safe path validation preventing directory traversal - Path canonicalization to resolve symlinks and relative components - Simple two-type API: PathValidator and JailedPath - Rust-idiomatic error handling with JailedPathError
1 parent c3d88a0 commit 8b53475

File tree

15 files changed

+913
-21
lines changed

15 files changed

+913
-21
lines changed

.github/CODEOWNERS

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# CODEOWNERS
2+
#
3+
# This file defines code ownership for automatic reviewer assignment.
4+
# Learn more: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
5+
6+
# Global ownership - @DK26 owns everything by default
7+
* @DK26
8+
9+
# Core library code
10+
/src/ @DK26
11+
12+
# Configuration and build files
13+
/Cargo.toml @DK26
14+
/Cargo.lock @DK26
15+
16+
# Documentation
17+
/README.md @DK26
18+
/CHANGELOG.md @DK26
19+
20+
# CI/CD and GitHub configuration
21+
/.github/ @DK26
22+
23+
# License files
24+
/LICENSE-* @DK26

.github/workflows/ci.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: CI
2+
#
3+
# This workflow runs CI checks on GitHub Actions.
4+
# For local development with auto-fixing, use: bash ci-local.sh
5+
6+
on:
7+
push:
8+
branches: [ dev ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
15+
jobs:
16+
test:
17+
name: Test
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest, windows-latest, macos-latest]
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Install Rust
27+
uses: dtolnay/rust-toolchain@stable
28+
with:
29+
components: rustfmt, clippy
30+
31+
- name: Cache cargo registry
32+
uses: actions/cache@v4
33+
with:
34+
path: |
35+
~/.cargo/registry/index/
36+
~/.cargo/registry/cache/
37+
~/.cargo/git/db/
38+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-cargo-
41+
42+
- name: Cache cargo build
43+
uses: actions/cache@v4
44+
with:
45+
path: target/
46+
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
47+
restore-keys: |
48+
${{ runner.os }}-cargo-build-
49+
50+
- name: Check formatting
51+
run: cargo fmt --all -- --check
52+
53+
- name: Show formatting diff (if check failed)
54+
if: failure()
55+
run: |
56+
echo "❌ Formatting check failed. Run 'cargo fmt --all' to fix."
57+
echo "Here's what would be changed:"
58+
cargo fmt --all -- --check --verbose || true
59+
echo ""
60+
echo "To fix locally, run: cargo fmt --all"
61+
62+
- name: Run clippy
63+
run: cargo clippy --all-targets --all-features -- -D warnings
64+
65+
- name: Show clippy fixes (if check failed)
66+
if: failure()
67+
run: |
68+
echo "❌ Clippy check failed. Some issues might be auto-fixable."
69+
echo "To fix locally, run: cargo clippy --fix --allow-dirty --allow-staged --all-targets --all-features"
70+
echo "Then run: cargo clippy --all-targets --all-features -- -D warnings"
71+
72+
- name: Run tests
73+
run: cargo test --verbose
74+
75+
docs:
76+
name: Documentation
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/checkout@v4
80+
81+
- name: Install Rust
82+
uses: dtolnay/rust-toolchain@stable
83+
84+
- name: Check documentation
85+
run: cargo doc --no-deps --document-private-items --all-features
86+
env:
87+
RUSTDOCFLAGS: -D warnings
88+
89+
msrv:
90+
name: Minimum Supported Rust Version
91+
runs-on: ubuntu-latest
92+
steps:
93+
- uses: actions/checkout@v4
94+
95+
- name: Install Rust 1.70
96+
uses: dtolnay/rust-toolchain@master
97+
with:
98+
toolchain: 1.70.0
99+
100+
- name: Check with MSRV
101+
run: cargo check --verbose

.github/workflows/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
name: Publish to crates.io
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install Rust
16+
uses: dtolnay/rust-toolchain@stable
17+
18+
- name: Publish to crates.io
19+
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
20+
21+
release:
22+
name: Create GitHub Release
23+
runs-on: ubuntu-latest
24+
needs: publish
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Create Release
29+
uses: softprops/action-gh-release@v1
30+
with:
31+
tag_name: ${{ github.ref_name }}
32+
name: Release ${{ github.ref_name }}
33+
body: |
34+
## What's Changed
35+
36+
- Check the [changelog](CHANGELOG.md) for detailed changes
37+
- View the [documentation](https://docs.rs/jailed-path) for usage examples
38+
39+
**Full Changelog**: https://github.com/DK26/jailed-path-rs/compare/v0.0.1...${{ github.ref_name }}
40+
draft: false
41+
prerelease: false
42+
generate_release_notes: true

.gitignore

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
# Generated by Cargo
2-
# will have compiled files and executables
3-
debug
4-
target
5-
6-
# These are backup files generated by rustfmt
7-
**/*.rs.bk
8-
9-
# MSVC Windows builds of rustc generate these, which store debugging information
10-
*.pdb
11-
12-
# Generated by cargo mutants
13-
# Contains mutation testing data
14-
**/mutants.out*/
15-
16-
# RustRover
17-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
18-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
19-
# and can be added to the global gitignore or merged into this file. For a more nuclear
20-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
21-
#.idea/
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
debug
4+
target
5+
Cargo.lock
6+
7+
# These are backup files generated by rustfmt
8+
**/*.rs.bk
9+
10+
# MSVC Windows builds of rustc generate these, which store debugging information
11+
*.pdb
12+
13+
# Generated by cargo mutants
14+
# Contains mutation testing data
15+
**/mutants.out*/
16+
17+
# RustRover
18+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
19+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
20+
# and can be added to the global gitignore or merged into this file. For a more nuclear
21+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
22+
.idea/
23+
24+
.vscode

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.0.1] - 2025-07-16
11+
12+
### Added
13+
- Initial release of `jailed-path` crate
14+
- `PathValidator` type for defining jail boundaries
15+
- `JailedPath` type for validated paths within jail boundaries
16+
- `JailedPathError` with comprehensive error handling
17+
- Zero-dependency implementation
18+
- Cross-platform support (Windows, macOS, Linux)
19+
- Comprehensive documentation and examples
20+
21+
### Features
22+
- Path validation ensuring paths stay within jail boundaries
23+
- Path canonicalization to resolve symlinks and relative components
24+
- Type-safe validation preventing directory traversal
25+
- Simple two-type API: `PathValidator` and `JailedPath`

Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "jailed-path"
3+
version = "0.0.1"
4+
edition = "2021"
5+
authors = ["David Krasnitsky <[email protected]>"]
6+
description = "Type-safe path validation ensuring file paths stay within defined jail boundaries"
7+
license = "MIT OR Apache-2.0"
8+
repository = "https://github.com/DK26/jailed-path-rs"
9+
homepage = "https://github.com/DK26/jailed-path-rs"
10+
documentation = "https://docs.rs/jailed-path"
11+
readme = "README.md"
12+
keywords = ["path", "security", "jail", "filesystem", "traversal"]
13+
categories = ["filesystem", "development-tools", "web-programming"]
14+
15+
[dependencies]

0 commit comments

Comments
 (0)