Skip to content

security: replace string eval with safe module loading#17

Draft
Koan-Bot wants to merge 1 commit into
atoomic:masterfrom
Koan-Bot:koan.atoomic/remove-string-eval
Draft

security: replace string eval with safe module loading#17
Koan-Bot wants to merge 1 commit into
atoomic:masterfrom
Koan-Bot:koan.atoomic/remove-string-eval

Conversation

@Koan-Bot

@Koan-Bot Koan-Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

What

Replace unsafe string eval patterns with safe alternatives across three modules.

Why

eval qq{ require $pkg } performs string evaluation — if $pkg ever contains
injected content, it becomes arbitrary code execution. While current inputs come
from internal config (low practical risk), the pattern is objectively unsafe and
unnecessary. Perl's require accepts file paths directly via eval { require $file }.

How

  • API.pm: eval qq{ require $pkg; 1 }eval { require $file; 1 } (path-based)
  • Service.pm: same transformation for specs module loading
  • DataAsYaml.pm: eval '\*' . $pkg . '::DATA'do { no strict 'refs'; \*{"${pkg}::DATA"} }
  • Removed defunct .travis.yml (superseded by GitHub Actions in PR ci: add GitHub Actions CI workflow #6)
  • Added .env*, .DS_Store, IDE directories to .gitignore

Testing

Full test suite passes (make test). No behavioral change — only the eval mechanism differs.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com


Quality Report

Changes: 5 files changed, 12 insertions(+), 35 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Replace `eval qq{ require $pkg }` with path-based `eval { require $file }`
in API.pm and Service.pm to eliminate string eval code injection vectors.
Replace symbolic reference string eval in DataAsYaml.pm with explicit
`no strict 'refs'` block.

Also remove defunct .travis.yml (superseded by GitHub Actions CI) and
add common patterns to .gitignore (.env*, .DS_Store, IDE directories).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant