redstr 0.2.3

Red team string obfuscation and transformation for offensive security, WAF bypass, XSS, SQL injection, phishing, and evasion testing
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# Contributing to redstr

Thank you for your interest in contributing to redstr! This document provides guidelines and instructions for contributing.

## 🎯 Getting Started

### For Human Developers

1. **Pick a Task**
   - Check `roadmap/TASKS.md` for available tasks
   - Look for tasks with no assignee (⬜ Not Started)
   - Choose based on your skills and interests
   - Check that dependencies are met

2. **Claim the Task**
   - Comment on the task in `roadmap/TASKS.md` or create an issue
   - Update status: ⬜ → 🟡 (In Progress)
   - Assign yourself if using GitHub

3. **Set Up Development**
   ```bash
   git clone https://github.com/arvid-berndtsson/redstr.git
   cd redstr
   cargo build
   cargo test
   ```

4. **Create Feature Branch**
   ```bash
   git checkout -b task/{TASK-ID}-{short-description}
   ```

5. **Make Changes**
   - Follow the task requirements
   - Write tests
   - Update documentation
   - Follow code style

6. **Submit PR**
   - Push your branch
   - Create PR with task ID in title
   - Use PR template
   - Update task status: 🟡 → ✅

### For AI Agents (Cursor/GitHub)

1. **Find Agent-Friendly Tasks**
   - Look for tasks tagged `[AGENT-FRIENDLY]` in `roadmap/TASKS.md`
   - Check task has no assignee
   - Verify dependencies are met

2. **Follow Task Template**
   - Read task description carefully
   - Follow function signatures provided
   - Implement all requirements
   - Create tests and documentation

3. **Create Atomic PRs**
   - One feature per PR
   - Include task ID in PR title
   - Use PR template
   - Ensure all checks pass

## 📋 Task Workflow

### Task Status

- **Not Started** - Available for assignment
- 🟡 **In Progress** - Currently being worked on
-**Completed** - Done and merged
- 🔄 **Blocked** - Waiting on dependencies
-**Cancelled** - No longer needed

### Updating Task Status

Update status in `roadmap/TASKS.md` when:
- Starting: ⬜ → 🟡
- Completing: 🟡 → ✅
- Blocked: 🟡 → 🔄

**Note:** Update via PR, not directly in main branch.

## 🛠️ Development Guidelines

### Code Style

- Follow Rust standard formatting (`cargo fmt`)
- Run clippy and fix warnings (`cargo clippy`)
- Use 4 spaces for indentation
- Keep line length < 100 characters
- Follow Rust naming conventions

### Pre-commit Hooks

A pre-commit hook is automatically installed that runs the following checks before each commit:

1. **Code Formatting** (`cargo fmt --check`)
   - Ensures code follows Rust standard formatting
   - If formatting fails, run `cargo fmt` to auto-format

2. **Clippy** (`cargo clippy -- -D warnings`)
   - Catches common mistakes and enforces idiomatic Rust
   - All warnings must be fixed before committing

3. **Compilation Check** (`cargo check`)
   - Verifies code compiles successfully
   - Catches compilation errors early

4. **Tests** (`cargo test`)
   - Runs all tests to ensure nothing is broken
   - All tests must pass before committing

**Note:** If you need to skip the pre-commit hook (e.g., for WIP commits), use `git commit --no-verify`. However, **never skip hooks for final commits** - all checks must pass before merging.

### Minimal Dependencies Principle

**CRITICAL:** The core library must not have required dependencies.

- ✅ Use `std` only for core functionality
- ✅ Optional features (like `serde`) behind feature flags are acceptable
- ❌ Never add required dependencies to core library
- ✅ Dev-dependencies (like `cc-check`, `criterion`) are OK for testing/benchmarking

### Testing

- Write tests for all public functions
- Test edge cases (empty strings, Unicode, special chars)
- Run `cargo test` before submitting
- Aim for 100% test coverage

### Documentation

- Every public function needs doc comments (`///`)
- Include `# Examples` section
- Document security use cases
- Reference related functions

### Performance

- Use `String::with_capacity` when size is known
- Avoid unnecessary allocations
- Profile performance-critical paths
- Benchmark new functions

## 📝 Commit Messages

**We enforce conventional commits using `cc-check` in CI.**

### Format

```
[TASK-ID] <type>(<scope>): <subject>

<body>

<footer>
```

### Types

- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation changes
- `style`: Code style changes (formatting, etc.)
- `refactor`: Code refactoring
- `test`: Adding or updating tests
- `chore`: Maintenance tasks
- `perf`: Performance improvements

### Examples

```
[CF-001] feat(cloudflare): add Turnstile challenge variation

Implements cloudflare_turnstile_variation() for bot detection evasion.

- Add function to cloudflare.rs
- Add comprehensive tests
- Add documentation with examples

Closes #123
```

```
[PKG-001] feat(packaging): create Debian package structure

Adds debian/ directory with control, rules, and changelog files.

- Create debian/control
- Add debian/rules for building
- Add debian/changelog
```

```
fix(encoding): correct URL encoding for special characters

Fixes issue where certain Unicode characters were not properly encoded.

Fixes #456
```

