Skip to content

test(config): add coverage for email/locale/general security fixes - #4782

Merged
objecttothis merged 1 commit into
masterfrom
fix-ConfigControllerTest-naming-and-tests
Oct 26, 2026
Merged

objecttothis merged 1 commit into
masterfrom
fix-ConfigControllerTest-naming-and-tests

Conversation

@objecttothis

@objecttothis objecttothis commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

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

Summary by CodeRabbit

  • Tests
    • Updated configuration controller test coverage to use a properly permissioned employee account and refreshed database setup. These changes improve the reliability of automated checks; they do not change the app’s behavior for end users.

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]>
@objecttothis objecttothis self-assigned this Oct 26, 2026
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 60bbfd4b-8140-4b5b-948d-e11f50450fb7
Commits

Reviewing files that changed from the base of the PR and between 42025e7 and e5f2385.

Files selected for processing: 1
  • tests/Controllers/ConfigControllerTest.php

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

The configuration controller test class was renamed and its setup now uses database and employee fixtures. The session uses an employee with config permission instead of a hard-coded employee ID.

Changes: Config controller tests

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: Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Possibly related PRs

Suggested reviewers: jekkos

Merge Risk: Minimal · up to e5f23

No actionable merge-blocking risk is established for this test-only change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 gener…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@objecttothis objecttothis added this to the 3.4.3 milestone Oct 26, 2026
@objecttothis

Copy link
Copy Markdown
Member Author

@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.

@objecttothis
objecttothis merged commit 9253cfe into master Oct 26, 2026
48 checks passed
@objecttothis
objecttothis deleted the fix-ConfigControllerTest-naming-and-tests branch October 26, 2026 14:12
@github-actions
github-actions Bot had a problem deploying to staging October 26, 2026 14:14 Failure
@github-actions

Copy link
Copy Markdown
Contributor

❌ Staging deployment failed

Check the workflow logs for details.

This branch had an error being deployed

1 failed deployment
staging — e5f2385a Deployed Oct 26, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants