Skip to content

feat: Add FQDN matcher and obfuscator#45

Open
renatgalimov wants to merge 7 commits into
mainfrom
feat/fqdn-obfuscation
Open

feat: Add FQDN matcher and obfuscator#45
renatgalimov wants to merge 7 commits into
mainfrom
feat/fqdn-obfuscation

Conversation

@renatgalimov

Copy link
Copy Markdown
Owner

Summary

  • Add is_fqdn() detector and hash_to_fqdn() obfuscator for fully qualified domain names
  • Preserves label count and label lengths, replaces content with syllable-based text and hash-derived TLD
  • Bump version from 0.0.1 to 0.0.2

Test plan

  • Unit tests for is_fqdn() with positive and negative cases
  • Unit test for hash_to_fqdn() round-trip class preservation
  • Well-known inputs detection and obfuscation tests (4 FQDN examples)
  • Cucumber scenarios with literal expected values (4 scenarios, all passing)
  • All 30 existing tests continue to pass

🤖 Generated with Claude Code

renatgalimov and others added 2 commits March 15, 2026 06:51
Add a new GitHub Actions workflow for fuzz testing on pull requests
and pushes to the main branch. This setup includes the installation
of `cargo-fuzz` and executes a short fuzzing session using Rust
nightly.

Additionally, update `Cargo.toml` and `Cargo.lock` to include the
`clap` dependency with derive feature.
Add is_fqdn() detector and hash_to_fqdn() obfuscator that preserves
label structure while replacing content with syllable-based text and
a hash-derived TLD. Includes unit tests, well-known inputs, and
cucumber scenarios.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread .github/workflows/fuzz.yml Fixed
…in permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds FQDN detection/obfuscation to the existing JSON/YAML/CSS obfuscation pipeline, with test fixtures and cucumber scenarios to validate deterministic outputs.

Changes:

  • Introduce is_fqdn() classifier and hash_to_fqdn() obfuscator, and integrate into string hashing flow.
  • Add unit tests + well-known input fixtures + cucumber scenarios for FQDN detection/obfuscation.
  • Bump crate version and update dependencies/lockfile; add a new fuzzing workflow.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/lib.rs Adds FQDN regex/classifier, FQDN obfuscation function, wires it into hash_strings, and extends unit tests.
src/cucumber_tests.rs Extends cucumber step implementations to support fqdn detector/validator.
tests/well_known_inputs.rs Adds well-known FQDN examples for detector expectations.
tests/features/classifiers.feature Adds cucumber scenarios with fixed expected obfuscation outputs for FQDNs.
Cargo.toml Bumps version and adds clap dependency.
Cargo.lock Lockfile updates consistent with dependency/version changes.
.github/workflows/fuzz.yml Adds a CI job intended to run a short cargo-fuzz run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/fuzz.yml
Comment thread src/lib.rs
Comment thread src/lib.rs
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread Cargo.toml Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 580a07c8f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/fuzz.yml
- Remove redundant contains('.') check in is_fqdn() (regex enforces it)
- Remove unnecessary string clone in hash_strings() FQDN branch
- Strengthen test to assert label count and non-TLD label lengths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add cargo-fuzz scaffolding so the CI fuzzing workflow can run the
obfuscate_json target.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for detecting and obfuscating fully-qualified domain names (FQDNs) in the pipefog obfuscation pipeline, along with fixtures/tests to validate the new classifier and stable expected outputs.

Changes:

  • Introduce is_fqdn() detection and hash_to_fqdn() obfuscation logic in the core library.
  • Extend unit tests, well-known input fixtures, and Cucumber scenarios to cover FQDN detection/obfuscation.
  • Bump crate version and add a new GitHub Actions fuzzing workflow.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/lib.rs Adds FQDN regex + detector, wires FQDN into string obfuscation, and implements hash_to_fqdn with accompanying unit tests.
src/cucumber_tests.rs Extends cucumber step logic to obfuscate/validate fqdn classification.
tests/well_known_inputs.rs Adds well-known FQDN examples for detector expectations.
tests/features/classifiers.feature Adds Cucumber scenarios with literal expected obfuscated FQDN outputs.
Cargo.toml Bumps version and adds clap dependency.
Cargo.lock Lockfile updates reflecting the version bump and dependency graph changes (notably clap).
.github/workflows/fuzz.yml Adds a fuzzing workflow that runs cargo-fuzz on PRs and main.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib.rs Outdated
Comment thread Cargo.toml Outdated
Comment thread .github/workflows/fuzz.yml
- Replace deprecated `rand::thread_rng`/`gen_range` with `rng`/`random_range`.
- Switch three `|c| c == '+' || c == '-'` closures to `['+', '-']` arrays.
- Apply `manual_flatten` suggestion in `obfuscate_json_bytes`.
- Correct `hash_to_fqdn` doc comment to state TLD length is not preserved.
- Drop unused `clap` direct dependency.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The job was scoped to the `main` deployment environment, which doesn't
expose the repository-level `CODECOV_TOKEN` secret, so uploads failed
with `fail_ci_if_error`. Use the default scope so the global secret is
available.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented May 8, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated 2 comments.

Comment thread src/lib.rs
Comment on lines +551 to +555
/// Converts a hash into a realistic-looking FQDN preserving the label count and
/// the byte length of every non-TLD label. The final label (TLD) is replaced
/// with an entry from `COMMON_TLDS` chosen by the hash, so the TLD length is
/// NOT preserved.
pub(crate) fn hash_to_fqdn(hash: &[u8], input: &str) -> String {
uses: dtolnay/rust-toolchain@nightly

- name: Install cargo-fuzz
run: cargo install cargo-fuzz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants