Skip to content
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

Pensar - auto fix for Sensitive Error Information Exposure in Page Management Functions #14

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/core/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export async function getAllPages(): Promise<Page[]> {
console.log("PAGES", pages);
return pageSchema.array().parse(pages);
} catch (error) {
console.error(`Could not get all pages ${error}`);
// Generic error message that doesn't expose implementation details
console.error("Error retrieving pages: Operation failed");
throw error;
}
}
Expand All @@ -31,7 +32,8 @@ export async function createPage(

return pageSchema.parse(newPage);
} catch (error) {
console.error(`Could not create page ${error}`);
// Generic error message that doesn't expose implementation details
console.error("Error creating page: Operation failed");
throw error;
}
}
Expand All @@ -51,7 +53,8 @@ export async function getPageByRoute(route: string): Promise<Page | null> {

return pageSchema.parse(page);
} catch (error) {
console.error(`Could not get page by route: ${route}. Error: ${error}`);
// Only include the route parameter as it's user-provided and not sensitive
console.error(`Error retrieving page with route '${route}': Operation failed`);
throw error;
}
}
Expand All @@ -60,4 +63,4 @@ export const pages = {
getAllPages,
createPage,
getPageByRoute,
};
};