Skip to content

Python: Document x5t certificate thumbprint hashing in Copilot Studio agent - #14270

Merged
SergeyMenshykh merged 2 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-python-annotate-x5t-thumbprint-hash
Aug 5, 2026
Merged

SergeyMenshykh merged 2 commits into
microsoft:mainfrom
SergeyMenshykh:sergeymenshykh-python-annotate-x5t-thumbprint-hash

Conversation

@SergeyMenshykh

Copy link
Copy Markdown
Contributor

Motivation and Context

_CopilotStudioAgentTokenFactory._cert_thumbprint computes the X.509 certificate thumbprint that is passed to MSAL as the thumbprint client credential. This value is the JWT x5t header, which MSAL and Microsoft Entra ID require to be a SHA-1 digest - any other digest would be rejected by the token endpoint.

Because it is a plain digest call, static analysis tooling flags it even though the hash is used purely as a certificate identifier, not as a cryptographic/security primitive (the call already passes usedforsecurity=False).

Description

Adds a comment explaining why SHA-1 is required here and annotates the call so static analysis does not flag it. No behavior change.

Note: MSAL itself carries the same annotation on its own x5t fingerprint computation.

Contribution Checklist

… agent

The certificate thumbprint sent to MSAL is the X.509 `x5t` value, which
MSAL and Microsoft Entra ID require to be computed with SHA-1. Add a comment
explaining that this is an identifier, not a security primitive, and annotate
the call so static analysis does not flag it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d2b7d3e7-a125-4569-b976-a6534c1837ae
Copilot AI lite review requested due to automatic review settings August 4, 2026 19:35
@SergeyMenshykh
SergeyMenshykh requested a review from a team as a code owner August 4, 2026 19:35
@SergeyMenshykh SergeyMenshykh self-assigned this Aug 4, 2026

@github-actions github-actions Bot 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.

Automated Code Review

Reviewers: 1 | Confidence: 46% | Result: All clear

Reviewed: Design Approach


Automated review by SergeyMenshykh's agents

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

Documents why SHA-1 is intentionally used when computing the X.509 certificate thumbprint for the Copilot Studio agent’s MSAL certificate-based authentication flow, and adds an inline static-analysis suppression annotation (no functional behavior change).

Changes:

  • Add an explanatory comment clarifying that SHA-1 is required for the MSAL/Entra ID thumbprint (x5t) thumbprint identifier, not used as a security primitive.
  • Add an inline “CodeQL [SM02167]” annotation to reduce static-analysis noise for the SHA-1 usage.

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

Comment thread python/semantic_kernel/agents/copilot_studio/copilot_studio_agent.py Outdated
@github-actions

github-actions Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
agents/copilot_studio
   copilot_studio_agent.py2476175%89, 93–95, 99–102, 104, 110–111, 117, 122, 130–131, 135–137, 139–140, 143, 148, 151, 153, 179–180, 182–183, 187, 237–239, 243–248, 291, 299, 301, 305, 308, 442, 491, 538, 544–545, 547, 549–550, 558, 560–562, 605–607, 615, 624, 647
TOTAL29020561980% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
4091 23 💤 0 ❌ 0 🔥 2m 20s ⏱️

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Aug 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 5, 2026
@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Aug 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 5, 2026
@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Aug 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 5, 2026
@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Aug 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 5, 2026
@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Aug 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 5, 2026
@SergeyMenshykh
SergeyMenshykh added this pull request to the merge queue Aug 5, 2026
@SergeyMenshykh
SergeyMenshykh removed this pull request from the merge queue due to a manual request Aug 5, 2026
@SergeyMenshykh
SergeyMenshykh merged commit 8ec7ddd into microsoft:main Aug 5, 2026
33 of 48 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in Agent Framework Aug 5, 2026
@github-project-automation github-project-automation Bot moved this to Sprint: Done in Semantic Kernel Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done
Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants