Skip to content

Commit 40f6c75

Browse files
Merge pull request #114 from EmergentSoftware/dev
Unencrypted Pull Request
2 parents fddb447 + b7e7bba commit 40f6c75

16 files changed

+574
-72
lines changed

.github/FUNDING.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
# These are supported funding model platforms
2-
31
github: KevinMartinLink

Development Application Settings/Red Gate/SQL Prompt/Formatting Styles/Team Expanded.sqlpromptstylev2

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
<ClosingParenthesisAlignment>ToOpeningBracket</ClosingParenthesisAlignment>
1818
<CollapseCaseExpressionIfShort>false</CollapseCaseExpressionIfShort>
1919
<CollapseCaseIfShortCharacterCount>75</CollapseCaseIfShortCharacterCount>
20-
<CollapseIfShortControlFlowCharacterCount>78</CollapseIfShortControlFlowCharacterCount>
20+
<CollapseIfShortControlFlowCharacterCount>120</CollapseIfShortControlFlowCharacterCount>
2121
<CollapseIfShortDdlCharacterCount>78</CollapseIfShortDdlCharacterCount>
2222
<CollapseIfShortDmlCharacterCount>78</CollapseIfShortDmlCharacterCount>
2323
<CollapseIfShortParenthesesContentsCharacterCount>78</CollapseIfShortParenthesesContentsCharacterCount>
2424
<CollapseIfShortSubqueryCharacterCount>78</CollapseIfShortSubqueryCharacterCount>
25-
<CollapseShortControlFlowStatements>true</CollapseShortControlFlowStatements>
25+
<CollapseShortControlFlowStatements>false</CollapseShortControlFlowStatements>
2626
<CollapseShortDdlStatements>true</CollapseShortDdlStatements>
2727
<CollapseShortDmlStatements>true</CollapseShortDmlStatements>
2828
<CollapseShortParenthesesContents>true</CollapseShortParenthesesContents>

README.md

+15-4
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ The settings are located in the project "[\SQL-Server-Assess\Development Applica
171171

172172
# Current High Check Id
173173

174-
## Next Check Id: 27
174+
## Next Check Id: 28
175175

176176
# Naming Conventions
177177

@@ -298,8 +298,8 @@ Do not prefix your columns with "fld_", "col_", "f_", "u_" as it should be obvio
298298

299299
No need for prefixing (PK_, IX_, UK_, UX_) your index names.
300300

301-
* Names should be "TableName_Column1_Column2_Column3"
302-
* Names should indicate if there are included columns with "TableName_Column1_Column2_Column3_Includes"
301+
* Names should be "Column1_Column2_Column3"
302+
* Names should indicate if there are included columns with "Column1_Column2_Column3_Includes"
303303

304304

305305

@@ -822,14 +822,25 @@ Views do not lend themselves to being deeply nested. Views that reference views
822822
- Abstracting complicated base tables
823823

824824

825-
826825
## Invalid Objects
827826
**Check Id:** [NONE YET]
828827

829828
This check found objects that were deleted, renamed. Use can also run "Find Invalid Objects" with RedGate SQL Prompt in SQL Server Management Studio.
830829

831830
Try running EXEC sp_refreshsqlmodule or sp_refreshview.
832831

