Repository navigation
test(config): add coverage for email/locale/general security fixes - #4782
Conversation
Add ConfigControllerTest covering validation added to protect config save endpoints from injection and bypass attacks. - Mailpath validation: accept legit sendmail paths (with dots, trailing args), require mailpath when protocol is sendmail, reject command injection via shell metacharacters (e.g. semicolon) for both sendmail and non-sendmail protocols - postSaveLocale: verify payment_reference_code_min/max bounds (reject non-numeric, zero, negative, max < min; accept valid and min==max cases) - postSaveLocale: verify language_code allow-list enforcement against path traversal (forward/backslash variants), unknown languages, and case-mismatched codes (GHSA-related hardening) - postSaveGeneral: begin coverage of theme validation with a reusable base payload builder Signed-off-by: objecttothis <[email protected]>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Test bootstrap and session setup tests/Controllers/ConfigControllerTest.php |
The test class uses OSPOS configuration and database bootstrap, and employee fixture support. Setup resets the database, updates settings, and creates an employee with config permission for the session. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Other
Possibly related PRs
- opensourcepos/opensourcepos#4730: Adds tax-rate handling and tests to the configuration tests that were carried into this controller test class.
Suggested reviewers: jekkos
Merge Risk: 
Minimal · up to e5f23
-
No actionable merge-blocking risk is established for this test-only change.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title "test(config): add coverage for email/locale/general security fixes" matches the main change. The PR adds ConfigControllerTest coverage for config-save validation of email, locale, and general settings. The raw summary describes a rename of ConfigTest to ConfigControllerTest with new fixtures and session setup, and the PR objectives describe tests for sendmail, shell metacharacter rejection, payment reference bounds, language-code allow-list, and theme validation. The title names the test scope well. It says "security fixes," which the summary does not show as code fixes, so the wording slightly overstates the change. It is still mostly accurate.
-
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
@jekkos This branch is just renaming the test file to bring it into line with other controller test file naming and fixing the tests so they pass. They weren't being seeded correctly. All green. |
|
❌ Staging deployment failed Check the workflow logs for details. |
Add ConfigControllerTest covering validation added to protect config save endpoints from injection and bypass attacks.
Summary by CodeRabbit