Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Protect property assignment on non-core objects to NoteProperty members in Constrained Language Mode - #28206

Merged
Justin Chung (jshigetomi) merged 2 commits into
masterfrom
202
Oct 20, 2026
Merged

Justin Chung (jshigetomi) merged 2 commits into
masterfrom
202

Conversation

@jshigetomi

Copy link
Copy Markdown
Collaborator

PR Summary

This pull request strengthens property-setting restrictions in Constrained Language mode in PowerShell, ensuring that only NoteProperty instance members can be set on user objects, and that attempts to set other property types (such as ScriptProperty or AliasProperty) are properly blocked and audited. The changes also add targeted tests to verify this behavior.

PR Context

PR Checklist

@jshigetomi Justin Chung (jshigetomi) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 14, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@jshigetomi Justin Chung (jshigetomi) changed the title Add additional language mode checks to PSSetMemberBinder Restrict property assignment on non-core objects to NoteProperty members in Constrained Language Mode Oct 14, 2026

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.

🔵 Needs a closer look

Security-boundary changes need human validation of enforcement, cached bindings, and audit behavior, with a regression-coverage gap remaining.

1 open finding
What changed in this PR

Strengthens Constrained Language property-assignment restrictions for non-core objects.

Changes:

  • Restricts instance-member writes to exact PSNoteProperty members, with audit-mode logging.
  • Removes the non-instance setter exemption for ToString.
  • Adds rejection tests for instance ScriptProperty and AliasProperty assignments.
File Description
test/​powershell/​Modules/​Microsoft.PowerShell.Security/​ConstrainedLanguageRestriction.Tests.ps1 Adds constrained-language assignment tests.
src/​System.Management.Automation/​engine/​runtime/​Binding/​Binders.cs Enforces setter restrictions and audit logging.
src/​System.Management.Automation/​engine/​parser/​Compiler.cs Caches reflection metadata for the new setter helper.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

constrainedTargetType = targetValue.GetType();
}

if (!CoreTypes.Contains(constrainedTargetType))
@jshigetomi Justin Chung (jshigetomi) changed the title Restrict property assignment on non-core objects to NoteProperty members in Constrained Language Mode Protect property assignment on non-core objects to NoteProperty members in Constrained Language Mode Oct 16, 2026
@jshigetomi
Justin Chung (jshigetomi) merged commit b366b2d into master Oct 20, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants