-
Notifications
You must be signed in to change notification settings - Fork 0
Fix format string vulnerabilities in console logging (26 of 95 Semgrep issues) #278
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
Changes from all commits
9a82d4b
fdc8bc1
6448863
3b85096
bb14310
f89434b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -161,7 +161,7 @@ export class DatabaseJobQueue implements JobQueue { | |||||
|
|
||||||
| return true; | ||||||
| } catch (error) { | ||||||
| console.error(`Failed to update job status for ${jobId}:`, error); | ||||||
| console.error('Failed to update job status for', jobId, ':', error); | ||||||
| return false; | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -180,7 +180,7 @@ export class DatabaseJobQueue implements JobQueue { | |||||
|
|
||||||
| return true; | ||||||
| } catch (error) { | ||||||
| console.error(`Failed to update job progress for ${jobId}:`, error); | ||||||
| console.error('Failed to update job progress for', jobId, ':', error); | ||||||
| return false; | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -202,7 +202,7 @@ export class DatabaseJobQueue implements JobQueue { | |||||
|
|
||||||
| return true; | ||||||
| } catch (error) { | ||||||
| console.error(`Failed to complete job ${jobId}:`, error); | ||||||
| console.error('Failed to complete job', jobId, ':', error); | ||||||
| return false; | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -232,7 +232,7 @@ export class DatabaseJobQueue implements JobQueue { | |||||
|
|
||||||
| return true; | ||||||
| } catch (err) { | ||||||
| console.error(`Failed to fail job ${jobId}:`, err); | ||||||
| console.error('Failed to fail job', jobId, ':', err); | ||||||
| return false; | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -260,7 +260,7 @@ export class DatabaseJobQueue implements JobQueue { | |||||
|
|
||||||
| return true; | ||||||
| } catch (error) { | ||||||
| console.error(`Failed to cancel job ${jobId}:`, error); | ||||||
| console.error('Failed to cancel job', jobId, ':', error); | ||||||
| return false; | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -323,7 +323,7 @@ export class DatabaseJobQueue implements JobQueue { | |||||
|
|
||||||
| return true; | ||||||
| } catch (error) { | ||||||
| console.error(`Failed to retry job ${jobId}:`, error); | ||||||
| console.error('Failed to retry job', jobId, ':', error); | ||||||
|
||||||
| console.error('Failed to retry job', jobId, ':', error); | |
| console.error('Failed to retry job:', jobId, error); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -79,7 +79,7 @@ export class ResourceLoader { | |||||
|
|
||||||
| return buffer; | ||||||
| } catch (error) { | ||||||
| console.error(`Failed to download resource ${resource.id} from ${resource.url}:`, error); | ||||||
| console.error('Failed to download resource', resource.id, 'from', resource.url, ':', error); | ||||||
|
||||||
| console.error('Failed to download resource', resource.id, 'from', resource.url, ':', error); | |
| console.error(`Failed to download resource ${resource.id} from ${resource.url}`, error); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,14 +75,14 @@ export function sanitizeErrorMessage(error: unknown, context?: string): string { | |
| */ | ||
| export function logDetailedError(error: unknown, context?: string): void { | ||
| if (error instanceof Error) { | ||
| console.error(`[ERROR] ${context || 'Unhandled error'}:`, { | ||
| console.error('[ERROR]', context || 'Unhandled error', '-', { | ||
| message: error.message, | ||
| stack: error.stack, | ||
| name: error.name, | ||
| timestamp: new Date().toISOString(), | ||
| }); | ||
| } else { | ||
| console.error(`[ERROR] ${context || 'Unhandled error'}:`, { | ||
| console.error('[ERROR]', context || 'Unhandled error', '-', { | ||
|
Comment on lines
+78
to
+85
|
||
| error: String(error), | ||
| timestamp: new Date().toISOString(), | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -188,7 +188,7 @@ export async function loadDemoDocumentContent(document: DemoDocument): Promise<s | |||||
| return await response.text(); | ||||||
| } | ||||||
| } catch (error) { | ||||||
| console.error(`Failed to load demo document ${document.filename}:`, error); | ||||||
| console.error('Failed to load demo document', document.filename, ':', error); | ||||||
|
||||||
| console.error('Failed to load demo document', document.filename, ':', error); | |
| console.error(`Failed to load demo document ${document.filename}:`, error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The console.error format uses standalone colon ':' separators, which creates awkward output formatting (e.g., "[Alert Service] Failed to send alert via email : Error"). This is inconsistent with the cleaner format used in secure-storage.ts where colons are part of the message string. Consider using consistent formatting across all files in this PR.