-
Notifications
You must be signed in to change notification settings - Fork 6
add client mutation functions [sc-2035] #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| this.snapcastService.refreshState(); // Refresh the server state to get the latest data | ||
| }, | ||
| error: (err) => { | ||
| console.error(`ClientDetailsPage: Failed to refresh client ${this.id}`, err); |
Check failure
Code scanning / CodeQL
Use of externally-controlled format string High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 months ago
To address the issue, the id value should be sanitized or validated before being used in the log message. A simple and effective approach is to explicitly cast the id to a string and escape any potentially harmful characters. Alternatively, the %s format specifier can be used in the log message to ensure that the id is treated as a string.
The fix involves:
- Updating the log message on line 110 to use a
%sformat specifier and passing theidas a separate argument. - Ensuring that the
idis properly sanitized or validated before use.
-
Copy modified line R110
| @@ -109,3 +109,3 @@ | ||
| error: (err) => { | ||
| console.error(`ClientDetailsPage: Failed to refresh client ${this.id}`, err); | ||
| console.error('ClientDetailsPage: Failed to refresh client %s', this.id, err); | ||
| } |
| return this.rpc('Client.GetStatus', { id }).pipe( | ||
| map(response => response.result as Client | undefined), | ||
| catchError(err => { | ||
| console.error(`SnapcastService: Failed to get status for client ${id}`, err); |
Check failure
Code scanning / CodeQL
Use of externally-controlled format string High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 months ago
To fix the issue, the untrusted id parameter should be passed as a separate argument to the format string using the %s specifier. This ensures that the id is treated as a string and prevents any unintended format specifiers from being interpreted. The fix involves modifying the console.error statement on line 375 of src/app/services/snapcast.service.ts.
-
Copy modified line R375
| @@ -374,3 +374,3 @@ | ||
| catchError(err => { | ||
| console.error(`SnapcastService: Failed to get status for client ${id}`, err); | ||
| console.error('SnapcastService: Failed to get status for client %s', id, err); | ||
| return throwError(() => err); |
No description provided.