dabla commented on code in PR #71842:
URL: https://github.com/apache/airflow/pull/71842#discussion_r3874770574
##########
providers/microsoft/azure/src/airflow/providers/microsoft/azure/triggers/msgraph.py:
##########
@@ -182,6 +188,9 @@ def hook(self) -> KiotaRequestAdapterHook:
async def run(self) -> AsyncIterator[TriggerEvent]:
"""Make a series of asynchronous HTTP calls via a
KiotaRequestAdapterHook."""
try:
+ if self.pagination_link:
Review Comment:
**[warning]** The `pagination_link=True` guard in `MSGraphTrigger.run()` has
no direct unit test in `tests/triggers/test_msgraph.py`.
The new code path:
```python
if self.pagination_link:
await self.hook.assert_allowed_host(self.url)
```
is exercised end-to-end only through
`test_pagination_refuses_cross_host_next_link` in the operator test, which goes
through the full operator → trigger → hook stack. A regression in the trigger
layer — for example, someone accidentally removing the guard or moving the
check after `hook.run()` — would not be caught by the trigger tests. A minimal
direct test:
```python
@pytest.mark.asyncio
async def test_run_with_pagination_link_refuses_cross_host_url(self):
with patch_hook_and_request_adapter(mock_json_response(200, {})):
trigger = MSGraphTrigger(
url="https://attacker.example/v1.0/users",
conn_id="msgraph_api",
pagination_link=True,
)
events = [event async for event in trigger.run()]
assert len(events) == 1
assert events[0].payload["status"] == "failure"
assert "attacker.example" in events[0].payload["message"]
```
---
Drafted-by: Claude Sonnet 4.6 (claude-sonnet-4.6); reviewed by @dabla before
posting
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]