Applies ToSharePoint Foundation 2013 SP1 SharePoint Server 2016 SharePoint Server 2019 SharePoint Server Subscription Edition

Simptomi

Ko namestite spodnje oktobrske varnostne posodobitve za Microsoft SharePoint Server, bodo nekateri Microsoft poteki dela v programu SharePoint 2010 morda blokirani. Poleg tega so oznake dogodkov »6ksbk« zabeležene v dnevnike SharePointovega sistema poenotenega pisanja dnevnikov (ULS). 

Vzrok

SharePoint za okrepitev varnosti SharePointovih potekov dela zdaj podpira le kodiranje znakov UTF-8 za datoteke .xoml poteka dela. 

Opomba: SharePointova orodja za poteke dela, kot so SharePoint Designer, Microsoft Visual Studio in Nintex, privzeto ustvarijo datoteke .xoml poteka dela s kodiranjem znakov UTF-8. Ta varnostna izboljšava ne bo vplivala na uporabnike, razen če so ročno uredile svoje datoteke .xoml poteka dela in jih pretvorili v drugo kodiranje znakov. Ta težava je dokumentirana v tem članku zbirke znanja o izjemno redkih možnostih, ki so jih stranke morda izbrale.

Rešitev

Če ste ročno uredili datoteko poteka dela .xoml in jo pretvorili v kodiranje znakov, ki ni UTF-8, boste morali znova urediti datoteko, da jo boste lahko pretvorili nazaj v UTF-8. Prepričajte se, da deklaracija XML datoteke določa kodiranje kot UTF-8, shranite datoteko v obliko kodiranja znakov UTF-8 z urejevalnikom besedila in jo nato znova uporabite.

S tem skriptom PowerShell lahko v ukazni lupini za upravljanje SharePointa pregledate datoteke .xoml poteka dela v SharePointovi zbirki mest, da ugotovite, ali nanje vpliva ta sprememba. Rezultat IsGoodWorkflow poteka dela True datoteke .xoml, ki uporabljajo kodiranje znakov UTF-8 in so združljive s to spremembo. Rezultat IsGoodWorkflow poteka dela False datoteke .xoml, ki ne uporabljajo kodiranja znakov UTF-8 in jih je treba spremeniti.

<#
.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

Zgodovina sprememb

V spodnji tabeli so povzete nekatere najpomembnejše spremembe v tej temi.

Datum

Opis

22. november 2022

Dodali opombo v razdelku »Vzrok« in posodobili razdelek »Nadomestna rešitev« s skriptom ogrodja PowerShell za pregled datotek .xoml poteka dela.

Ali potrebujete dodatno pomoč?

Ali želite več možnosti?

Raziščite ugodnosti naročnine, prebrskajte izobraževalne tečaje, preberite, kako zaščitite svojo napravo in še več.

Skupnosti vam pomagajo postaviti vprašanja in odgovoriti nanje, posredovati povratne informacije in prisluhniti strokovnjakom z bogatim znanjem.