feat(requests): add responseCertificatesFilter option#35
Conversation
Add responseCertificatesFilter to create Certificates tables based on a subset of returned values
📝 WalkthroughWalkthroughThis PR introduces selective TLS certificate field rendering via a new ChangesCertificate Field Filtering
Sequence DiagramsequenceDiagram
participant PrintResponseData
participant RequestConfig
participant RenderTLSData
participant CertsToTables
PrintResponseData->>RequestConfig: read ResponseCertificatesFilter
PrintResponseData->>RenderTLSData: call with filter argument
RenderTLSData->>RenderTLSData: extract first filter element
RenderTLSData->>CertsToTables: forward filter + peer certificates
CertsToTables->>CertsToTables: build index-to-fields lookup
CertsToTables->>CertsToTables: conditionally render selected fields
CertsToTables->>PrintResponseData: print filtered certificate output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
internal/cmd/embedded/config-example.yaml (1)
65-73: 💤 Low valueConsider enhancing the documentation comment.
The comment is clear but could be more helpful by mentioning that:
- Field matching is case-insensitive (per layer 2 implementation)
- Available fields correspond to certificate properties rendered in the certificate tables
- Multiple certificate indices can be specified (as shown in the standalone example)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/cmd/embedded/config-example.yaml` around lines 65 - 73, Update the responseCertificatesFilter YAML comment to clarify three points: state that field matching is case-insensitive (reflecting the layer 2 implementation), document that available field names map to the certificate properties shown in the certificate tables, and note that multiple certificate indices may be specified (referencing the standalone example for format). Mention these items concisely near the responseCertificatesFilter example so users know how to specify fields and indices.assets/examples/https-wrench-response-certificates-filter.yaml (1)
1-1: ⚡ Quick winConsider pinning schema to a specific version or release tag for stability.
The schema URL points to
refs/heads/main, which means examples will always pull the latest schema. While this keeps examples current, it can cause issues if the schema changes in breaking ways. The project currently has no versioned releases for the schema, but documenting this as a known limitation or creating release tags would help users avoid unexpected schema changes when copying examples.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@assets/examples/https-wrench-response-certificates-filter.yaml` at line 1, Example YAML currently references the live schema URL 'https://raw.githubusercontent.com/xenOs76/https-wrench/refs/heads/main/https-wrench.schema.json' which follows main and can break; update the header to point to a stable identifier (a release tag or a specific commit SHA) or, if releases are not available, add a comment above the header documenting this limitation and advising consumers to pin to a commit SHA when copying examples so schema changes won’t break existing examples.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@https-wrench.schema.json`:
- Around line 142-144: Add a JSON Schema dependency so that whenever the
responseCertificatesFilter property is present, printResponseCertificates must
be true; update the schema (near the existing responseCertificatesFilter array
definition) to include either a dependentRequired/dependencies rule or an
if/then that checks for presence of "responseCertificatesFilter" and enforces
"printResponseCertificates": true, referencing the properties
"responseCertificatesFilter" and "printResponseCertificates" so configs with the
filter cannot validate when printResponseCertificates is false.
---
Nitpick comments:
In `@assets/examples/https-wrench-response-certificates-filter.yaml`:
- Line 1: Example YAML currently references the live schema URL
'https://raw.githubusercontent.com/xenOs76/https-wrench/refs/heads/main/https-wrench.schema.json'
which follows main and can break; update the header to point to a stable
identifier (a release tag or a specific commit SHA) or, if releases are not
available, add a comment above the header documenting this limitation and
advising consumers to pin to a commit SHA when copying examples so schema
changes won’t break existing examples.
In `@internal/cmd/embedded/config-example.yaml`:
- Around line 65-73: Update the responseCertificatesFilter YAML comment to
clarify three points: state that field matching is case-insensitive (reflecting
the layer 2 implementation), document that available field names map to the
certificate properties shown in the certificate tables, and note that multiple
certificate indices may be specified (referencing the standalone example for
format). Mention these items concisely near the responseCertificatesFilter
example so users know how to specify fields and indices.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5b0ab2e8-2673-458e-9a40-11f2667384df
📒 Files selected for processing (8)
assets/examples/https-wrench-response-certificates-filter.yamlhttps-wrench.schema.jsoninternal/certinfo/certinfo_handlers.gointernal/certinfo/certinfo_handlers_test.gointernal/cmd/embedded/config-example.yamlinternal/requests/requests.gointernal/requests/requests_filter_test.gointernal/requests/requests_handlers.go
Add responseCertificatesFilter to create Certificates tables based on a subset of returned values
Summary by CodeRabbit
New Features
Documentation