Skip to content

Hide exception details in mock integration server responses - #482

Merged
Rodrigo Brandão (rodrigobr-msft) merged 4 commits into
mainfrom
copilot/fix-code-scanning-alert-17
Jul 22, 2026
Merged

Hide exception details in mock integration server responses#482
Rodrigo Brandão (rodrigobr-msft) merged 4 commits into
mainfrom
copilot/fix-code-scanning-alert-17

Conversation

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This change addresses a CodeQL finding in the testing infrastructure where the mock HTTP agent server could return raw exception text to clients. The handler now returns a generic 500 response while preserving the existing failure path.

  • Scope

    • Updates the mock server used by dev/microsoft-agents-testing integration tests.
    • Removes exception-message reflection from HTTP responses.
  • Behavior change

    • Replaces externally visible exception text with a fixed internal error message.
    • Keeps the response contract simple and deterministic for error cases.
  • Implementation

    except Exception:
        return Response(status=500, text="Internal server error")

Copilot AI requested review from Copilot and removed request for Copilot July 21, 2026 20:32
Copilot AI changed the title [WIP] Fix code scanning alert 17 Hide exception details in mock integration server responses Jul 21, 2026
@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) marked this pull request as ready for review July 21, 2026 20:33
Copilot AI review requested due to automatic review settings July 21, 2026 20:33

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 updates the dev/microsoft-agents-testing integration-test mock HTTP agent server to avoid reflecting raw exception text back to HTTP clients, addressing a security/code-scanning concern (e.g., CodeQL) while preserving the same error status behavior.

Changes:

  • Replace Response(status=500, text=str(e)) with a fixed generic message ("Internal server error") when the mock server handler hits an unexpected exception.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings July 22, 2026 17:25

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 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread dev/microsoft-agents-testing/tests/core/test_integration.py
Copilot AI review requested due to automatic review settings July 22, 2026 17: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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

dev/microsoft-agents-testing/tests/core/test_integration.py:143

  • The exception is no longer returned to the client (good), but it is now fully swallowed without being logged. That can make integration test failures difficult to diagnose because the only visible error becomes the generic 500 body.
        except Exception:
            return Response(status=500, text="Internal server error")

@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) merged commit 37c4e77 into main Jul 22, 2026
10 of 11 checks passed
@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) deleted the copilot/fix-code-scanning-alert-17 branch July 22, 2026 17:43
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.

4 participants