mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 13:31:13 -05:00
feat: Execute full production readiness plan
This commit is contained in:
@@ -76,19 +76,37 @@ export interface ContentSubmissionContent {
|
||||
*/
|
||||
export function isValidSubmissionContent(content: any): content is ContentSubmissionContent {
|
||||
if (!content || typeof content !== 'object') {
|
||||
console.error('❌ VIOLATION: content_submissions.content must be an object');
|
||||
// Security: Use logger instead of console.error to prevent PII exposure
|
||||
import('@/lib/logger').then(({ logger }) => {
|
||||
logger.error('Submission content validation failed', {
|
||||
violation: 'invalid_type',
|
||||
expected: 'object',
|
||||
received: typeof content
|
||||
});
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!['create', 'edit', 'delete'].includes(content.action)) {
|
||||
console.error('❌ VIOLATION: content_submissions.content must have valid action:', content.action);
|
||||
import('@/lib/logger').then(({ logger }) => {
|
||||
logger.error('Submission content validation failed', {
|
||||
violation: 'invalid_action',
|
||||
expected: 'create | edit | delete',
|
||||
received: content.action
|
||||
});
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
const keys = Object.keys(content);
|
||||
if (keys.length > 3) {
|
||||
console.error('❌ VIOLATION: content_submissions.content has too many fields:', keys);
|
||||
console.error(' Only action + max 2 reference IDs allowed');
|
||||
import('@/lib/logger').then(({ logger }) => {
|
||||
logger.error('Submission content validation failed', {
|
||||
violation: 'too_many_fields',
|
||||
count: keys.length,
|
||||
limit: 3
|
||||
});
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -96,8 +114,13 @@ export function isValidSubmissionContent(content: any): content is ContentSubmis
|
||||
const forbiddenKeys = ['name', 'description', 'photos', 'data', 'items', 'metadata'];
|
||||
const violations = keys.filter(k => forbiddenKeys.includes(k));
|
||||
if (violations.length > 0) {
|
||||
console.error('❌ VIOLATION: content_submissions.content contains forbidden keys:', violations);
|
||||
console.error(' These should be in submission_items.item_data instead');
|
||||
import('@/lib/logger').then(({ logger }) => {
|
||||
logger.error('Submission content validation failed', {
|
||||
violation: 'forbidden_keys',
|
||||
forbiddenKeys: violations,
|
||||
message: 'These should be in submission_items.item_data instead'
|
||||
});
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user