### Validation

Commit messages are automatically validated in CI. The format must be:

```
[TASK-ID] <type>(<scope>): <subject>
```

Where:
- `TASK-ID` is optional but recommended (e.g., `CF-001`)
- `type` is required (feat, fix, docs, etc.)
- `scope` is optional (module name)
- `subject` is required (brief description)

**CI will fail if commits don't follow this format.**

## 🚀 Release Process

### Creating a Release

We use [`cargo-release`](https://github.com/crate-ci/cargo-release) to automate the release process and prevent version mismatches.

#### Prerequisites

Install `cargo-release` (one-time setup):
```bash
cargo install cargo-release
```

#### Recommended: Use cargo-release

The easiest way to create a release is using `cargo-release`:

**For semantic versioning:**
```bash
cargo release patch   # 0.1.0 -> 0.1.1
cargo release minor   # 0.1.0 -> 0.2.0
cargo release major   # 0.1.0 -> 1.0.0
```

**For specific version:**
```bash
cargo release 0.2.0
```

**Dry run (preview changes without committing):**
```bash
cargo release --dry-run patch
```

`cargo-release` will:
1. ✅ Update `Cargo.toml` version
2. ✅ Update `Cargo.lock` if needed
3. ✅ Create a git commit with the version change
4. ✅ Create a git tag `v<version>`
5. ✅ Optionally push to origin (use `--execute` flag)

**Full release workflow:**
```bash
# Preview what will happen
cargo release --dry-run minor

# Execute the release (updates version, commits, tags)
cargo release minor --execute

# Push the commit and tag
git push origin main
git push origin --tags
```

### CI Validation & Publishing

The GitHub Actions workflow automatically:
- ✅ Updates `Cargo.toml` version to match the tag version (if needed)
- ✅ Commits the version update back to the repository
- ✅ Publishes to crates.io with the correct version
- ✅ Uses Trusted Publishing (no API tokens needed)

**Workflow:** Push tag → CI auto-updates version → Commits changes → Auto-publishes to crates.io

**Note:** If you push a tag like `v0.2.1` and `Cargo.toml` has version `0.2.0`, the workflow will automatically update `Cargo.toml` to `0.2.1` and commit the change before publishing.


## 🔍 Code Review Process

1. **Automated Checks**
   - Tests must pass
   - Clippy must pass
   - Formatting must be correct

2. **Review Criteria**
   - Code follows style guide
   - Tests are comprehensive
   - Documentation is complete
   - No new required dependencies added
   - Performance considered

3. **Review Feedback**
   - Address all comments
   - Update code as needed
   - Re-request review when ready

## 🎯 Task Priorities

### Priority Levels

- **Critical**: Must have for next release
- **High**: Important feature
- **Medium**: Nice to have
- **Low**: Future consideration

### Complexity Levels

- **Simple**: 1-2 days
- **Medium**: 3-5 days
- **Complex**: 1-2 weeks

## 📚 Resources

### Documentation
- `roadmap/TASKS.md` - Complete task list
- `roadmap/ROADMAP.md` - Strategic roadmap
- `roadmap/QUICK_START.md` - Quick start guide
- `README.md` - Project overview
- [docs.rs/redstr]https://docs.rs/redstr - API documentation

### Getting Help
- GitHub Discussions
- Discord/Slack (when available)
- Create an issue for questions

## 🚀 Quick Start Examples

### Adding a New Transformation Function

1. Create function in appropriate module:
   ```rust
   // src/transformations/cloudflare.rs
   /// Brief description.
   ///
   /// # Examples
   /// ```
   /// use redstr::new_function;
   /// let result = new_function("input");
   /// ```
   pub fn new_function(input: &str) -> String {
       // Implementation
   }
   ```

2. Add tests:
   ```rust
   #[cfg(test)]
   mod tests {
       use super::*;
       
       #[test]
       fn test_new_function() {
           // Tests
       }
   }
   ```

3. Export in `src/lib.rs`:
   ```rust
   pub use transformations::cloudflare::new_function;
   ```

4. Add to `TransformBuilder` if applicable

5. Create example in `examples/`

### Creating a New Integration

**First, check where your integration should live!**

See **[Integration Guidelines](docs/INTEGRATION_GUIDELINES.md)** for guidance on:
- When to use a separate repository (e.g., Burp Suite, OWASP ZAP add-ons)
- When to contribute to this repository (examples, docs)
- How to structure your integration
- Tool-specific guidance

**For integrations in this repo:**
1. Research integration points
2. Create `docs/{platform}_integration.md`
3. Add examples to `examples/` directory
4. Update documentation

**For separate repo integrations:**
1. Follow the [Integration Guidelines]docs/INTEGRATION_GUIDELINES.md
2. Reference redstr in your documentation
3. Let us know so we can feature it!

## 🤝 Community Guidelines

- Be respectful and inclusive
- Help others learn
- Share knowledge
- Follow code of conduct

## 📊 Progress Tracking

- Update `roadmap/TASKS.md` with progress
- Use GitHub Projects for visualization
- Report blockers early
- Celebrate completions!

---

**Thank you for contributing to redstr!** 🎉