Remove Precompilation_WorksForViewsUsingDirectoryTraversal

This commit is contained in:
Pranav K 2018-08-07 11:25:18 -07:00
Родитель 63e17ca673
Коммит 53ad62a3fa
13 изменённых файлов: 1 добавлений и 247 удалений

Просмотреть файл

@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 15.0.26730.03
@ -46,8 +46,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongNamedApp", "testapps\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithParseErrors", "testapps\ApplicationWithParseErrors\ApplicationWithParseErrors.csproj", "{AF647059-B86B-46DD-9559-E1324A39B148}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationUsingRelativePaths", "testapps\ApplicationUsingRelativePaths\ApplicationUsingRelativePaths.csproj", "{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithConfigureMvc", "testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj", "{559FBB83-40BC-47AF-A224-312CF8E3629B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithCustomInputFiles", "testapps\ApplicationWithCustomInputFiles\ApplicationWithCustomInputFiles.csproj", "{8F73A290-BCE1-461A-9970-397FFBFCC902}"
@ -177,18 +175,6 @@ Global
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|x64.Build.0 = Release|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|x86.ActiveCfg = Release|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|x86.Build.0 = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x64.ActiveCfg = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x64.Build.0 = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x86.ActiveCfg = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x86.Build.0 = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|Any CPU.Build.0 = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|x64.ActiveCfg = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|x64.Build.0 = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|x86.ActiveCfg = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|x86.Build.0 = Release|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -310,7 +296,6 @@ Global
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{87C6A03D-1655-4D1C-82E5-8F553BF4096D} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{AF647059-B86B-46DD-9559-E1324A39B148} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{559FBB83-40BC-47AF-A224-312CF8E3629B} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{8F73A290-BCE1-461A-9970-397FFBFCC902} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{196EF313-71CB-47A9-A77D-AACAF62881A1} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}

Просмотреть файл

@ -1,60 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
public class ApplicationUsingRelativePathsTest_CoreCLR :
LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationUsingRelativePaths.Startup>>
{
public ApplicationUsingRelativePathsTest_CoreCLR(
CoreCLRApplicationTestFixture<ApplicationUsingRelativePaths.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task Precompilation_WorksForViewsUsingRelativePath()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.Index.txt", response);
}
}
[Fact]
public async Task Precompilation_WorksForViewsUsingDirectoryTraversal()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response);
}
}
}
}

Просмотреть файл

@ -1,63 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class ApplicationUsingRelativePathsTest_Desktop :
LoggedTest, IClassFixture<DesktopApplicationTestFixture<ApplicationUsingRelativePaths.Startup>>
{
public ApplicationUsingRelativePathsTest_Desktop(
DesktopApplicationTestFixture<ApplicationUsingRelativePaths.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task Precompilation_WorksForViewsUsingRelativePath()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.Index.txt", response);
}
}
[ConditionalFact]
public async Task Precompilation_WorksForViewsUsingDirectoryTraversal()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response);
}
}
}
}

Просмотреть файл

@ -34,7 +34,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\testapps\ApplicationUsingRelativePaths\ApplicationUsingRelativePaths.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithCustomInputFiles\ApplicationWithCustomInputFiles.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithParseErrors\ApplicationWithParseErrors.csproj" />

Просмотреть файл

@ -1,16 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>$(StandardTestAppTfms)</TargetFrameworks>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="$(MicrosoftExtensionsConfigurationCommandLinePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,19 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace ApplicationUsingRelativePaths.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View("Views/Home/Index.cshtml");
}
public IActionResult About()
{
ViewData["Message"] = "Your application description page.";
return View();
}
}
}

Просмотреть файл

@ -1,26 +0,0 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace ApplicationUsingRelativePaths
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}

Просмотреть файл

@ -1,21 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace ApplicationUsingRelativePaths
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
app.UseMvcWithDefaultRoute();
}
}
}

Просмотреть файл

@ -1,8 +0,0 @@
@{
Layout = "../Shared/_Layout.cshtml";
ViewData["Title"] = "About";
}
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>
<p>Use this area to provide additional information.</p>

Просмотреть файл

@ -1,6 +0,0 @@
@{
ViewData["Title"] = "Home Page";
}
@GetType().Assembly.FullName
Hello from Index!

Просмотреть файл

@ -1,6 +0,0 @@
<!DOCTYPE html>
<html>
<body>
@RenderBody()
</body>
</html>

Просмотреть файл

@ -1,2 +0,0 @@
@using ApplicationUsingRelativePaths
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

Просмотреть файл

@ -1,3 +0,0 @@
@{
Layout = "Shared/_Layout.cshtml";
}