Skip to content

fix(syslog): validate listener port range on save#276

Merged
xiami762 merged 1 commit into
devfrom
fix/syslog-port-range-validation
May 15, 2026
Merged

fix(syslog): validate listener port range on save#276
xiami762 merged 1 commit into
devfrom
fix/syslog-port-range-validation

Conversation

@duguwanglong
Copy link
Copy Markdown
Contributor

fix(syslog): validate listener port range on save

Follow-up to PR #267: the syslog config form already validated host but
accepted any integer for port, allowing values such as 0, 22, or 99999
to be saved and only blow up at bind time with a confusing OS error
(e.g. "[Errno 49] can't assign requested address").

- Backend SyslogConfigRequest.port now enforces ge=1, le=65535 via
  Pydantic so out-of-range ports are rejected with HTTP 422 before the
  config is persisted or the listener is restarted.
- IntegrationTab.tsx adds an inline validator that strictly matches a
  numeric string (rejecting "5140abc", "3.14", "-1", etc.) and the
  1..65535 range; the input shows a red border with a localized hint
  and the save button is disabled while the value is invalid.
- extractErrorMessage now flattens Pydantic 422 detail arrays
  ([{loc, msg, type}, ...]) into a readable "; "-joined string so
  scripted callers (or any caller that bypasses the UI validator)
  see the actual validation message instead of "[object Object]".
- Adds zh-CN/en-US copy for detail.run.syslogPortError.

Follow-up to PR #267: the syslog config form already validated host but
accepted any integer for port, allowing values such as 0, 22, or 99999
to be saved and only blow up at bind time with a confusing OS error
(e.g. "[Errno 49] can't assign requested address").

- Backend SyslogConfigRequest.port now enforces ge=1, le=65535 via
  Pydantic so out-of-range ports are rejected with HTTP 422 before the
  config is persisted or the listener is restarted.
- IntegrationTab.tsx adds an inline validator that strictly matches a
  numeric string (rejecting "5140abc", "3.14", "-1", etc.) and the
  1..65535 range; the input shows a red border with a localized hint
  and the save button is disabled while the value is invalid.
- extractErrorMessage now flattens Pydantic 422 detail arrays
  ([{loc, msg, type}, ...]) into a readable "; "-joined string so
  scripted callers (or any caller that bypasses the UI validator)
  see the actual validation message instead of "[object Object]".
- Adds zh-CN/en-US copy for detail.run.syslogPortError.

Co-authored-by: Cursor <cursoragent@cursor.com>
@duguwanglong duguwanglong requested a review from xiami762 May 15, 2026 06:08
@xiami762 xiami762 merged commit 003f071 into dev May 15, 2026
duguwanglong pushed a commit to DearEmma/flocks that referenced this pull request May 18, 2026
…ange-validation

fix(syslog): validate listener port range on save
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.

2 participants