RCON GetDvar: normalize CoD4x responses for unknown-cvar and color-coded values#981
Conversation
Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
⛔ Superseded — A newer run has replaced this result.⛔ Superseded — A newer run has replaced this result.🏗️ Terraform Plan
✅ Validate — Passed ✅ Plan
|
There was a problem hiding this comment.
Pull request overview
This PR normalizes GetDvar RCON responses so CoD/Quake-style color-coded output is parsed consistently and unknown dvars are returned as not found.
Changes:
- Adds compiled regex-based response normalization in
RconController.GetDvar. - Maps
Bad command or cvar:responses toDVAR_NOT_FOUND. - Adds focused unit tests for unknown dvars and numeric/alphabetic color-code stripping.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/XtremeIdiots.Portal.Integrations.Servers.Api.V1/Controllers/V1/RconController.cs |
Normalizes GetDvar responses, strips Quake color codes, and returns not-found for unknown cvars. |
src/XtremeIdiots.Portal.Integrations.Servers.Api.V1/Constants/ErrorCodes.cs |
Adds DVAR_NOT_FOUND error code. |
src/XtremeIdiots.Portal.Integrations.Servers.Api.Tests.V1/Controllers/RconControllerTests.cs |
Adds unit tests covering CoD4x unknown-cvar and color-code normalization behavior. |
|
@copilot - you need to pass a timeout in for the regex to fix the sonarcloud failures on the sonarcloud code analysis quality gate |
Co-authored-by: frasermolyneux <34033625+frasermolyneux@users.noreply.github.com>
Implemented in |
⛔ Superseded — A newer run has replaced this result.🏗️ Terraform Plan
✅ Validate — Passed ✅ Plan
|
🏗️ Terraform Plan
✅ Validate — Passed ✅ Plan
📋 Resource Details
|
|



GetDvarcould return raw RCON output when the quoted dvar format did not match, which breaks CoD4x behavior. This change normalizes CoD4x response text so unknown cvars map to not-found and returned values are stripped of Quake-style color tokens.Response normalization in
RconController.GetDvar^0-^9,^a-^z,^A-^Z).Unknown-cvar mapping
Bad command or cvar:.Error contract extension
DVAR_NOT_FOUNDtoErrorCodesfor explicit not-found semantics on dvar lookups.Focused unit coverage
RconControllerTestsfor: