-
Notifications
You must be signed in to change notification settings - Fork 666
DYN-9862 UnTrusted Paths Notifications #16752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
135ed9d
7af54ab
f147786
ec249c2
3309601
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -112,6 +112,17 @@ public void Loaded(ViewLoadedParams viewStartupParams) | |||||||||||||||||||||||||||||||||||||||||||
| viewStartupParams.dynamoMenu.Items.Add(notificationsMenuItem.MenuItem); | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| LoadNotificationCenter(); | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| //If TrustedLocations contain paths pointing to ProgramData, log a warning notification. | ||||||||||||||||||||||||||||||||||||||||||||
| string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); | ||||||||||||||||||||||||||||||||||||||||||||
| foreach (var location in viewModel.Model.PreferenceSettings.TrustedLocations) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| if (location.StartsWith(programDataPath)) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| Notifications.Add(new NotificationMessage("Preference Settings", Properties.Resources.UnsafePathDetectedTitle, Properties.Resources.UnsafePathDetectedDetail + "\n" + location)); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
RobertGlobant20 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||
| notificationsMenuItem.NotificationsChangeHandler.Invoke(this, null); | ||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
| foreach (var location in viewModel.Model.PreferenceSettings.TrustedLocations) | |
| { | |
| if (location.StartsWith(programDataPath)) | |
| { | |
| Notifications.Add(new NotificationMessage("Preference Settings", Properties.Resources.UnsafePathDetectedTitle, Properties.Resources.UnsafePathDetectedDetail + "\n" + location)); | |
| } | |
| } | |
| notificationsMenuItem.NotificationsChangeHandler.Invoke(this, null); | |
| bool notificationAdded = false; | |
| foreach (var location in viewModel.Model.PreferenceSettings.TrustedLocations) | |
| { | |
| if (location.StartsWith(programDataPath)) | |
| { | |
| Notifications.Add(new NotificationMessage("Preference Settings", Properties.Resources.UnsafePathDetectedTitle, Properties.Resources.UnsafePathDetectedDetail + "\n" + location)); | |
| notificationAdded = true; | |
| } | |
| } | |
| if (notificationAdded) | |
| { | |
| notificationsMenuItem.NotificationsChangeHandler.Invoke(this, null); | |
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path comparison using
StartsWith()may produce false positives on case-sensitive file systems or when paths have different separator formats. UsePath.GetFullPath()to normalize both paths before comparison, and consider usingStringComparison.OrdinalIgnoreCasefor the comparison to handle case differences on Windows.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed