Skip to content

Commit a738462

Browse files
authored
ALTER ASSBLY, Adding clr strict security
1 parent d7ca69c commit a738462

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

docs/t-sql/statements/alter-assembly-transact-sql.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "ALTER ASSEMBLY (Transact-SQL) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "01/12/2017"
4+
ms.date: "04/19/2017"
55
ms.prod: "sql-non-specified"
66
ms.reviewer: ""
77
ms.suite: ""
@@ -32,7 +32,10 @@ manager: "jhubbard"
3232
[!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx_md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)]
3333

3434
Alters an assembly by modifying the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] catalog properties of an assembly. ALTER ASSEMBLY refreshes it to the latest copy of the [!INCLUDE[msCoName](../../includes/msconame-md.md)] [!INCLUDE[dnprdnshort](../../includes/dnprdnshort-md.md)] modules that hold its implementation and adds or removes files associated with it. Assemblies are created by using [CREATE ASSEMBLY](../../t-sql/statements/create-assembly-transact-sql.md).
35-
35+
36+
> [!WARNING]
37+
> CLR uses Code Access Security (CAS) in the .NET Framework, which has been marked as obsolete. A CLR assembly created with `PERMISSION_SET = SAFE` may be able to access external system resources, call unmanaged code, and acquire sysadmin privileges. Beginning with [!INCLUDE[sssqlv14-md](../../includes/sssqlv14-md.md)], an `sp_configure` option called `clr strict security` is introduced to enhance the security of CLR assemblies. `clr strict security` is enabled by default, and treats `SAFE` and `EXTERNAL_ACCESS` assemblies as if they were marked `UNSAFE`. The `clr strict security` option can be disabled for backward compatibility, but this is not recommended. Microsoft recommends that all assemblies be signed by a certificate or asymmetric key with a corresponding login that has been granted `UNSAFE ASSEMBLY` permission in the master database. For more information, see [CLR strict security](../../database-engine/configure-windows/clr-strict-security.md).
38+
3639
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
3740

3841
## Syntax
@@ -75,7 +78,9 @@ ALTER ASSEMBLY assembly_name
7578

7679
Separate ALTER ASSEMBLY statements must be issued for any dependent assemblies that also require updating.
7780

78-
PERMISSION_SET = { SAFE | EXTERNAL_ACCESS | UNSAFE }
81+
PERMISSION_SET = { SAFE | EXTERNAL_ACCESS | UNSAFE }
82+
> [!IMPORTANT]
83+
> The `PERMISSION_SET` option is affected by the `clr strict security` option, described in the opening warning. When `clr strict security` is enabled, all assemblies are treated as `UNSAFE`.
7984
Specifies the [!INCLUDE[dnprdnshort](../../includes/dnprdnshort-md.md)] code access permission set property of the assembly. For more information about this property, see [CREATE ASSEMBLY (Transact-SQL)](../../t-sql/statements/create-assembly-transact-sql.md).
8085

8186
> [!NOTE]
@@ -169,6 +174,16 @@ ALTER ASSEMBLY assembly_name
169174
- To change the permission set of an assembly to UNSAFE, requires **UNSAFE ASSEMBLY** permission on the server.
170175

171176
- Specifying WITH UNCHECKED DATA, requires **ALTER ANY SCHEMA** permission.
177+
178+
179+
### Permissions with CLR strict security
180+
The following permissions required to alter a CLR assembly when `CLR strict security` is enabled:
181+
182+
- The user must have the `ALTER ASSEMBLY` permission
183+
- And one of the following conditions must also be true:
184+
- The assembly is signed with a certificate or asymmetric key that has a corresponding login with the `UNSAFE ASSEMBLY` permission on the server. Signing the assembly is recommended.
185+
- The database has the `TRUSTWORTHY` property set to `ON`, and the database is owned by a login that has the `UNSAFE ASSEMBLY` permission on the server. This option is not recommended.
186+
172187

173188
For more information about assembly permission sets, see [Designing Assemblies](../../relational-databases/clr-integration/assemblies-designing.md).
174189

0 commit comments

Comments
 (0)