Skip to content

Commit

Permalink
Merge pull request #200 from hecon5/RemoveEncryption
Browse files Browse the repository at this point in the history
Remove encryption
  • Loading branch information
joyfullservice authored Mar 17, 2021
2 parents 8246762 + db95567 commit 4d85c76
Show file tree
Hide file tree
Showing 21 changed files with 151 additions and 1,009 deletions.
2 changes: 1 addition & 1 deletion Version Control.accda.src/dbs-properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"Type": 10
},
"AppVersion": {
"Value": "3.3.16",
"Value": "3.3.17",
"Type": 10
},
"Auto Compact": {
Expand Down
27 changes: 22 additions & 5 deletions Version Control.accda.src/forms/frmVCSInstall.bas
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ Begin Form
GridY =24
DatasheetFontHeight =11
ItemSuffix =39
Left =-17265
Top =2430
Right =-6105
Bottom =10335
Left =-25575
Top =1710
Right =-255
Bottom =14295
DatasheetGridlinesColor =15132391
RecSrcDt = Begin
0x79e78b777268e540
Expand Down Expand Up @@ -1573,6 +1573,23 @@ End Sub
'
Private Sub cmdInstall_Click()

' Check for legacy encryption key.
If HasLegacyRC4Keys Then
If MsgBox2("IMPORTANT: Encryption Feature Removed", _
"Prior versions of this add-in supported a reversible ""encryption"" of certain potentially sensitive items such as file paths. " & _
"This feature has been removed in this version of the add-in. More information can be found on GitHub issue #193 " & _
"of the joyfullservice/msaccess-vcs-integration project." & vbCrLf & vbCrLf & _
"For security reasons, this upgrade will REMOVE all existing encryption keys used by this add-in. " & _
"If you have source files for any projects that use these keys, " & _
"and do NOT have a working copy of the built database, please build the project(s) from source BEFORE upgrading the add-in. ", _
"REMOVE all existing encryption keys? (Make sure you have a copy of the keys.)", vbExclamation + vbYesNo + vbDefaultButton2) <> vbYes Then

' Cancel the installation if the user clicked anything other than Yes.
MsgBox2 "Installation Canceled", "Removal of existing encryption keys is required to upgrade.", , vbInformation
Exit Sub
End If
End If

' Show hourglass, as there may be a brief pause before the confirmation message.
DoCmd.Hourglass True

Expand Down Expand Up @@ -1628,5 +1645,5 @@ Private Sub Form_Load()
Else
lblInstalled.Caption = "Version " & InstalledVersion & " currently installed."
End If

End Sub
6 changes: 4 additions & 2 deletions Version Control.accda.src/forms/frmVCSMain.bas
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Begin Form
ItemSuffix =32
Left =-25575
Top =1710
Right =-5925
Right =-255
Bottom =14295
DatasheetGridlinesColor =15132391
RecSrcDt = Begin
Expand Down Expand Up @@ -2011,6 +2011,8 @@ End Sub
'---------------------------------------------------------------------------------------
'
Private Sub cmdOptions_Click()
' Force reload of options from current project before opening the form.
Set Options = Nothing
DoCmd.OpenForm "frmVCSOptions"
End Sub

Expand Down Expand Up @@ -2042,7 +2044,7 @@ Public Sub Form_Load()

' Require full export after options change
If DatabaseOpen Then
If VCSIndex.OptionsHash <> Options.GetOptionsHash Then
If VCSIndex.OptionsHash <> Options.GetHash Then
chkFullExport = True
chkFullExport.Enabled = False
End If
Expand Down
475 changes: 20 additions & 455 deletions Version Control.accda.src/forms/frmVCSOptions.bas

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions Version Control.accda.src/modules/clsDbProjProperty.bas
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ Private Sub IDbComponent_Export()
If Left(strPath, 4) = "rel:" Then
varValue = strPath
Else
' The full path may contain sensitive info. Encrypt the path but not the file name.
varValue = SecurePath(CStr(varValue))
varValue = CStr(varValue)
End If
' ADP projects may have this property
dCollection.Add prp.Name, SecurePath(CStr(varValue))
dCollection.Add prp.Name, CStr(varValue)
Case Else
dCollection.Add prp.Name, prp.Value
End Select
Expand Down Expand Up @@ -107,7 +106,7 @@ Private Sub IDbComponent_Import(strFile As String)
Case "Name", "Connection"
' Skip these properties
Case Else
varValue = Decrypt(dItems(varKey))
varValue = dItems(varKey)
If Left$(varValue, 4) = "rel:" Then varValue = GetPathFromRelative(CStr(varValue))
If dExisting.Exists(varKey) Then
If dItems(varKey) <> dExisting(varKey) Then
Expand Down
14 changes: 1 addition & 13 deletions Version Control.accda.src/modules/clsDbProperty.bas
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Private Sub IDbComponent_Export()
Dim dCollection As Dictionary
Dim dItem As Dictionary
Dim varValue As Variant
Dim strPath As String

Set dCollection = New Dictionary

Expand All @@ -51,15 +50,7 @@ Private Sub IDbComponent_Export()
If prp.Name = "AppIcon" Or prp.Name = "Name" Then
If Len(varValue) > 0 Then
' Try to use a relative path
strPath = GetRelativePath(CStr(varValue))
If Left(strPath, 4) = "rel:" Then
varValue = strPath
Else
' The full path may contain sensitive info. Secure the path but not the file name.
' (Whether the value is encrypted, removed or left as plain text depends on
' what is selected in the options.)
varValue = SecurePath(CStr(varValue))
End If
varValue = GetRelativePath(CStr(varValue))
End If
End If
Set dItem = New Dictionary
Expand Down Expand Up @@ -127,9 +118,6 @@ Private Sub IDbComponent_Import(strFile As String)
' Check if value is as Collection
If Not TypeOf dItems(varKey)("Value") Is Collection Then
varValue = dItems(varKey)("Value")
' Check for encryption
strDecrypted = Decrypt(CStr(varValue))
If CStr(varValue) <> strDecrypted Then varValue = strDecrypted
' Check for relative path
If Left$(varValue, 4) = "rel:" Then varValue = GetPathFromRelative(CStr(varValue))
Else
Expand Down
2 changes: 1 addition & 1 deletion Version Control.accda.src/modules/clsDbSavedSpec.bas
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Private Sub IDbComponent_Export()
With dSpec
.Add "Name", m_Spec.Name
.Add "Description", m_Spec.Description
.Add "XML", SecureBetween(m_Spec.XML, "<ImportExportSpecification Path = """, """")
.Add "XML", m_Spec.XML
End With
CatchAny eelNoError, vbNullString, , False

Expand Down
4 changes: 2 additions & 2 deletions Version Control.accda.src/modules/clsDbTableDef.bas
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Private Sub IDbComponent_Export()
Set dItem = New Dictionary
With dItem
.Add "Name", tbl.Name
.Add "Connect", Secure(SanitizeConnectionString(tbl.Connect))
.Add "Connect", SanitizeConnectionString(tbl.Connect)
.Add "SourceTableName", tbl.SourceTableName
.Add "Attributes", tbl.Attributes
' indexes (Find primary key)
Expand Down Expand Up @@ -396,7 +396,7 @@ Private Sub ImportLinkedTable(strFile As String)
Set dItem = dTable("Items")
Set dbs = CurrentDb
Set tdf = dbs.CreateTableDef(dItem("Name"))
strConnect = GetFullConnect(Decrypt(dItem("Connect")))
strConnect = GetFullConnect(dItem("Connect"))
With tdf
.Connect = strConnect
.SourceTableName = dItem("SourceTableName")
Expand Down
12 changes: 2 additions & 10 deletions Version Control.accda.src/modules/clsDbVbeReference.bas
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Private Sub IDbComponent_Import(strFile As String)
varVersion = Split(dRef("Version"), ".")
AddFromGuid proj, CStr(varKey), dRef("GUID"), CLng(varVersion(0)), CLng(varVersion(1))
ElseIf dRef.Exists("FullPath") Then
strPath = GetPathFromRelative(Decrypt(dRef("FullPath")))
strPath = GetPathFromRelative(dRef("FullPath"))
If Not FSO.FileExists(strPath) Then
Log.Error eelError, "File not found. Unable to add reference to " & strPath, "clsVbeReference.Import"
Else
Expand Down Expand Up @@ -136,15 +136,7 @@ Private Function GetDictionary() As Dictionary
With dRef
If ref.Type = vbext_rk_Project Then
' references of types mdb,accdb,mde etc don't have a GUID
strPath = GetRelativePath(ref.FullPath)
If strPath <> ref.FullPath Or Options.Security = esNone Then
' Use relative path, or full path if not secured.
.Add "FullPath", strPath
Else
' Found a non-relative path.
.Add "File", FSO.GetFileName(ref.FullPath)
If Options.Security <> esRemove Then .Add "FullPath", Secure(ref.FullPath)
End If
.Add "FullPath", GetRelativePath(ref.FullPath)
Else
If ref.Guid <> vbNullString Then .Add "GUID", ref.Guid
.Add "Version", CStr(ref.Major) & "." & CStr(ref.Minor)
Expand Down
26 changes: 22 additions & 4 deletions Version Control.accda.src/modules/clsLog.bas
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Public PadLength As Integer
Public LogFilePath As String
Public ErrorLevel As eErrorLevel

' Set this to true when logging an operation such as an export or build
' then set back to false after writing the log file. This affects
' how error messages are reported to the user outside of operations.
Public Active As Boolean

Private Const cstrSpacer As String = "-------------------------------------"

Private m_Log As clsConcat ' Log file output
Expand Down Expand Up @@ -161,10 +166,21 @@ Public Sub Error(eLevel As eErrorLevel, strDescription As String, Optional strSo
' Log the error and display if higher than warning.
Me.Add .GetStr, eLevel > eelWarning

' Show message box for fatal error.
If eLevel = eelCritical Then
MsgBox2 "Unable to Continue", .GetStr, _
"Please review the log file for additional details.", vbCritical
' See if we are actively logging an operation
If Log.Active Then
' Show message box for fatal error.
If eLevel = eelCritical Then
MsgBox2 "Unable to Continue", .GetStr, _
"Please review the log file for additional details.", vbCritical
End If
Else
' Show message on any error level when we are not logging to a file.
Select Case eLevel
Case eelNoError: ' Do nothing
Case eelWarning: MsgBox2 "Warning", .GetStr, , vbInformation
Case eelError: MsgBox2 "Error", .GetStr, , vbExclamation
Case eelCritical: MsgBox2 "Critical", .GetStr, , vbCritical
End Select
End If
End With

Expand Down Expand Up @@ -244,6 +260,8 @@ Private Sub Class_Initialize()
m_sngLastUpdate = 0
Me.PadLength = 30
Me.ErrorLevel = eelNoError
Me.Active = False
Me.LogFilePath = vbNullString
End Sub


Expand Down
Loading

0 comments on commit 4d85c76

Please sign in to comment.