Skip to content

Commit 3380482

Browse files
Typo, updates to sample in preparation of image
1 parent bcf7607 commit 3380482

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

docs/t-sql/statements/add-signature-transact-sql.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ The module being signed or countersigned and the certificate or asymmetric key u
7878
> [!CAUTION]
7979
> Module signing should only be used to grant permissions, never to deny or revoke permissions.
8080
81-
Ddata definition language (DDL) triggers and Inline table-valued functions cannot be signed.
81+
Data definition language (DDL) triggers and Inline table-valued functions cannot be signed.
8282

8383
Information about signatures is visible in the sys.crypt_properties catalog view.
8484

@@ -88,15 +88,15 @@ The module being signed or countersigned and the certificate or asymmetric key u
8888
## Countersignatures
8989
When executing a signed module, the signatures will be temporarily added to the SQL token, but the signatures are lost if the module executes another module or if the module terminates execution. A countersignature is a special form of signature. By itself, a countersignature doesn't grant any permissions, however, it allows signatures made by the same certificate or asymmetric key to be kept for the duration of the call made to the countersigned object.
9090

91-
For example, presume that user Alice calls procedure ProcSelectT1ForAlice, which calls procedure procSelectT1, which selects from table T1. Alice has EXECUTE permission on ProcSelectT1ForAlice and procSelectT1, but she doesn't have SELECT permission on T1, and no ownership chaining is involved in this entire chain. Alice cannot access table T1, either directly, or through the use of ProcSelectT1ForAlice and procSelectT1. Since we want Alice to always use ProcSelectT1ForAlice for access, we don't want to grant her permission to execute procSelectT1. How can we accomplish this?
91+
For example, presume that user Alice calls procedure ProcForAlice, which calls procedure ProcSelectT1, which selects from table T1. Alice has EXECUTE permission on ProcForAlice and ProcSelectT1, but she doesn't have SELECT permission on T1, and no ownership chaining is involved in this entire chain. Alice cannot access table T1, either directly, or through the use of ProcForAlice and ProcSelectT1. Since we want Alice to always use ProcForAlice for access, we don't want to grant her permission to execute ProcSelectT1. How can we accomplish this?
9292

93-
- If we sign procSelectT1, such that procSelectT1 can access T1, then Alice can invoke procSelectT1 directly and she doesn't have to call ProcSelectT1ForAlice.
93+
- If we sign ProcSelectT1, such that ProcSelectT1 can access T1, then Alice can invoke ProcSelectT1 directly and she doesn't have to call ProcForAlice.
9494

95-
- We could deny EXECUTE permission on procSelectT1 to Alice, but then Alice would not be able to call procSelectT1 through ProcSelectT1ForAlice.
95+
- We could deny EXECUTE permission on ProcSelectT1 to Alice, but then Alice would not be able to call ProcSelectT1 through ProcForAlice.
9696

97-
- Signing ProcSelectT1ForAlice would not work by itself, because the signature would be lost in the call to procSelectT1.
97+
- Signing ProcForAlice would not work by itself, because the signature would be lost in the call to ProcSelectT1.
9898

99-
However, by countersigning procSelectT1 with the same certificate used to sign ProcSelectT1ForAlice, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] will keep the signature across the call chain and will allow access to T1. If Alice attempts to call procSelectT1 directly, she cannot access T1, because the countersignature doesn't grant any rights. Example C below, shows the [!INCLUDE[tsql](../../includes/tsql-md.md)] for this example.
99+
However, by countersigning ProcSelectT1 with the same certificate used to sign ProcForAlice, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] the signature will be kept across the call chain and will allow access to T1. If Alice attempts to call ProcSelectT1 directly, she cannot access T1, because the countersignature doesn't grant any rights. Example C below, shows the [!INCLUDE[tsql](../../includes/tsql-md.md)] for this example.
100100

101101
## Permissions
102102

@@ -206,42 +206,42 @@ BEGIN
206206
SELECT * FROM T1;
207207
END;
208208
GO
209-
GRANT EXECUTE ON procSelectT1 to public;
209+
GRANT EXECUTE ON ProcSelectT1 to public;
210210

211211
-- Create special procedure for accessing T1
212-
CREATE PROCEDURE procSelectT1ForAlice AS
212+
CREATE PROCEDURE ProcForAlice AS
213213
BEGIN
214214
IF USER_ID() <> USER_ID('Alice')
215215
BEGIN
216216
PRINT 'Only Alice can use this.';
217217
RETURN
218218
END
219-
EXEC procSelectT1;
219+
EXEC ProcSelectT1;
220220
END;
221221
GO;
222-
GRANT EXECUTE ON procSelectT1ForAlice TO PUBLIC;
222+
GRANT EXECUTE ON ProcForAlice TO PUBLIC;
223223

224224
-- Verify procedure works for a sysadmin user
225-
EXEC procSelectT1ForAlice;
225+
EXEC ProcForAlice;
226226

227227
-- Alice still can't use the procedure yet
228228
EXECUTE AS LOGIN = 'Alice';
229-
EXEC procSelectT1ForAlice;
229+
EXEC ProcForAlice;
230230
REVERT;
231231

232232
-- Sign procedure to grant it SELECT permission
233-
ADD SIGNATURE TO procSelectT1ForAlice BY CERTIFICATE csSelectT
233+
ADD SIGNATURE TO ProcForAlice BY CERTIFICATE csSelectT
234234
WITH PASSWORD = 'SimplePwd01';
235235

236-
-- Counter sign proc_select_t, to make this work
237-
ADD COUNTER SIGNATURE TO procSelectT1 BY CERTIFICATE csSelectT
236+
-- Counter sign ProcSelectT1, to make this work
237+
ADD COUNTER SIGNATURE TO ProcSelectT1 BY CERTIFICATE csSelectT
238238
WITH PASSWORD = 'SimplePwd01';
239239

240240
-- Now the proc works.
241-
-- Note that calling procSelectT1 directly still doesn't work
241+
-- Note that calling ProcSelectT1 directly still doesn't work
242242
EXECUTE AS LOGIN = 'Alice';
243-
EXEC procSelectT1ForAlice;
244-
EXEC procSelectT1;
243+
EXEC ProcForAlice;
244+
EXEC ProcSelectT1;
245245
REVERT;
246246

247247
-- Cleanup

0 commit comments

Comments
 (0)