832+
# Data Issue
833+
834+
## Unencrypted Data
835+
**Check Id:** 28
836+
837+
The table column returned for this check might have unencrypted data that you might want to have encrypted for best practices or industry specific compliance. You will need to determine if the data needs to be protected at rest, in transit or both.
838+
839+
**With SQL Server you have a couple choices to implement hashing or encryption**
840+
841+
- [SQL Server Always Encrypt](https://docs.microsoft.com/en-us/sql/relational-databases/security/encryption/always-encrypted-database-engine)
842+
- [SQL Server Transparent Data Encryption (TDE)](https://docs.microsoft.com/en-us/sql/relational-databases/security/encryption/transparent-data-encryption)
843+
- You could develop your own or utilize a development framework pattern to implement a custom one-way hashing, hashing with salting or encryption using AES-128, AES-192, AES-256.
833844

834845

835846
# Running Issues
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
INSERT INTO [dbo].[UnencryptedData] ([UnencryptedDataId], [Password], [PasswordIsEncrypted], [PasswordSalt], [LastPasswordChangedDate], [PasswordConfigurationSettings], [PasswordComplexityPattern], [PasswordExpirationDate], [IsPasswordChangedFlag], [LastPasswordFailedDate], [MaxPasswordCharacters], [MinPasswordLength], [PasswordSpecialCharacterRequirement], [PasswordHistoryCount], [CreditCardId], [CreditCardNumber], [CreditCardApprovalCode], [CCN], [CreditCardToken], [SSN], [SocialSecurityNumber], [PassportNumber], [DLL], [DriverLicenseNumber], [LicenseCount]) VALUES (1, N'Passw0rd1!', N'0x9892C5339D13A94CC03384E609798F4E4688DACF95BB896FE60931255F054E20', 'bE3XiWw=', '2020-08-20', '<password allowusedbefore=false>', N'^[a-zA-Z]\w{3,14}$', '2021-08-20', 1, '2019-08-20', 100, 10, 1, 33, 553, '4111111111111111', '115213Vi29411', '5555555555554444', N'J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n', '555255864', N'555-25-5864', 223235245, 'MN2234223', N'WI2930840923', 1000)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
SET QUOTED_IDENTIFIER ON
2+
GO
3+
SET ANSI_NULLS ON
4+
GO
5+
6+
-- =============================================
7+
-- Author: <Author,,Name>
8+
-- Create date: <Create Date,,>
9+
-- Description: <Description,,>
10+
-- =============================================
11+
CREATE FUNCTION [DBA].[fnPrefixNameTableValuedFunctionSkipMe]
12+
(
13+
-- Add the parameters for the function here
14+
@param1 INT
15+
)
16+
RETURNS TABLE
17+
AS
18+
RETURN
19+
(
20+
-- Add the SELECT statement with parameter references here
21+
SELECT @param1 AS ColumnName
22+
)
23+
GO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
SET QUOTED_IDENTIFIER ON
2+
GO
3+
SET ANSI_NULLS ON
4+
GO
5+
6+
-- =============================================
7+
-- Author: <Author,,Name>
8+
-- Create date: <Create Date, ,>
9+
-- Description: <Description, ,>
10+
-- =============================================
11+
CREATE FUNCTION [DBA].[fn_PrefixNameSkipMe]
12+
(
13+
@Param1 INT
14+
)
15+
RETURNS INT
16+
AS
17+
BEGIN
18+
-- Declare the return variable here
19+
DECLARE @ResultVar INT
20+
21+
-- Add the T-SQL statements to compute the return value here
22+
SET @ResultVar = 1
23+
24+
-- Return the result of the function
25+
RETURN @ResultVar
26+
27+
END
28+
GO

Test Database/RedGateDatabaseInfo.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
<DataWriteAllFilesInOneDirectory>True</DataWriteAllFilesInOneDirectory>
6060
</WriteToFileOptions>
6161
<DataFileSet>
62-
<Count>0</Count>
62+
<Count>1</Count>
63+
<DataFile>dbo.UnencryptedData_Data.sql</DataFile>
6364
</DataFileSet>
6465
</DatabaseInformation>
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CREATE SCHEMA [DBA]
2+
AUTHORIZATION [dbo]
3+
GO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
SET QUOTED_IDENTIFIER ON
2+
GO
3+
SET ANSI_NULLS ON
4+
GO
5+
6+
-- =============================================
7+
-- Author: <Author,,Name>
8+
-- Create date: <Create Date,,>
9+
-- Description: <Description,,>
10+
-- =============================================
11+
CREATE PROCEDURE [DBA].[spPrefixNameSkipMe]
12+
13+
AS
14+
BEGIN
15+
-- SET NOCOUNT ON added to prevent extra result sets from
16+
-- interfering with SELECT statements.
17+
SET NOCOUNT ON;
18+
19+
-- Insert statements for procedure here
20+
SELECT N.Number2020Id, N.TableNameContainsNumbers FROM dbo.Number2020 AS N
21+
END
22+
GO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
SET QUOTED_IDENTIFIER ON
2+
GO
3+
SET ANSI_NULLS ON
4+
GO
5+
-- =============================================
6+
-- Author: <Author,,Name>
7+
-- Create date: <Create Date,,>
8+
-- Description: <Description,,>
9+
-- =============================================
10+
CREATE PROCEDURE [dbo].[SetOptions]
11+
AS
12+
BEGIN
13+
SET NOCOUNT ON;
14+
SET NOEXEC ON;
15+
SET QUOTED_IDENTIFIER OFF;
16+
SET ARITHABORT OFF;
17+
SET ANSI_DEFAULTS OFF;
18+
SET ANSI_NULLS OFF;
19+
SET ANSI_NULL_DFLT_ON OFF;
20+
SET ANSI_WARNINGS OFF;
21+
SET ANSI_PADDING OFF;
22+
SET NUMERIC_ROUNDABORT ON;
23+
SET CONCAT_NULL_YIELDS_NULL OFF;
24+
SET ROWCOUNT 100;
25+
SET XACT_ABORT ON;
26+
SET IMPLICIT_TRANSACTIONS ON;
27+
SET ARITHIGNORE OFF;
28+
SET LOCK_TIMEOUT 1;
29+
SET FMTONLY ON;
30+
--SET PARSEONLY OFF;
31+
32+
SELECT 1;
33+
END;
34+
GO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CREATE TABLE [DBA].[DevelopCheckToSkip]
2+
(
3+
[DevelopCheckToSkipId] [int] NOT NULL IDENTITY(1, 1),
4+
[ServerName] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
5+
[DatabaseName] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
6+
[SchemaName] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
7+
[ObjectName] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
8+
[CheckId] [int] NULL
9+
) ON [PRIMARY]
10+
GO
11+
ALTER TABLE [DBA].[DevelopCheckToSkip] ADD CONSTRAINT [DevelopCheckToSkip_DevelopCheckToSkipId] PRIMARY KEY CLUSTERED ([DevelopCheckToSkipId]) ON [PRIMARY]
12+
GO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CREATE TABLE [DBA].[IDPrimaryKeyColumnNameSkipMe]
2+
(
3+
[ID] [int] NOT NULL
4+
) ON [PRIMARY]
5+
GO
6+
ALTER TABLE [DBA].[IDPrimaryKeyColumnNameSkipMe] ADD CONSTRAINT [PK_IDPrimaryKeyColumnName] PRIMARY KEY CLUSTERED ([ID]) ON [PRIMARY]
7+
GO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
CREATE TABLE [dbo].[UnencryptedData]
2+
(
3+
[UnencryptedDataId] [int] NOT NULL,
4+
[Password] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
5+
[PasswordIsEncrypted] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
6+
[PasswordSalt] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
7+
[LastPasswordChangedDate] [date] NULL,
8+
[PasswordConfigurationSettings] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
9+
[PasswordComplexityPattern] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
10+
[PasswordExpirationDate] [date] NULL,
11+
[IsPasswordChangedFlag] [bit] NULL,
12+
[LastPasswordFailedDate] [date] NULL,
13+
[MaxPasswordCharacters] [int] NULL,
14+
[MinPasswordLength] [int] NULL,
15+
[PasswordSpecialCharacterRequirement] [bit] NULL,
16+
[PasswordHistoryCount] [int] NULL,
17+
[CreditCardId] [int] NULL,
18+
[CreditCardNumber] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
19+
[CreditCardApprovalCode] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
20+
[CCN] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
21+
[CreditCardToken] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
22+
[SSN] [char] (9) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
23+
[SocialSecurityNumber] [nchar] (11) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
24+
[PassportNumber] [int] NULL,
25+
[DLL] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
26+
[DriverLicenseNumber] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
27+
[LicenseCount] [bigint] NULL
28+
) ON [PRIMARY]
29+
GO
30+
ALTER TABLE [dbo].[UnencryptedData] ADD CONSTRAINT [PK_UnencryptedData] PRIMARY KEY CLUSTERED ([UnencryptedDataId]) ON [PRIMARY]
31+
GO
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CREATE TABLE [dbo].[UniqueConstraint]
22
(
3-
[SSN] [char] (11) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
3+
[ColumnName] [char] (11) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
44
) ON [PRIMARY]
55
GO
6-
ALTER TABLE [dbo].[UniqueConstraint] ADD CONSTRAINT [AK_UniqueConstraint_SSN] UNIQUE NONCLUSTERED ([SSN]) ON [PRIMARY]
6+
ALTER TABLE [dbo].[UniqueConstraint] ADD CONSTRAINT [AK_UniqueConstraint_ColumnName] UNIQUE NONCLUSTERED ([ColumnName]) ON [PRIMARY]
77
GO
+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
SET QUOTED_IDENTIFIER ON
2+
GO
3+
SET ANSI_NULLS ON
4+
GO
5+
6+
CREATE VIEW [DBA].[vPhoneSkipMe]
7+
AS
8+
SELECT ID, [Phone Number]
9+
FROM dbo.tblPhone
10+
GO
11+
EXEC sp_addextendedproperty N'MS_DiagramPane1', N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
12+
Begin DesignProperties =
13+
Begin PaneConfigurations =
14+
Begin PaneConfiguration = 0
15+
NumPanes = 4
16+
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
17+
End
18+
Begin PaneConfiguration = 1
19+
NumPanes = 3
20+
Configuration = "(H (1 [50] 4 [25] 3))"
21+
End
22+
Begin PaneConfiguration = 2
23+
NumPanes = 3
24+
Configuration = "(H (1 [50] 2 [25] 3))"
25+
End
26+
Begin PaneConfiguration = 3
27+
NumPanes = 3
28+
Configuration = "(H (4 [30] 2 [40] 3))"
29+
End
30+
Begin PaneConfiguration = 4
31+
NumPanes = 2
32+
Configuration = "(H (1 [56] 3))"
33+
End
34+
Begin PaneConfiguration = 5
35+
NumPanes = 2
36+
Configuration = "(H (2 [66] 3))"
37+
End
38+
Begin PaneConfiguration = 6
39+
NumPanes = 2
40+
Configuration = "(H (4 [50] 3))"
41+
End
42+
Begin PaneConfiguration = 7
43+
NumPanes = 1
44+
Configuration = "(V (3))"
45+
End
46+
Begin PaneConfiguration = 8
47+
NumPanes = 3
48+
Configuration = "(H (1[56] 4[18] 2) )"
49+
End
50+
Begin PaneConfiguration = 9
51+
NumPanes = 2
52+
Configuration = "(H (1 [75] 4))"
53+
End
54+
Begin PaneConfiguration = 10
55+
NumPanes = 2
56+
Configuration = "(H (1[66] 2) )"
57+
End
58+
Begin PaneConfiguration = 11
59+
NumPanes = 2
60+
Configuration = "(H (4 [60] 2))"
61+
End
62+
Begin PaneConfiguration = 12
63+
NumPanes = 1
64+
Configuration = "(H (1) )"
65+
End
66+
Begin PaneConfiguration = 13
67+
NumPanes = 1
68+
Configuration = "(V (4))"
69+
End
70+
Begin PaneConfiguration = 14
71+
NumPanes = 1
72+
Configuration = "(V (2))"
73+
End
74+
ActivePaneConfig = 0
75+
End
76+
Begin DiagramPane =
77+
Begin Origin =
78+
Top = 0
79+
Left = 0
80+
End
81+
Begin Tables =
82+
Begin Table = "tblPhone"
83+
Begin Extent =
84+
Top = 6
85+
Left = 38
86+
Bottom = 117
87+
Right = 226
88+
End
89+
DisplayFlags = 280
90+
TopColumn = 0
91+
End
92+
End
93+
End
94+
Begin SQLPane =
95+
End
96+
Begin DataPane =
97+
Begin ParameterDefaults = ""
98+
End
99+
End
100+
Begin CriteriaPane =
101+
Begin ColumnWidths = 11
102+
Column = 1440
103+
Alias = 900
104+
Table = 1170
105+
Output = 720
106+
Append = 1400
107+
NewValue = 1170
108+
SortType = 1350
109+
SortOrder = 1410
110+
GroupBy = 1350
111+
Filter = 1350
112+
Or = 1350
113+
Or = 1350
114+
Or = 1350
115+
End
116+
End
117+
End
118+
', 'SCHEMA', N'DBA', 'VIEW', N'vPhoneSkipMe', NULL, NULL
119+
GO
120+
DECLARE @xp int
121+
SELECT @xp=1
122+
EXEC sp_addextendedproperty N'MS_DiagramPaneCount', @xp, 'SCHEMA', N'DBA', 'VIEW', N'vPhoneSkipMe', NULL, NULL
123+
GO

0 commit comments

Comments
 (0)