Skip to content

Commit 085a400

Browse files
committed
fix: resolve CodeQL clear-text logging alerts by removing sensitive data from logs
1 parent cd1d402 commit 085a400

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

frontend/src/components/settings/ApiKeyManager.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const ApiKeyManager = ({ canGenerate }) => {
8484
if (providersResponse.status === 'fulfilled') {
8585
setProviders(providersResponse.value.data || []);
8686
} else {
87-
console.error("Failed to fetch providers:", providersResponse.reason);
87+
console.error("Failed to fetch providers:", providersResponse.reason?.message || providersResponse.reason);
8888
setProviders([]);
8989
}
9090

@@ -95,7 +95,7 @@ const ApiKeyManager = ({ canGenerate }) => {
9595
const existingScalytics = userKeys.some(key => key.provider_name === 'Scalytics API');
9696
setHasExistingScalyticsKey(existingScalytics);
9797
} else {
98-
console.error("Failed to fetch user API keys:", apiKeysResponse.reason);
98+
console.error("Failed to fetch user API keys:", apiKeysResponse.reason?.message || apiKeysResponse.reason);
9999
setApiKeys([]);
100100
setHasExistingScalyticsKey(false);
101101
}
@@ -107,7 +107,7 @@ const ApiKeyManager = ({ canGenerate }) => {
107107
(userData.groups && userData.groups.some(g => g.name.toLowerCase() === 'administrator')));
108108
setIsAdmin(userIsAdmin);
109109
} else {
110-
console.error("Failed to fetch user info:", userInfoResponse.reason);
110+
console.error("Failed to fetch user info:", userInfoResponse.reason?.message || userInfoResponse.reason);
111111
setIsAdmin(false);
112112
}
113113
} catch (err) {

frontend/src/setupTests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ console.error = (...args) => {
2323
if (typeof args[0] === 'string' && args[0].includes('not wrapped in act(...)')) {
2424
return;
2525
}
26+
// CodeQL [js/clear-text-logging] - Intentional wrapper for test environment silencing
2627
originalError(...args);
2728
};

src/controllers/deepSearchApiController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ const initiateDeepSearchStream = async (req, res, next) => {
365365
});
366366

367367
if (missingKeys.length > 0) {
368-
console.error(`[DeepSearchAPI:${apiTaskId}] Missing or invalid required API keys: ${missingKeys.join(', ')} in api_config:`, api_config);
368+
console.error(`[DeepSearchAPI:${apiTaskId}] Missing or invalid required API keys: ${missingKeys.join(', ')}`);
369369
return next(new APIError(`Missing or invalid API keys: ${missingKeys.join(', ')}. Please ensure these are configured in your account or system.`, 400));
370370
}
371371

src/controllers/liveSearchApiController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ const initiateLiveSearchStream = async (req, res, next) => {
347347
});
348348

349349
if (missingKeys.length > 0) {
350-
console.error(`[DeepSearchAPI:${apiTaskId}] Missing or invalid required API keys: ${missingKeys.join(', ')} in api_config:`, api_config);
350+
console.error(`[DeepSearchAPI:${apiTaskId}] Missing or invalid required API keys: ${missingKeys.join(', ')}`);
351351
return next(new APIError(`Missing or invalid API keys: ${missingKeys.join(', ')}. Please ensure these are configured in your account or system.`, 400));
352352
}
353353

0 commit comments

Comments
 (0)