security: validate template variable injection #5

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

Issue

Location: Services/PlanTemplateService.php::substituteVariables()
Risk: Special characters in variables could corrupt JSON structure

Current Behavior

Template variable substitution uses escapeForJson but lacks comprehensive input sanitisation. Malicious variable values could potentially inject template syntax.

Expected Behavior

Variable values should be validated against allowed character sets before substitution.

Acceptance Criteria

  • Validate variable values against allowed character sets
  • Reject malicious variable values with clear error message
  • Add tests for injection attempts
  • Document allowed character set

References

  • TODO.md: VAL-001
  • Related: ContentService.php:218-222 has similar string replacement
## Issue **Location:** `Services/PlanTemplateService.php::substituteVariables()` **Risk:** Special characters in variables could corrupt JSON structure ## Current Behavior Template variable substitution uses `escapeForJson` but lacks comprehensive input sanitisation. Malicious variable values could potentially inject template syntax. ## Expected Behavior Variable values should be validated against allowed character sets before substitution. ## Acceptance Criteria - [ ] Validate variable values against allowed character sets - [ ] Reject malicious variable values with clear error message - [ ] Add tests for injection attempts - [ ] Document allowed character set ## References - TODO.md: VAL-001 - Related: `ContentService.php:218-222` has similar string replacement
Clotho added the
review
discovery
labels 2026-02-20 03:01:52 +00:00
Charon added the
clotho
label 2026-02-20 10:57:36 +00:00
Charon added
PHP
security
P1
and removed
clotho
review
discovery
labels 2026-02-20 12:17:05 +00:00
Clotho was assigned by Charon 2026-02-20 12:20:51 +00:00
Snider added the
clotho
label 2026-02-21 00:39:09 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:37 +00:00
Sign in to join this conversation.
No description provided.