Skip to content

Harden Durable HTTP trust boundaries - #221

Merged
andystaples merged 2 commits into
mainfrom
andystaples-fix-durable-http-security
Jul 29, 2026
Merged

Harden Durable HTTP trust boundaries#221
andystaples merged 2 commits into
mainfrom
andystaples-fix-durable-http-security

Conversation

@andystaples

Copy link
Copy Markdown
Contributor

Summary

  • strip managed identity tokens and sensitive headers when Durable HTTP redirects or polling cross origins
  • reject non-HTTP(S) redirect and polling targets
  • prevent clients from directly starting the internal HTTP polling orchestrator
  • add regression coverage for same-origin, cross-origin, multi-hop, and top-level invocation behavior

Validation

  • python -m pytest tests\azure-functions-durable -m "not dts and not azurite and not functions_e2e" -q
  • python -m flake8 azure-functions-durable
  • python -m flake8 tests\azure-functions-durable
  • python -m nox -s typecheck_functions

Fixes the security issues identified in the Durable HTTP implementation introduced by #155.

Prevent credentials from crossing origins during redirects and 202 polling, and reject direct starts of the internal poll orchestrator.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 09ea1d35-b7bd-4f4a-a243-763f29ea115f
Copilot AI review requested due to automatic review settings July 28, 2026 19:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the azure-functions-durable v2 Durable HTTP (“call_http”) implementation by tightening trust boundaries around redirects and 202-polling, preventing credential/header leakage across origins, and blocking direct client invocation of the internal polling orchestrator.

Changes:

  • Added an HTTP(S)-only redirect policy that strips sensitive headers on cross-origin redirects and rejects non-HTTP(S) redirect targets.
  • Hardened the Durable HTTP polling orchestrator to validate Location targets (absolute HTTP(S) after resolution), avoid forwarding credentials cross-origin, and reject top-level invocation.
  • Added regression tests for redirect header stripping, cross-origin polling behavior, and top-level invocation rejection; documented the security fix in the package changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
azure-functions-durable/azure/durable_functions/http/builtin.py Introduces origin parsing/comparison helpers, a secure redirect handler, stricter URL validation, and trust-boundary enforcement in the polling orchestrator.
tests/azure-functions-durable/test_http_builtin_compat.py Adds coverage for redirect credential stripping, cross-origin polling header/token behavior, and top-level orchestrator invocation rejection.
azure-functions-durable/CHANGELOG.md Documents the user-visible security hardening under ## Unreleased (FIXED).

Comment thread azure-functions-durable/azure/durable_functions/http/builtin.py
Comment thread tests/azure-functions-durable/test_http_builtin_compat.py
Comment thread azure-functions-durable/azure/durable_functions/http/builtin.py
Comment thread azure-functions-durable/azure/durable_functions/http/builtin.py Outdated
Comment thread azure-functions-durable/CHANGELOG.md
Strip proxy credentials across origins, preserve non-redirect response semantics, and document function-key polling behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 09ea1d35-b7bd-4f4a-a243-763f29ea115f
Copilot AI review requested due to automatic review settings July 29, 2026 03:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread tests/azure-functions-durable/test_http_builtin_compat.py

@berndverst berndverst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the follow-up commit and full diff. The Proxy-Authorization leak and redirect-validation regression are fixed with coverage, and the intentional same-origin x-functions-key polling behavior is now clearly documented. Targeted tests and cross-version redirect probes pass.

@andystaples
andystaples merged commit 70dbacd into main Jul 29, 2026
25 checks passed
@andystaples
andystaples deleted the andystaples-fix-durable-http-security branch July 29, 2026 05:00
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.

3 participants