Home Dashboard Directory Help
Search

PowerShell 3 AND 4 (malformed) signed script blocks breaks the parser by Joel 'Jaykul' Bennett


Status: 

Active


3
0
Sign in
to vote
Type: Bug
ID: 807507
Opened: 11/1/2013 1:13:11 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

In PowerShell 3, if there is a signed script block (or script, or localized data file) which is imported (invoked interactively, or parsed using Import-LocalizedData), ALL localized data files (or interactive commands) which are imported/executed after that must be shorter than the previous signed one or they will fail to parse with a TokenAfterEndOfValidScriptText error:

Executable script code found in signature block.
    + CategoryInfo         : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : TokenAfterEndOfValidScriptText


NOTE: this bug affects Import-LocalizedData *AND* the "data" keyword in PowerShell scripts.

In PowerShell 4, the bug only emerges when the signature block is cut off (say, if someone accidentally deletes the last line of a signature).

Reproduction steps below apply to PS3 or PS4 (because I don't put a full signature in the reproduction).


This does not affect PS2.
Details
Sign in to post a comment.
Sign in to post a workaround.