Skip to content

fix(gh-18): shared config-driven redactor for bindings, log context and bodies - #24

Merged
Nejcc merged 11 commits into
mainfrom
fix/gh-18-shared-redactor
Oct 31, 2026
Merged

Nejcc merged 11 commits into
mainfrom
fix/gh-18-shared-redactor

Conversation

@Nejcc

@Nejcc Nejcc commented Oct 31, 2026

Copy link
Copy Markdown
Member

Closes #18

Stacked on #23. Retarget to main once #9 → #20 → #23 are merged.

What

  • New src/Support/Redactor.php, driven by config('digdeep.redact'). It replaces the three separate key/header maskers (middleware, API controller, HTTP client collector).
  • SQL bindings: masked when bound to a sensitive column (password = ?, set remember_token = ?, insert column lists, named bindings) or when the value matches redact.binding_patterns (bcrypt/argon2 hashes by default). DIGDEEP_REDACT_BINDINGS=false turns this off.
  • Log context: key-redacted before encoding.
  • Response bodies: JSON bodies are key-redacted (e.g. access_token from login endpoints). DIGDEEP_CAPTURE_RESPONSE_BODIES=false stops storing them.
  • HTTP client: request and response bodies are redacted too (JSON and form), on top of the headers.
  • Mail/notifications: only recipient, subject and class are stored, never content, so nothing changes there.

Limits

Column detection for bindings uses a regex, not a SQL parser. A ? inside a string literal can shift positions, and aliases (select ? as password) aren't detected. The value patterns still apply in both cases. Caps on log context size are left to #17.

Checks

  • composer test: 89 passed (5 new in tests/Feature/RedactorTest.php)
  • composer lint, composer analyse: clean
  • gitleaks: no leaks

Nejcc added 10 commits October 31, 2026 15:24
- run-command and ai-apply need code_actions (unset = local only); wider denylist
- debugbar injected only when DigDeep::check() passes
- session values and more auth headers redacted
- Js::from() in HTML exports and inline handlers; AI text escaped before markup
- CDN scripts pinned with SRI
- ai_model/ai_provider fall back to defaults when env is unset
- AI endpoints probe the laravel/ai trait instead of autoloading agents (501, not fatal)
- EXPLAIN uses the right syntax per driver

BREAKING CHANGE: outside local, run-command and ai-apply return 403 unless DIGDEEP_CODE_ACTIONS=true.

Closes #11, closes #12, closes #13, closes #14, closes #15, refs #7
One QueryAnalyzer::schema() replaces the duplicated sqlite_master/PRAGMA code
in the database page and the MCP AnalyzeQueries tool.

Closes #5
PHP 8.4/8.5 x Laravel 12/13. Covers the gate, CSRF, code actions, debugbar
gating, redaction, export XSS, AI defaults, schema and EXPLAIN.

Closes #6
…rations

- Controllers and Middleware -> src/Http, Commands -> src/Console/Commands
- digdeep-migrations publish tag
- fix: non-Laravel responses with status >= 400 no longer error in the profiler
- fix: digdeep:status crashed with a TypeError under strict_types

BREAKING CHANGE: LaravelPlus\DigDeep\{Controllers,Middleware,Commands} namespaces moved to Http\Controllers, Http\Middleware and Console\Commands.

Refs #21
…ommands, MCP

80 tests, 75% line coverage; CI fails under 70%.

Closes #22
…nd bodies

One Redactor (src/Support/Redactor.php) driven by config('digdeep.redact')
replaces three copies of key/header masking. It now also covers SQL
bindings (sensitive columns and hash-looking values), log context,
response bodies and outgoing HTTP client bodies. Response body capture
can be switched off with DIGDEEP_CAPTURE_RESPONSE_BODIES=false.

Closes #18
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d64485ec-6cbf-4f7f-b265-edca2c2903b6
Commits

Reviewing files that changed from the base of the PR and between f2ebd9d and b508fed.

Files selected for processing: 10
  • CHANGELOG.md
  • README.md
  • config/digdeep.php
  • src/Collectors/HttpClientCollector.php
  • src/Collectors/LogCollector.php
  • src/Collectors/QueryCollector.php
  • src/Http/Controllers/ApiController.php
  • src/Http/Middleware/ProfileRequest.php
  • src/Support/Redactor.php
  • tests/Feature/RedactorTest.php
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Nejcc
Nejcc changed the base branch from refactor/gh-21-package-structure to main October 31, 2026 15:00
@gitguardian

gitguardian Bot commented Oct 31, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
39354595 Triggered Laravel APP_KEY 7baa676 phpunit.xml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@Nejcc
Nejcc merged commit 84cd659 into main Oct 31, 2026
8 of 9 checks passed
@Nejcc
Nejcc deleted the fix/gh-18-shared-redactor branch November 2, 2026 07:48
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.

Redact SQL bindings, log context, mail and response bodies

1 participant