Skip to content

Conversation

@Idrimi
Copy link
Contributor

@Idrimi Idrimi commented Jul 27, 2025

No description provided.

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

Format string depends on a
user-provided value
.

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:

  1. Updating the log message on line 110 to use a %s format specifier and passing the id as a separate argument.
  2. Ensuring that the id is properly sanitized or validated before use.

Suggested changeset 1
src/app/pages/clients/client-details/client-details.page.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/app/pages/clients/client-details/client-details.page.ts b/src/app/pages/clients/client-details/client-details.page.ts
--- a/src/app/pages/clients/client-details/client-details.page.ts
+++ b/src/app/pages/clients/client-details/client-details.page.ts
@@ -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);
       }
EOF
@@ -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);
}
Copilot is powered by AI and may make mistakes. Always verify output.
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

Format string depends on a
user-provided value
.

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.

Suggested changeset 1
src/app/services/snapcast.service.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/app/services/snapcast.service.ts b/src/app/services/snapcast.service.ts
--- a/src/app/services/snapcast.service.ts
+++ b/src/app/services/snapcast.service.ts
@@ -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);
EOF
@@ -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);
Copilot is powered by AI and may make mistakes. Always verify output.
@Idrimi Idrimi merged commit 731067a into master Jul 27, 2025
2 of 3 checks passed
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