Skip to content

fix(activesync): harden Autodiscover v2 (JSON) response handling#71

Merged
TDannhauer merged 1 commit into
FRAMEWORK_6_0from
feat/activesync-autodiscover-v2-json
Jun 25, 2026
Merged

fix(activesync): harden Autodiscover v2 (JSON) response handling#71
TDannhauer merged 1 commit into
FRAMEWORK_6_0from
feat/activesync-autodiscover-v2-json

Conversation

@TDannhauer

Copy link
Copy Markdown
Contributor

Summary

  • Guard the Autodiscover v2 (JSON) endpoint against requests omitting the required Protocol parameter (default ActiveSync).
  • Build the v2 JSON body with json_encode() (JSON_UNESCAPED_SLASHES) instead of hand-rolled string concatenation.
  • Add unit tests for the v2 JSON branch.

Motivation

The v2 handler read getGetVars()['Protocol'] directly, which raises an undefined-index warning when a client omits the parameter, and assembled the JSON response by hand (no escaping). Modern clients (recent iOS, Outlook) probe the v2 JSON endpoint first, so it should respond robustly.

Changes

  • lib/Horde/ActiveSync/Request/Autodiscover.php: protocol guard + json_encode().
  • test/unit/Horde/ActiveSync/AutodiscoverTest.php: two new tests (happy path + missing Protocol).

Test plan

  • phpunit --filter Autodiscover -> 4 tests, 8 assertions, green

Guard the unauthenticated Autodiscover v2 endpoint against clients that
omit the required Protocol query parameter (defaulting to ActiveSync)
instead of reading an undefined array index, and build the JSON body with
json_encode() (JSON_UNESCAPED_SLASHES) rather than manual string
concatenation.

Add unit tests for the v2 JSON branch (happy path and missing Protocol).
@TDannhauer TDannhauer requested a review from ralflang June 24, 2026 17:22
@TDannhauer TDannhauer merged commit 766d7e8 into FRAMEWORK_6_0 Jun 25, 2026
0 of 4 checks passed
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