@@ -336,6 +336,24 @@ class ClerkEncryptedApiService {
336336 ) ;
337337 }
338338
339+ // CRITICAL SECURITY CHECK: Ensure no unencrypted title/content is being sent
340+ if ( notePayload . title && notePayload . title !== "[ENCRYPTED]" ) {
341+ throw new SecureError (
342+ 'Attempted to send unencrypted title in note creation' ,
343+ 'Security violation: unencrypted data detected' ,
344+ 'CRYPTO_001' ,
345+ 'critical'
346+ ) ;
347+ }
348+ if ( notePayload . content && notePayload . content !== "[ENCRYPTED]" ) {
349+ throw new SecureError (
350+ 'Attempted to send unencrypted content in note creation' ,
351+ 'Security violation: unencrypted data detected' ,
352+ 'CRYPTO_001' ,
353+ 'critical'
354+ ) ;
355+ }
356+
339357 const apiNote = await this . request < ApiNote > ( '/notes' , {
340358 method : 'POST' ,
341359 body : JSON . stringify ( notePayload ) ,
@@ -405,6 +423,24 @@ class ClerkEncryptedApiService {
405423 }
406424 } ) ;
407425
426+ // CRITICAL SECURITY CHECK: Ensure no unencrypted title/content is being sent
427+ if ( cleanedUpdates . title && cleanedUpdates . title !== "[ENCRYPTED]" ) {
428+ throw new SecureError (
429+ 'Attempted to send unencrypted title in note update' ,
430+ 'Security violation: unencrypted data detected' ,
431+ 'CRYPTO_001' ,
432+ 'critical'
433+ ) ;
434+ }
435+ if ( cleanedUpdates . content && cleanedUpdates . content !== "[ENCRYPTED]" ) {
436+ throw new SecureError (
437+ 'Attempted to send unencrypted content in note update' ,
438+ 'Security violation: unencrypted data detected' ,
439+ 'CRYPTO_001' ,
440+ 'critical'
441+ ) ;
442+ }
443+
408444 const requestBody = JSON . stringify ( cleanedUpdates ) ;
409445
410446 const apiNote = await this . request < ApiNote > ( `/notes/${ id } ` , {
0 commit comments