feat: Execute full production readiness plan

This commit is contained in:
gpt-engineer-app[bot]
2025-10-20 17:43:21 +00:00
parent 4cc07be189
commit 53b2497e30
10 changed files with 55 additions and 32 deletions

View File

@@ -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;
}