Skip to content

Commit e202b00

Browse files
authored
Doc: AssemblyBuilder require fully trusted environment with trusted input (#10541)
1 parent ef19a53 commit e202b00

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

xml/System.Reflection.Emit/AssemblyBuilder.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,18 @@
7676
</Attributes>
7777
<Docs>
7878
<summary>Defines and represents a dynamic assembly.</summary>
79-
<remarks>For more information about this API, see <see href="/dotnet/fundamentals/runtime-libraries/system-reflection-emit-assemblybuilder">Supplemental API remarks for AssemblyBuilder</see>.</remarks>
79+
<remarks>
80+
<format type="text/markdown"><![CDATA[
81+
82+
## Remarks
83+
84+
For more information about this API, see [Supplemental API remarks for AssemblyBuilder](/dotnet/fundamentals/runtime-libraries/system-reflection-emit-assemblybuilder).
85+
86+
> [!WARNING]
87+
> `AssemblyBuilder` APIs require a fully trusted environment with trusted input, similar to other technologies such as compilers. There are no restrictions other than basic validation for generated IL that the `AssemblyBuilder` can contain. That includes validation for member name, count, and associated metadata, such as custom attributes.
88+
]]>
89+
</format>
90+
</remarks>
8091
<example>
8192
<format type="text/markdown"><![CDATA[
8293
The following code example shows how to define and use a dynamic assembly. The example assembly contains one type, `MyDynamicType`, that has a private field, a property that gets and sets the private field, constructors that initialize the private field, and a method that multiplies a user-supplied number by the private field value and returns the result.

xml/System.Reflection.Emit/ILGenerator.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@
8484
8585
MSIL is used as input to a just-in-time (JIT) compiler.
8686
87+
> [!WARNING]
88+
> There are no restrictions, other than basic validation, for ILGenerator APIs that produce method IL. If untrusted input is used for producing IL:
89+
>
90+
> - IL and metadata can contain secrets provided by the consumer.
91+
> - IL can be invalid, such as not having balanced push versus pop opcodes, or invalid operands for a given opcode.
92+
> - IL can contain any code that might, for example, deadlock, have infinite stack recursion, or have an infinite loop.
93+
> - IL can load and execute code on any other reachable assembly.
94+
>
95+
> Such code can do whatever it wishes when the method is loaded and executed. To protect against such vulnerabilities, `ILGenerator` requires a fully trusted environment with trusted input.
8796
]]></format>
8897
</remarks>
8998
</Docs>

xml/System.Reflection.Emit/PersistedAssemblyBuilder.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@
2525
</Attributes>
2626
<Docs>
2727
<summary>Provides an AssemblyBuilder implementation that can persist assembly to a disk or stream.</summary>
28-
<remarks>To be added.</remarks>
28+
<remarks>
29+
<format type="text/markdown"><![CDATA[
30+
31+
## Remarks
32+
33+
For more information about this API, see [Persisted dynamic assemblies in .NET](/dotnet/fundamentals/runtime-libraries/system-reflection-emit-persistedassemblybuilder).
34+
35+
> [!WARNING]
36+
> `PersistedAssemblyBuilder` APIs require a fully trusted environment with trusted input, similar to other technologies such as compilers. There are no restrictions other than basic validation for generated IL that the `AssemblyBuilder` can contain. That includes validation for member name, count, and associated metadata, such as custom attributes.
37+
]]></format>
38+
</remarks>
2939
</Docs>
3040
<Members>
3141
<Member MemberName=".ctor">

0 commit comments

Comments
 (0)