Click or drag to resize

SA0150 : The procedure grants itself permissions. Possible missing GO command

The topic describes the SA0150 analysis rule.

Message

The procedure grants itself permissions. Possible missing GO command

Description

The rule checks for stored procedures, changing its own permissions.

It is possible that a GO end of batch signaling command is missing and the statements in the script following the procedure are included in the procedure body.

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters
NameDescriptionDefault Value
OnTarget

The target of on which the permissions are granted or revoked.

Any

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

Design Rules

Additional Information

There is no additional info for this rule.

Example Test Script
 1ALTER PROCEDURE dbo.FooGetTableA
 2    (
 3    @Parameter varchar(4)
 4    )
 5AS
 6BEGIN
 7    SELECT Column1 
 8    FROM dbo.TableA
 9    WHERE Column2 = @Parameter
10END
11
12GRANT EXEC ON dbo.FooGetTableA TO ApplicationRole
13
14REVOKE EXEC ON dbo.FooGetTableA TO ApplicationRole
15
16GRANT EXEC ON dbo.FooGetTableB TO ApplicationRole

Analysis Results

 MessageLineColumn
1SA0150 : Possible missing GO statement. The procedure FooGetTableA grants/revokes its own permissions.120
2SA0150 : Possible missing GO statement. The procedure FooGetTableA grants/revokes its own permissions.140
3SA0150 : Possible missing GO statement. The procedure FooGetTableA grants/revokes permissions.160
See Also

Other Resources