2672 bugsrql cant search inflows dst port #2836
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2836
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2836/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #2677
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/2677
Original created: 2026-02-03T02:04:08Z
Original updated: 2026-02-03T02:06:09Z
Original head: carverauto/serviceradar:2672-bugsrql-cant-search-inflows-dst_port
Original base: staging
Original merged: 2026-02-03T02:05:35Z by @mfreeman451
User description
IMPORTANT: Please sign the Developer Certificate of Origin
Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include
a DCO sign-off statement indicating the DCO acceptance in one commit message. Here
is an example DCO Signed-off-by line in a commit message:
Describe your changes
Issue ticket number and link
Code checklist before requesting a review
PR Type
Bug fix, Tests
Description
Enable wildcard pattern matching for port filters in SRQL flows queries
Support Like/NotLike operators for src_port and dst_port fields
Cast port columns to text for wildcard matching while preserving integer validation for equality operators
Add comprehensive tests for wildcard port filtering and validation behavior
Diagram Walkthrough
File Walkthrough
flows.rs
Add wildcard port filter support with text castingrust/srql/src/query/flows.rs
diesel::dsl::sqlanddiesel::sql_types::Texttosupport text casting
apply_filterfunction to handle Like/NotLike operators forsrc_port and dst_port by casting to text
collect_port_paramshelper function to handle parameterbinding for both integer and text port values
rejection with equality, and text parameter binding verification
proposal.md
OpenSpec proposal for wildcard port filtersopenspec/changes/fix-srql-flow-port-wildcards/proposal.md
integer validation error
%patterns for port fields with like-styleoperators
operators
spec.md
OpenSpec requirements for port wildcard patternsopenspec/changes/fix-srql-flow-port-wildcards/specs/srql/spec.md
matching, and integer validation for equality
integer values
tasks.md
OpenSpec implementation and testing tasksopenspec/changes/fix-srql-flow-port-wildcards/tasks.md
binding
behavior
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2677#issuecomment-3838440701
Original created: 2026-02-03T02:04:41Z
PR Compliance Guide 🔍
Below is a summary of compliance checks for this PR:
No security concerns identified
No security vulnerabilities detected by AI analysis. Human verification advised for critical code.🎫 #2672
dst_portusing wildcard patterns (e.g.,dst_port:%443%) without raising an "must be an integer" error.dst_portmust remain enforced for equality-style comparisons (e.g.,dst_port:443), rejecting non-integers.in:flows time:last_24hdst_port:%443% sort:time:desc limit:50(not just query-building tests).Codebase context is not defined
Follow the guide to enable codebase context checks.
Generic: Comprehensive Audit Trails
Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.
Status: Passed
Generic: Meaningful Naming and Self-Documenting Code
Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting
Status: Passed
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status: Passed
Generic: Secure Error Handling
Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.
Status: Passed
Generic: Secure Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
Status: Passed
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities
Status:
Raw SQL expression: The new wildcard port filtering uses
diesel::dsl::sql::<Text>("...::text"), which is safe here because thefragment is constant, but it requires human verification that no user-controlled SQL can
reach this path and that parameter binding is always preserved.
Referred Code
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/2677#issuecomment-3838449622
Original created: 2026-02-03T02:06:09Z
PR Code Suggestions ✨
Explore these optional code suggestions:
The change may cause performance issues
Casting integer port columns to text for wildcard searches will bypass database
indexes, causing poor performance. To fix this, create function-based indexes on
the text-casted columns.
Examples:
rust/srql/src/query/flows.rs [188]
rust/srql/src/query/flows.rs [218]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies a critical performance issue where casting port columns to text (
::text) for wildcard searches will prevent index usage, leading to full table scans on a potentially large table.Support list operators for ports
Implement support for
InandNotInlist operators for port filters to align withthe PR's specification, which requires integer-only list operations.
rust/srql/src/query/flows.rs [203-230]
Suggestion importance[1-10]: 9
__
Why: This suggestion correctly identifies that the implementation is missing support for list operators (
In,NotIn) on port fields, which is explicitly required by the specification document included in this PR.Add NotLike wildcard port test
Add a new unit test to verify that wildcard filters using the
NotLikeoperatoron port fields bind parameters correctly, improving test coverage.
rust/srql/src/query/flows.rs [694-719]
[To ensure code accuracy, apply this suggestion manually]Suggestion importance[1-10]: 7
__
Why: The suggestion correctly points out that while the implementation supports
NotLike, there is no corresponding test case to ensure its correctness, which is a valuable addition for test coverage.Refactor duplicated code into a function
Refactor the duplicated logic for
src_portanddst_portfilters into a singlehelper function to improve maintainability and reduce redundancy.
rust/srql/src/query/flows.rs [172-231]
Suggestion importance[1-10]: 6
__
Why: The suggestion correctly identifies significant code duplication between
src_portanddst_portfilter handling and proposes a valid refactoring into a helper function, which would improve code maintainability.Use Diesel cast for text
Replace the raw SQL
::textcast with Diesel's built-indsl::castfunction forimproved type safety and code clarity when casting port columns.
rust/srql/src/query/flows.rs [188]
Suggestion importance[1-10]: 5
__
Why: The suggestion correctly proposes using Diesel's type-safe
castfunction instead of a raw SQL string, which improves code clarity and leverages the ORM's features more effectively.Remove unreachable code from match statement
Remove an unreachable code branch in the
matchstatement forfilter.opandsimplify the logic to an
if-elseblock.rust/srql/src/query/flows.rs [186-194]
Suggestion importance[1-10]: 4
__
Why: The suggestion correctly identifies unreachable code within a
matchstatement and proposes a simplification, which is a valid but minor code quality improvement.