Skip to content

restrict msgraph pagination nextLink to the configured host#69742

Open
Samin061 wants to merge 2 commits into
apache:mainfrom
Samin061:msgraph-nextlink-host-check
Open

restrict msgraph pagination nextLink to the configured host#69742
Samin061 wants to merge 2 commits into
apache:mainfrom
Samin061:msgraph-nextlink-host-check

Conversation

@Samin061

Copy link
Copy Markdown
Contributor

paginated_run follows the @odata.nextLink from each Microsoft Graph response and refetches it with the connection's bearer token attached, while Kiota's allowed_hosts defaults to empty (any host) when no authority is set, so a tampered response can send the token to an arbitrary host. Pin follow-up pagination requests to the configured endpoint's host and refuse a nextLink that points elsewhere.

# ``allowed_hosts``, which defaults to empty (any host) unless configured, so a tampered
# response could redirect the token off-host. Pin follow-up requests to the configured
# endpoint's host (CWE-918).
allowed_netloc = urlparse((await self.get_async_conn()).base_url).netloc

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.

I don't think allowed_netloc should be initialized here. The variable itself makes sense, but it should be computed inside the async run() method where it's actually used. Initializing it here unnecessarily couples this code to the connection lookup and may perform work earlier than needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, moved it inside run() so the lookup only happens when pagination actually runs.

Signed-off-by: bibi samina <sam@bugqore.com>
@potiuk

potiuk commented Jul 11, 2026

Copy link
Copy Markdown
Member

@Samin061 — Some review feedback from @dabla is waiting on you: 1 unresolved review thread(s). Could you either push a fix or reply in each thread explaining why the feedback doesn't apply? When you believe the feedback is addressed, please mark the threads as resolved and ping the reviewer (@dabla) for a final look. Thanks!


Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants