Reject unauthenticated when no credentials#360
Open
heyitsaamir wants to merge 5 commits into
Open
Conversation
If a server is set up without any credentials, it currently will not be able to send messages, but it will accept all incoming requests. This scenario is rare, but possible, and in this PR we reject any incoming requests if credentials are not configured (and if skip_auth isn't explicitly set to True). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Tightens the default security posture of the Apps HttpServer by rejecting incoming requests when no app credentials are configured (unless skip_auth=True), addressing the case where a server could previously accept unauthenticated inbound traffic.
Changes:
- Reject incoming requests with
401whenskip_auth=Falseand no credentials/app ID are configured. - Add unit tests covering the “no credentials + skip_auth=False” rejection behavior.
- Minor test cleanup (rename handler argument in FastAPI adapter test).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/apps/src/microsoft_teams/apps/http/http_server.py | Adds initialization warning for missing credentials and enforces 401 rejection when auth isn’t configured and auth isn’t skipped. |
| packages/apps/tests/test_http_server.py | Adds test coverage ensuring requests are rejected when credentials are missing and skip_auth is false. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/teams.py/sessions/0f5b7128-a158-4a68-b142-9f772f93cdd2 Co-authored-by: heyitsaamir <48929123+heyitsaamir@users.noreply.github.com>
Contributor
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
corinagum
reviewed
Apr 13, 2026
- Reject path: the startup warning already covers the no-credentials case. Logging an error on every subsequent rejected request adds noise without new information. - Activity log: switch the f-string to %-style so formatting is lazy and skipped when the log level is disabled.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a server is set up without any credentials, it currently will not be able to send messages, but it will currently accept all incoming requests.
This scenario is rare, but possible, and in this PR we reject any incoming requests if creds are not setup (and if
skip_authisn't explicitly set toTrue).