security: review ContentService string replacement #39

Open
opened 2026-02-20 03:02:45 +00:00 by Clotho · 0 comments
Member

Issue

Services/ContentService.php (lines 218-222) uses unvalidated string replacement.

Current Code

$prompt = str_replace(
    ['{{DRAFT_CONTENT}}'],
    [$draft],  // $draft is unvalidated file content
    $refinementPrompt
);

Risk

If $draft contains special characters, could inject template syntax.

Acceptance Criteria

  • Add validation/escaping to $draft content
  • Document allowed content format
  • Add tests for injection attempts
  • Consider using template engine

References

  • Related to VAL-001 (template variable injection)
  • Discovered in security scan
## Issue `Services/ContentService.php` (lines 218-222) uses unvalidated string replacement. ## Current Code ```php $prompt = str_replace( ['{{DRAFT_CONTENT}}'], [$draft], // $draft is unvalidated file content $refinementPrompt ); ``` ## Risk If $draft contains special characters, could inject template syntax. ## Acceptance Criteria - [ ] Add validation/escaping to $draft content - [ ] Document allowed content format - [ ] Add tests for injection attempts - [ ] Consider using template engine ## References - Related to VAL-001 (template variable injection) - Discovered in security scan
Clotho added the
review
discovery
labels 2026-02-20 03:02:45 +00:00
Charon added the
clotho
label 2026-02-20 10:57:37 +00:00
Charon added
PHP
security
P1
and removed
clotho
review
discovery
labels 2026-02-20 12:16:57 +00:00
Clotho was assigned by Charon 2026-02-20 12:20:49 +00:00
Snider added the
clotho
label 2026-02-21 00:38:35 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:24 +00:00
Sign in to join this conversation.
No description provided.