fixing gitignore issue #2243
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!2243
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2243/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: #1663
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1663
Original created: 2025-09-26T17:29:26Z
Original updated: 2025-09-26T17:37:23Z
Original head: carverauto/serviceradar:fix/srql_rpm_build
Original base: main
Original merged: 2025-09-26T17:37:20Z by @mfreeman451
PR Type
Enhancement
Description
Add three new CLI executables for SRQL functionality
Implement WebSocket streaming endpoint for real-time queries
Add comprehensive query execution API with pagination support
Integrate environment-based configuration for Proton connections
Diagram Walkthrough
File Walkthrough
cli.ml
Basic SRQL translator CLIocaml/srql/bin/cli.ml
main.ml
Complete SRQL web server implementationocaml/srql/bin/main.ml
srql_cli.ml
Interactive SRQL CLI clientocaml/srql/bin/srql_cli.ml
dune
Dune build configuration for CLI toolsocaml/srql/bin/dune
srql-serverfor web server functionalitysrql-translatorfor basic translationsrql-clifor interactive client usageImported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1663#issuecomment-3339774386
Original created: 2025-09-26T17:30:11Z
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
Authentication/Authorization:
The WebSocket stream defaults to allowing any Origin and no API key/bearer unless env vars are set. In production this can expose real-time data. Consider default-deny: require SRQL_API_KEY and/or bearer by default, and restrict origins explicitly.
SQL injection: Several places build SQL by string concatenation:
While values often come from typed Proton columns and some escaping is done for strings, field names and table names are interpolated without quoting. If any of these can be influenced by user input (e.g., via query syntax mapping), this could allow injection. Ensure that:
Information disclosure: Error responses return Printexc.to_string exn to clients, which may leak internal details. Replace with sanitized messages while logging full errors server-side.
Security Config
The WebSocket endpoint allows any Origin by default and optional API key/bearer checks via env; defaults may expose streaming data unintentionally in production. Verify secure defaults and document required envs.
SQL Injection Risk
Cursor boundary building and FROM table wrapping concatenate SQL fragments directly; ensure identifiers and literals derived from cursor/order_by are sanitized and cannot be user-controlled unsafe values.
Error Handling
CLI swallows translation/execute errors by printing and returning unit with success exit code; consider proper exit codes to signal failure in scripts/CI.
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1663#issuecomment-3339782275
Original created: 2025-09-26T17:31:41Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Fix SQL injection vulnerability
Fix a SQL injection vulnerability in the
sql_literal_of_typedfunction by alwaysquoting and escaping
Proton.Column.Stringvalues, regardless of the associatedtype string.
ocaml/srql/bin/main.ml [90-98]
Suggestion importance[1-10]: 10
__
Why: The suggestion correctly identifies a critical SQL injection vulnerability in the cursor handling logic and provides an appropriate fix.
Re-implementing standard library features is risky
The PR adds custom Base64 encoding and decoding functions. It is recommended to
replace these with a standard, well-tested library to enhance reliability and
security while reducing code maintenance.
Examples:
ocaml/srql/bin/main.ml [609-643]
ocaml/srql/bin/main.ml [803-828]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies custom Base64 implementations which introduces unnecessary security risks and maintenance overhead; replacing this with a standard library is a critical improvement.
Use standard library for Base64
Replace the custom Base64 decoding logic in
decode_cursorwith a standardlibrary like
base64to improve robustness and maintainability.ocaml/srql/bin/main.ml [609-642]
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies that using a standard, well-tested library for Base64 decoding is preferable to a custom, potentially buggy implementation, improving code robustness and maintainability.
Improve command-line argument parsing
Improve the argument parsing in
srql_clito correctly handle queries containingspaces by collecting all non-flag arguments and joining them, rather than only
taking the first one.
ocaml/srql/bin/srql_cli.ml [24-64]
Suggestion importance[1-10]: 6
__
Why: The suggestion correctly identifies a limitation in the command-line argument parsing and proposes a more robust implementation that correctly handles multi-word queries.
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1663#issuecomment-3339800705
Original created: 2025-09-26T17:36:04Z
CI Feedback 🧐
A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
Action: build-test
Failed stage: Install dependencies (with tests) [❌]
Failure summary:
The action failed due to an OPAM package resolution conflict:
-
deps-of-srql-translator →mirage-crypto-rng-lwt >= 1.2.0 → mirage-crypto-rng = 1.2.0 → mirage-crypto = 1.2.0-
deps-of-srql-translator → proton >= 1.0.16 → mirage-crypto >= 2.0.2These constraints are
incompatible (require
mirage-crypto = 1.2.0vsmirage-crypto >= 2.0.2), so OPAM found no solutionand exited with code 20.
Relevant error logs: