使用 Microsoft 登录
登录或创建帐户。
你好,
使用其他帐户。
你有多个帐户
选择要登录的帐户。

症状

在安装以下 Microsoft SharePoint Server 10 月安全更新后,可能会阻止某些 Microsoft SharePoint 2010 工作流方案。 此外,“6ksbk”事件标记将记录在 SharePoint 统一日志记录系统 (ULS) 日志中。 

原因

为了增强 SharePoint 工作流的安全性,SharePoint 现在仅支持工作流 .xoml 文件的 UTF-8 字符编码。 

注意: 默认情况下,SharePoint 工作流工具(如 SharePoint 设计器、Microsoft Visual Studio 和 Nintex)使用 UTF-8 字符编码创建工作流 .xoml 文件。 除非客户已手动编辑其工作流 .xoml 文件并将其转换为其他字符编码,否则不会受到此安全改进的影响。 此问题在此知识库文章中有记录,说明客户选择这样做的可能性极小。

解决方法

如果已手动编辑工作流 .xoml 文件,并将其转换为 UTF-8 以外的字符编码,则需要重新编辑该文件以将其转换回 UTF-8。 确保文件的 XML 声明将编码定义为 UTF-8,使用文本编辑器以 UTF-8 字符编码格式保存文件,然后重新部署它。

可在 SharePoint 命令行管理程序中使用以下 PowerShell 脚本扫描 SharePoint 网站集中的工作流 .xoml 文件,以确定它们是否受到此更改的影响。 对于使用 UTF-8 字符编码且与此更改兼容的工作流 .xoml 文件,IsGoodWorkflow 输出将为 True。 对于不使用 UTF-8 字符编码且需要修改的工作流 .xoml 文件,IsGoodWorkflow  输出将为 False

<#
.SYNOPSIS
    Script to check character encoding of workflow .xoml files found in a site collection.
.DESCRIPTION
    This script checks the character encoding of workflow .xoml files found in a site collection based
    on the security improvement documented here: https://support.microsoft.com/topic/sharepoint-2010-workflows-might-be-blocked-by-enhanced-security-policy-kb5020238-eb91e24d-eea4-4490-a281-86503adc8b27
    
    This could be altered to take an SPWebApplication object, iterate through all SPSite objects in the Sites SPSiteCollection,
    and then iterate through all SPWeb subsites in the AllWebs SPWebCollection.

.EXAMPLE
    Get-WorkflowStatusForSite -SiteCollectionUrl https://sharepoint

.EXAMPLE
    Get-WorkflowStatusForSite -SiteCollectionUrl https://sharepoint -IgnoreSubSites
.INPUTS
    None
.OUTPUTS
    PSCustomObject with Site, Web, WorkflowFileName and IsGoodWorkflow Result

    Site                         Web                            WorkflowFileName       IsGoodWorkflow
    ----                         ---                            ----------------       --------------
    SPSite Url=http://sharepoint http://sharepoint/WorkflowTest 2010 Log Workflow.xoml           True
    SPSite Url=http://sharepoint http://sharepoint/WorkflowTest Another Test Log.xoml            True
.NOTES
    Version .1
#>
param(
    [Parameter(Position=2,HelpMessage="The site collection URL to validate.")]
    [string]$SiteCollectionUrl, 
    [Parameter(Position=3,HelpMessage="Ignore subsites below the top-level site in the site collection.")]
    [switch]$IgnoreSubSites
)

function IsGoodWorkflow
{
    param
    (
        [Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)]
        [System.Xml.XmlReader]$xmlReader
    )

    try {
        $xDoc = [System.Xml.Linq.XDocument]::Load($xmlReader)

        if ($null -ne $xDoc -and $null -ne $xDoc.Declaration -and $null -ne $xDoc.Declaration.Encoding)
        {
            if ($xdoc.Declaration.Encoding.ToLower() -ne "utf-8")
            {
                return $false
            }
        }
    }
    catch
    {
        return $false
    }
        

    return $true
}

function CheckWorkflowFile
{
    param
    (
        [Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)]
        [Microsoft.SharePoint.SPFile]$SPFile
    )

    $xmlReader = [System.Xml.XmlReader]::Create($SPFile.OpenBinaryStream())

    if ($null -ne $xmlReader)
    {
        $isGood = $xmlReader | IsGoodWorkflow

        $xmlReader.Close()
        $xmlReader.Dispose()
        
        return [PSCustomObject]@{
            Site = $SPFile.Item.Web.Site
            Web = $SPFile.Item.Web.Url
            WorkflowFileName = $SPFile.Name
            IsGoodWorkflow = $isGood
            }
    }
}

function CheckWorkflowsForWeb
{
    param
    (
        [Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)]
        [Microsoft.SharePoint.SPWeb]$SPWeb
    )

    write-host "Checking $SPweb"
    $WorkflowsList = $SPWeb.Lists["Workflows"]

    $results = @()

    if ($WorkflowsList)
    {
        Write-Host "Found: " $WorkflowsList.Title

        foreach ($listItem in $WorkflowsList.Items)
        {
            if ($listItem.File -and $listItem.File.Name.ToLower().EndsWith(".xoml"))
            {
                Write-Host "Found Workflow: " $listItem.File.Name
                $results += (CheckWorkflowFile $listItem.File)
            }
        }
    }
    return $results
}

function CheckWorkflowsForSite
{
    param
    (
    [Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)]
    [Microsoft.SharePoint.SPSite]$SPSite,
    [switch]$IgnoreSubSites
    )
    
    $results = @()

    if ($IgnoreSubSites)
    {
        $SPWeb = $SPSite.RootWeb

        $results += CheckWorkflowsForWeb $SPWeb

        $SPWeb.Dispose()
    }
    else
    {
        foreach ($SPWeb in $SPSite.AllWebs)
        {
            $results += CheckWorkflowsForWeb $SPWeb
            $SPWeb.Dispose()
        }
    }
    
    return $results
}

if ([string]::IsNullOrEmpty($SiteCollectionUrl))
{
    $SiteCollectionUrl = Read-Host "Please provide a site collection URL (Default: http://sharepoint)"
    if ([String]::IsNullOrEmpty($SiteCollectionUrl))
    {
        $SiteCollectionUrl = "http://sharepoint"
    }
}

$SPSite = Get-SPSite $SiteCollectionUrl -ErrorAction SilentlyContinue

if ($null -eq $SPSite)
{
    Write-Host "Site collection $SiteCollectionUrl not found." -ForegroundColor Red
    return;
}

$results = CheckWorkflowsForSite $SPSite

# Dispose of the Site
$SPSite.Dispose()

# Results can be exported to a CSV or manipulated
$results

更改历史记录

下表汇总了本主题的一些最重要的更改。

日期

描述

2022 年 11 月 22 日

在“原因”部分添加了注释,并使用 PowerShell 脚本更新了“解决方法”部分以扫描工作流 .xoml 文件。

需要更多帮助?

需要更多选项?

了解订阅权益、浏览培训课程、了解如何保护设备等。

社区可帮助你提出和回答问题、提供反馈,并听取经验丰富专家的意见。

此信息是否有帮助?

你对语言质量的满意程度如何?
哪些因素影响了你的体验?
按“提交”即表示你的反馈将用于改进 Microsoft 产品和服务。 你的 IT 管理员将能够收集此数据。 隐私声明。

谢谢您的反馈!

×