Skip to content

fix(cachebust): prevent shell injection in purge paths - #687

Draft
petrsimon wants to merge 1 commit into
RedHatInsights:mainfrom
petrsimon:fix/cachebust-injection-hardening
Draft

fix(cachebust): prevent shell injection in purge paths#687
petrsimon wants to merge 1 commit into
RedHatInsights:mainfrom
petrsimon:fix/cachebust-injection-hardening

Conversation

@petrsimon

Copy link
Copy Markdown
Contributor

Summary

  • Paths supplied via akamaiCacheBustPaths were previously interpolated directly into a shell command string, allowing a malicious path value to execute arbitrary shell code in the cache-bust Job container.
  • Paths are now passed as separate Container.Args entries via bash "$@", so no shell interpolation occurs.
  • A IsValidCacheBustPath validator (allowlist regex) filters any path that contains shell metacharacters at reconcile time, with a log warning per invalid entry.
  • CRD field gains a +kubebuilder:validation pattern annotation so the API server can reject obviously malformed values at admission.
  • New unit test file controllers/reconcile_cachebust_test.go (276 lines) covers normal paths, full URLs, deduplication, rejection of shell metacharacters, and edge cases.

Test plan

  • make test — unit tests pass including new TestCreateCachePurgePathList cases
  • make lint — no new lint errors
  • make generate && make manifests — CRD YAML updated for pattern annotation
  • E2E kuttl: cachebust and cachebust-multiple-urls assert files updated to match new container command/args shape
  • Manual: deploy with a crafted path containing $(...) — operator logs skip message, path absent from Job args

@petrsimon
petrsimon force-pushed the fix/cachebust-injection-hardening branch from b67d781 to 380c6b2 Compare August 24, 2026 12:06
Pass akamaiCacheBustPaths as container Args via "$@" instead of
interpolating into a shell string, and validate paths at CRD and
runtime.
@petrsimon
petrsimon force-pushed the fix/cachebust-injection-hardening branch from 380c6b2 to d011197 Compare August 24, 2026 12:34
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