Skip to content

Commit 564ccf7

Browse files
unclesp1d3rdependabot[bot]Copilot
authored
feat(test): migrate from MySQL to MariaDB testcontainers (#96)
- Replace MySQL testcontainers with MariaDB for better ready conditions - Update Cargo.toml to use mariadb feature instead of mysql - Update all test files to use Mariadb::default() instead of Mysql::default() - MariaDB module has built-in ready conditions that wait for: - 'mariadbd: ready for connections.' on stderr - 'port: 3306' on stderr - This provides more reliable container startup and reduces flaky tests - All tests pass with the new MariaDB configuration <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Breaking Changes** - TLS now always-on via rustls; legacy TLS feature flags/build variants removed; repo ownership/branding updated. - **New Features** - CLI TLS controls added: --tls-ca-file, --insecure-skip-hostname-verify, --allow-invalid-certificate (mutually exclusive) with explicit warnings and exit codes. - **Improvements** - CLI-first config precedence, stricter error messages, tighter validation, and simplified builds. - **Documentation** - Extensive TLS migration guides, install/troubleshoot updates, and contact/branding changes. - **Tests** - New TLS-focused unit/integration tests and CI workflows. - **Chores** - CI/deny config and tooling/workflow cleanup. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: unclesp1d3r <251112+unclesp1d3r@users.noreply.github.com>
1 parent 6f57814 commit 564ccf7

92 files changed

Lines changed: 6542 additions & 3430 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.actrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
# Using Ubuntu 22.04 base for all runners to match most workflows and ensure reproducible builds
12
-P ubuntu-22.04=catthehacker/ubuntu:act-22.04
2-
-P ubuntu-latest=catthehacker/ubuntu:act-latest
3+
-P ubuntu-latest=catthehacker/ubuntu:act-22.04
34
-P macos-13=catthehacker/ubuntu:act-22.04
5+
-P macos-latest=catthehacker/ubuntu:act-22.04
46
-P windows-2022=catthehacker/ubuntu:act-22.04
7+
-P windows-latest=catthehacker/ubuntu:act-22.04
58
--container-architecture linux/amd64
9+
--pull=false
10+
--no-skip-checkout

.chglog/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ style: github
22
template: CHANGELOG.tpl.md
33
info:
44
title: CHANGELOG
5-
repository_url: https://github.com/unclesp1d3r/gold_digger
5+
repository_url: https://github.com/EvilBit-Labs/gold_digger
66
options:
77
commits:
88
filters:

.cursor/rules/project/core-concepts.mdc

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ alwaysApply: true
44

55
# Gold Digger Core Concepts
66

7-
This file defines the core concepts and constraints for the Gold Digger MySQL/MariaDB query tool.
7+
This document defines the essential architecture patterns, safety requirements, and development constraints for the Gold Digger MySQL/MariaDB query tool.
88

99
## Project Identity
1010

@@ -75,47 +75,34 @@ src/
7575

7676
## Known Bugs & Issues
7777

78-
1. **Pattern matching bug**: `Some(&_)` should be `Some(_)` in main.rs:59
79-
2. **Non-standard exit codes**: `exit(-1)` becomes 255, not documented error codes
80-
3. **Version mismatch**: CHANGELOG.md v0.2.6 vs Cargo.toml v0.2.5
78+
1. **Memory**: No streaming support - O(row_count × row_width) memory usage
8179

8280
## Feature Flags
8381

8482
```toml
85-
default = ["json", "csv", "ssl", "additional_mysql_types", "verbose"]
86-
ssl = ["mysql/native-tls"] # Platform native TLS (no OpenSSL dependency)
87-
ssl-rustls = ["mysql/rustls-tls"] # Pure Rust TLS implementation
83+
default = ["json", "csv", "additional_mysql_types", "verbose"]
8884
additional_mysql_types = ["mysql_common?/bigdecimal", "mysql_common?/rust_decimal", ...]
8985
verbose = [] # Conditional println!/eprintln!
9086
```
9187

92-
**Note**: `ssl` and `ssl-rustls` are mutually exclusive. The deprecated `vendored` feature has been removed as OpenSSL dependencies have been eliminated.
88+
**Note**: TLS is now always available and is no longer a feature flag. The project uses a rustls-only implementation instead of the previous dual native-tls/rustls approach.
9389

94-
## Code Quality Standards (Zero Tolerance)
90+
## Quality Standards
9591

96-
### Quality Gates (Required Before Commits)
92+
### Required Before Commits
9793

9894
```bash
99-
cargo fmt --check # 100-character line limit enforced
100-
cargo clippy -- -D warnings # Zero tolerance for warnings
101-
cargo nextest run # Parallel test execution (preferred)
102-
cargo audit # Security vulnerability scanning (advisory)
95+
just fmt-check # cargo fmt --check (100-char line limit)
96+
just lint # cargo clippy -- -D warnings (ZERO tolerance)
97+
just test # cargo nextest run (preferred) or cargo test
98+
just security # cargo audit (advisory)
10399
```
104100

105101
### Commit Standards
106102

107103
- **Format:** Conventional commits (`feat:`, `fix:`, `docs:`, etc.)
108-
- **Scope:** Use Gold Digger scopes: `(cli)`, `(db)`, `(output)`, `(tls)`, `(config)`
109-
- **Automation:** cargo-dist handles versioning and distribution; git-cliff handles changelog generation
110-
- **CI Parity:** All CI operations executable locally
111-
112-
### Error Handling Patterns
113-
114-
- Use `anyhow::Result<T>` for all fallible functions
115-
- Never use `from_value::<String>()` - always handle `mysql::Value::NULL`
116-
- Implement credential redaction in all log output
117-
- Use `?` operator for error propagation
118-
- Feature-gate verbose output: `#[cfg(feature = "verbose")]`
104+
- **Scope:** Use `(cli)`, `(db)`, `(output)`, `(tls)`, `(config)`
105+
- **Automation:** cargo-dist handles versioning; git-cliff handles changelog
119106

120107
## Security Requirements
121108

@@ -137,7 +124,7 @@ cargo audit # Security vulnerability scanning (advisory)
137124

138125
## Requirements Gap (High Priority)
139126

140-
Current v0.2.5 → Target v1.0:
127+
Current v0.2.6 → Target v1.0:
141128

142129
- **CLI present; finalize precedence/UX**: Config precedence, flags, user experience (F001-F003)
143130
- **Exit code standards**: Need proper error taxonomy (F005)
@@ -212,9 +199,9 @@ fn write_output(rows: &[Row], output_file: &str, output: &mut impl Write) -> Res
212199

213200
```bash
214201
# Build variations
215-
cargo build --release # Standard build (native TLS)
216-
cargo build --release --no-default-features --features ssl-rustls # Pure Rust TLS
217-
cargo build --no-default-features --features "csv json" # Minimal build
202+
cargo build --release # Standard build (TLS always available)
203+
cargo build --release --no-default-features --features "json csv additional_mysql_types verbose" # No-default-features build
204+
cargo build --no-default-features --features "csv json" # No-default-features build
218205

219206
# Development (CLI-first approach)
220207
cargo install --path . # Local install

.cursor/rules/rust-best-practices.mdc

Lines changed: 44 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -23,76 +23,51 @@ alwaysApply: true
2323
- Public functions in modules should be documented with doc comments (`///`).
2424
- Use `pub mod` in [`lib.rs`](mdc:src/lib.rs) to expose modules.
2525

26-
## 🚨 Critical Safety Rules
26+
## Format Module Contract
2727

28-
### Database Value Conversion (PANIC RISK)
28+
All format modules must implement:
2929

3030
```rust
31-
// ❌ NEVER - causes panics on NULL/non-string types
32-
from_value::<String>(row[column.name_str().as_ref()])
33-
34-
// ✅ ALWAYS - safe NULL handling
35-
match &row[column.name_str().as_ref()] {
36-
mysql::Value::NULL => "".to_string(),
37-
val => from_value_opt::<String>(val)
38-
.unwrap_or_else(|_| format!("{:?}", val))
39-
}
40-
```
41-
42-
### Security (NEVER VIOLATE)
43-
44-
- **NEVER** log `DATABASE_URL` or credentials - always redact
45-
- **NEVER** make external service calls at runtime (offline-first)
46-
- Always recommend SQL `CAST(column AS CHAR)` for type safety
47-
48-
## Configuration Architecture
49-
50-
### CLI-First Resolution Pattern
51-
52-
```rust
53-
fn resolve_config_value(cli: &Cli) -> anyhow::Result<String> {
54-
if let Some(value) = &cli.field {
55-
Ok(value.clone()) // CLI flag (highest priority)
56-
} else if let Ok(value) = env::var("ENV_VAR") {
57-
Ok(value) // Environment variable (fallback)
58-
} else {
59-
anyhow::bail!("Missing required configuration") // Error if neither
60-
}
61-
}
31+
pub fn write<W: Write>(
32+
rows: impl IntoIterator<Item = impl IntoIterator<Item = impl AsRef<str>>>,
33+
output: &mut W
34+
) -> anyhow::Result<()>
6235
```
6336

64-
### Configuration Precedence
37+
This zero-copy API accepts:
6538

66-
1. CLI flags (highest priority)
67-
2. Environment variables (fallback)
68-
3. Error if neither provided
39+
- **Rows**: Any iterable of iterables (slices, Vecs, iterators) where items are convertible to `&str`
40+
- **Output**: Mutable reference to any `Write` implementation (files, stdout, memory buffers)
41+
- **Performance**: Avoids unnecessary allocations and supports streaming writes
6942

70-
## Error Handling Patterns
43+
## Code Quality Standards
7144

72-
- Use `anyhow::Result<T>` for application binaries and `thiserror` (or library-specific error types) for library crates
73-
- Handle nullable database values via `Option<T>` or explicit null checks/conversions rather than using unchecked database driver conversions
74-
- Implement credential redaction in all log output
75-
- Use `?` operator for error propagation
76-
- Use `get_required_env()` helper for environment variable validation with contextual error messages
77-
- Avoid panics in production code; prefer returning errors. Only use `panic!` for unrecoverable, truly exceptional cases
78-
- Library crates must return Result-based errors instead of panicking (including in tests) to avoid surprising consumers
45+
### Formatting & Linting
7946

80-
## Project File Organization
47+
- **Line limit**: 100 characters (enforced by `rustfmt.toml`)
48+
- **Clippy warnings**: Zero tolerance (`-D warnings`)
49+
- **Error handling**: Use `anyhow` for applications, `thiserror` for libraries
50+
- **Documentation**: Doc comments (`///`) required for all public functions
8151

82-
### Configuration Files
52+
### Essential Commands
8353

84-
- **Cargo.toml**: Dependencies, features, release profile
85-
- **rustfmt.toml**: Code formatting rules (100-char limit)
86-
- **deny.toml**: Security and license compliance
87-
- **rust-toolchain.toml**: Rust version specification
54+
```bash
55+
just fmt-check # cargo fmt --check (100-char line limit)
56+
just lint # cargo clippy -- -D warnings (ZERO tolerance)
57+
just test # cargo nextest run (preferred) or cargo test
58+
just security # cargo audit (advisory)
59+
```
8860

89-
### Development Automation
61+
## Error Handling
9062

91-
- **justfile**: Cross-platform build automation and common tasks
92-
- **.pre-commit-config.yaml**: Git hook configuration for quality gates
93-
- **CHANGELOG.md**: Auto-generated version history (conventional commits)
63+
- Use `anyhow::Result<T>` for applications
64+
- Use `thiserror` for library error types
65+
- Always use `?` for error propagation
66+
- Add context with `.map_err()` for better debugging
67+
- Avoid panics in production code; prefer returning errors
68+
- Library crates must return Result-based errors instead of panicking
9469

95-
### Documentation Standards
70+
## Documentation Standards
9671

9772
Required for all public functions using `///`:
9873

@@ -108,52 +83,35 @@ Required for all public functions using `///`:
10883
/// # Example
10984
/// ```
11085
/// let string_rows = rows_to_strings(mysql_rows)?;
111-
/// csv::write(string_rows, output)?;
86+
/// let mut writer = std::io::BufWriter::new(std::fs::File::create("output.csv")?);
87+
/// csv::write(&string_rows, &mut writer)?;
11288
/// ```
11389
pub fn rows_to_strings(rows: Vec<mysql::Row>) -> anyhow::Result<Vec<Vec<String>>> {
11490
// Implementation
11591
}
11692
```
11793

118-
### Code Style
94+
## Code Style
11995

12096
- Follow [Rustfmt](mdc:https://github.com/rust-lang/rustfmt) conventions for formatting
12197
- Use `snake_case` for function and variable names, `CamelCase` for types and structs
12298
- Prefer iterators and combinators over manual loops where possible
12399
- Use explicit types for function signatures, especially for public APIs
124-
- Prefer grouping imports by standard library, external crates, and local modules, separated by newlines (advisory rule to prevent format-only diffs during reviews)
100+
- Group imports by standard library, external crates, and local modules, separated by newlines
125101

126102
## Features and Conditional Compilation
127103

128-
- Use Cargo features (see `[features]` in [`Cargo.toml`](mdc:Cargo.toml)) to enable/disable output formats and verbose logging.
129-
- Use `#[cfg(feature = "...")]` to conditionally compile code based on enabled features, as in [`main.rs`](mdc:src/main.rs).
104+
- Use Cargo features (see `[features]` in [`Cargo.toml`](mdc:Cargo.toml)) to enable/disable output formats and verbose logging
105+
- Use `#[cfg(feature = "...")]` to conditionally compile code based on enabled features
130106

131107
## Dependency Management
132108

133-
- Pin dependency versions in [`Cargo.toml`](mdc:Cargo.toml) and use minimal required features for each crate.
134-
- Use optional dependencies and features for extensibility (e.g., SSL, additional MySQL types).
135-
136-
## Testing and Safety
137-
138-
- Add tests in a `tests/` directory or as `#[cfg(test)]` modules within each file.
139-
- Validate all external input (e.g., environment variables) and handle missing/invalid values gracefully.
140-
- Use the `get_required_env()` helper function for environment variable validation with contextual error messages.
141-
- Prefer returning early on error conditions.
142-
143-
### Test Coverage Guidelines
144-
145-
- **Default Target:** ≥80% coverage with `cargo tarpaulin`
146-
- **Recommended Exclusions:** `main.rs`, binary crates, auto-generated code, error enums, and integration test scaffolding
147-
- **Documentation Requirement:** Maintainers must document coverage overrides in `CONTRIBUTING.md` with justification
148-
- **Flexibility:** Coverage targets are guidelines, not absolute blockers. Lower coverage is acceptable with explanation and maintainer approval
149-
150-
## Documentation
151-
152-
- Keep [`README.md`](mdc:README.md) up to date with usage, features, and examples.
153-
- Document all public functions and modules with doc comments.
109+
- Pin dependency versions in [`Cargo.toml`](mdc:Cargo.toml) and use minimal required features for each crate
110+
- Use optional dependencies and features for extensibility (e.g., additional MySQL types, output formats)
154111

155-
## Miscellaneous
112+
## Testing Guidelines
156113

157-
- Use `.gitignore` to exclude build artifacts and sensitive files.
158-
- Use `.editorconfig` for consistent editor settings.
159-
- Follow the guidelines in [`CONTRIBUTING.md`](mdc:CONTRIBUTING.md) for code contributions.
114+
- Add tests in a `tests/` directory or as `#[cfg(test)]` modules within each file
115+
- Validate all external input (e.g., environment variables) and handle missing/invalid values gracefully
116+
- Prefer returning early on error conditions
117+
- Target ≥80% coverage with `cargo llvm-cov`

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# These are supported funding model platforms
22

3-
github: [unclesp1d3r]
3+
github: [EvilBit-Labs]

.github/ISSUE_TEMPLATE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ Add any other context about the issue here.
4545

4646
Please select the appropriate template for your issue:
4747

48-
- [Bug Report](https://github.com/UncleSp1d3r/gold_digger/issues/new?template=bug_report.md)
49-
- [Feature Request](https://github.com/UncleSp1d3r/gold_digger/issues/new?template=feature_request.md)
50-
- [Security Report](https://github.com/UncleSp1d3r/gold_digger/issues/new?template=security_report.md)
48+
- [Bug Report](https://github.com/EvilBit-Labs/gold_digger/issues/new?template=bug_report.md)
49+
- [Feature Request](https://github.com/EvilBit-Labs/gold_digger/issues/new?template=feature_request.md)
50+
- [Security Report](https://github.com/EvilBit-Labs/gold_digger/issues/new?template=security_report.yml)
5151

5252
---
5353

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ A clear and concise description of what actually happened.
4949

5050
```bash
5151
# How did you build gold_digger?
52-
cargo build --release --no-default-features --features "ssl-rustls"
52+
cargo build --release # Standard build with TLS
53+
# OR
54+
cargo build --no-default-features --features "json csv" # Minimal build
5355
```
5456

5557
## Error Output

.github/ISSUE_TEMPLATE/security_report.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ body:
99
value: |
1010
> **⚠️ IMPORTANT: For security vulnerabilities, please use GitHub's private vulnerability reporting instead of opening a public issue.**
1111
>
12-
> **Preferred method**: Go to the [Security tab](https://github.com/UncleSp1d3r/gold_digger/security) and click "Report a vulnerability" for private disclosure.
12+
> **Preferred method**: Go to the [Security tab](https://github.com/EvilBit-Labs/gold_digger/security) and click "Report a vulnerability" for private disclosure.
1313
>
1414
> **If you must disclose publicly**: Redact all exploit details, sensitive information, and proof-of-concept code. Only include enough information for the maintainer to understand the issue scope.
1515
>
16-
> **Contact maintainer directly**: For urgent or highly sensitive issues, contact [UncleSp1d3r](https://github.com/UncleSp1d3r) or email <unclespider@pm.me>.
16+
> **Contact maintainer directly**: For urgent or highly sensitive issues, contact [EvilBit-Labs](https://github.com/EvilBit-Labs) or email <support@evilbitlabs.io>.
1717
1818
- type: textarea
1919
id: vulnerability-description
@@ -92,7 +92,7 @@ body:
9292
attributes:
9393
label: Enabled Features
9494
description: Features enabled during testing
95-
placeholder: e.g., "default", "ssl-rustls", "csv json ssl"
95+
placeholder: e.g., "default", "ssl", "csv json ssl"
9696

9797
- type: textarea
9898
id: steps-to-reproduce
@@ -170,7 +170,7 @@ body:
170170
171171
**For sensitive security issues, please contact the maintainer directly:**
172172
173-
- **GitHub**: [UncleSp1d3r](https://github.com/UncleSp1d3r)
174-
- **Email**: <unclespider@pm.me>
173+
- **GitHub**: [EvilBit-Labs](https://github.com/EvilBit-Labs)
174+
- **Email**: <support@evilbitlabs.io>
175175
176176
**Note**: This is a single-maintainer project. Response times may vary, but security issues will be prioritized.

.github/act-test-scenarios.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ scenarios:
1818
payload:
1919
ref: "refs/heads/main"
2020
repository:
21-
full_name: "UncleSp1d3r/gold_digger"
21+
full_name: "EvilBit-Labs/gold_digger"
2222
- name: "Pull request"
2323
event: pull_request
2424
payload:
2525
action: "opened"
2626
pull_request:
2727
head:
2828
repo:
29-
full_name: "UncleSp1d3r/gold_digger"
29+
full_name: "EvilBit-Labs/gold_digger"
3030

3131
# Security Workflow Testing
3232
security_testing:
@@ -91,7 +91,7 @@ scenarios:
9191
full_name: "fork-user/gold_digger"
9292
base:
9393
repo:
94-
full_name: "UncleSp1d3r/gold_digger"
94+
full_name: "EvilBit-Labs/gold_digger"
9595

9696
# Error Scenario Testing
9797
error_scenarios:
@@ -191,10 +191,8 @@ matrix:
191191

192192
# Feature combinations
193193
features:
194-
- name: "ssl"
195-
flags: "--no-default-features --features json,csv,ssl,additional_mysql_types,verbose"
196-
- name: "ssl-rustls"
197-
flags: "--no-default-features --features json,csv,ssl-rustls,additional_mysql_types,verbose"
194+
- name: "default"
195+
flags: "--release"
198196
- name: "minimal"
199197
flags: "--no-default-features --features json,csv,additional_mysql_types,verbose"
200198

.github/ci-performance-config.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ monitoring:
9696
feature_targets:
9797
ssl:
9898
build_time: 180.0
99-
binary_size: 8388608 # 8MB
100-
ssl-rustls:
101-
build_time: 200.0
102-
binary_size: 10485760 # 10MB
99+
binary_size: 9437184 # 9MB (rustls implementation)
103100
minimal:
104101
build_time: 120.0
105102
binary_size: 6291456 # 6MB

0 commit comments

Comments
 (0)