Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1086)

Unified Diff: obsolete/Microsoft.VisualStudio.Project/UserProjectSecurityChecker.cs

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: obsolete/Microsoft.VisualStudio.Project/UserProjectSecurityChecker.cs
diff --git a/obsolete/Microsoft.VisualStudio.Project/UserProjectSecurityChecker.cs b/obsolete/Microsoft.VisualStudio.Project/UserProjectSecurityChecker.cs
deleted file mode 100644
index d26d11e4ceb6e5acbba9351267be05d4370ca7a6..0000000000000000000000000000000000000000
--- a/obsolete/Microsoft.VisualStudio.Project/UserProjectSecurityChecker.cs
+++ /dev/null
@@ -1,181 +0,0 @@
-/// Copyright (c) Microsoft Corporation. All rights reserved.
-
-using System;
-using System.Globalization;
-using System.IO;
-using Microsoft.VisualStudio.Build.ComInteropWrapper;
-
-namespace Microsoft.VisualStudio.Project
-{
- /// <summary>
- /// Does security validation of a user project before loading the project.
- /// </summary>
- public class UserProjectSecurityChecker : ProjectSecurityChecker
- {
- #region fields
- /// <summary>
- /// The project shim for the main project file.
- /// We need this otherwise the msbuild API cannot check the user file.
- /// </summary>
- private ProjectShim mainProjectShim;
-
- #endregion
-
- #region ctors
- /// <summary>
- /// Overloaded Constructor
- /// </summary>
- /// <param name="projectFilePath">path to the project file</param>
- /// <param name="serviceProvider">A service provider.</param>
- public UserProjectSecurityChecker(IServiceProvider serviceProvider, string projectFilePath) :
- base(serviceProvider, projectFilePath)
- {
- }
- #endregion
-
- #region properties
- /// <summary>
- /// The main projects' shim.
- /// </summary>
- internal protected ProjectShim MainProjectShim
- {
- get
- {
- return this.mainProjectShim;
- }
- internal set
- {
- this.mainProjectShim = value;
- }
- }
- #endregion
-
- #region overridden method
- /// <summary>
- /// Checks if the user file is safe with imports. If it has then the user file is considered unsafe.
- /// </summary>
- /// <param name="securityErrorMessage">At return describes the reason why the projects is not considered safe.</param>
- /// <returns>true if the user project is safe regarding imports.</returns>
- protected override bool IsProjectSafeWithImports(out string securityErrorMessage)
- {
- securityErrorMessage = String.Empty;
-
- string[] directImports = this.SecurityCheckHelper.GetDirectlyImportedProjects(this.ProjectShim);
-
- if(directImports != null && directImports.Length > 0)
- {
- securityErrorMessage = String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.DetailsUserImport, CultureInfo.CurrentUICulture), Path.GetFileName(this.ProjectShim.FullFileName), directImports[0]);
- return false;
- }
-
- return true;
- }
-
- /// <summary>
- /// Checks if the project is safe regarding properties.
- /// </summary>
- /// <param name="securityErrorMessage">At return describes the reason why the projects is not considered safe.</param>
- /// <returns>true if the project has only safe properties.</returns>
- protected override bool IsProjectSafeWithProperties(out string securityErrorMessage)
- {
- securityErrorMessage = String.Empty;
-
- // Now ask the security check heper for the safe properties.
- string reasonForFailure;
- bool isUserFile;
- bool isProjectSafe = this.SecurityCheckHelper.IsProjectSafe(ProjectSecurityChecker.DangerousPropertyProperty,
- ProjectSecurityChecker.DefaultDangerousProperties,
- this.mainProjectShim,
- this.ProjectShim,
- SecurityCheckPass.Properties,
- out reasonForFailure,
- out isUserFile);
-
- // Main project gets precedence over the user project.
- // Do not report that since this is only for the user file.
- if(!isUserFile)
- {
- return true;
- }
-
- if(!isProjectSafe)
- {
- securityErrorMessage = this.GetMessageString(reasonForFailure, SR.DetailsProperty);
- }
-
- return isProjectSafe;
- }
-
- /// <summary>
- /// Checks if the project is safe regarding targets.
- /// </summary>
- /// <param name="securityErrorMessage">At return describes the reason why the projects is not considered safe.</param>
- /// <returns>true if the project has only safe targets.</returns>
- protected override bool IsProjectSafeWithTargets(out string securityErrorMessage)
- {
- securityErrorMessage = String.Empty;
-
- // Now ask the security check heper for the safe targets.
- string reasonForFailure;
- bool isUserFile;
- bool isProjectSafe = this.SecurityCheckHelper.IsProjectSafe(ProjectSecurityChecker.DangerousTargetProperty,
- ProjectSecurityChecker.DefaultDangerousTargets,
- this.mainProjectShim,
- this.ProjectShim,
- SecurityCheckPass.Targets,
- out reasonForFailure,
- out isUserFile);
-
- // Main project gets precedence over the user project.
- // Do not report that since this is only for the user file.
- if(!isUserFile)
- {
- return true;
- }
-
- if(!isProjectSafe)
- {
- securityErrorMessage = this.GetMessageString(reasonForFailure, SR.DetailsTarget);
- }
-
- return isProjectSafe;
- }
-
- /// <summary>
- /// Checks if the project is safe regarding items.
- /// </summary>
- /// <param name="securityErrorMessage">At return describes the reason why the projects is not considered safe.</param>
- /// <returns>true if the project has only safe items.</returns>
- protected override bool IsProjectSafeWithItems(out string securityErrorMessage)
- {
- securityErrorMessage = String.Empty;
-
- // Now ask the security check heper for the safe items.
- string reasonForFailure;
- bool isUserFile;
-
- bool isProjectSafe = this.SecurityCheckHelper.IsProjectSafe(ProjectSecurityChecker.DangerousItemsProperty,
- ProjectSecurityChecker.DefaultDangerousItems,
- this.mainProjectShim,
- this.ProjectShim,
- SecurityCheckPass.Items,
- out reasonForFailure,
- out isUserFile);
-
- // Main project gets precedence over the user project.
- // Do not report that since this is only for the user file.
- if(!isUserFile)
- {
- return true;
- }
-
- if(!isProjectSafe)
- {
- securityErrorMessage = this.GetMessageString(reasonForFailure, SR.DetailsItem);
- }
-
- return isProjectSafe;
- }
- #endregion
- }
-}

Powered by Google App Engine
This is Rietveld 408576698