1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Fixed hash being generated for pastes that didnt' specify password.

Updated GitVersion and Inforno nuget packages
This commit is contained in:
Uncled1023 2016-06-17 16:39:14 -07:00
parent 7d8691ebbe
commit c6dd9f2704
5 changed files with 25 additions and 21 deletions

View File

@ -84,8 +84,8 @@
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="SecurityDriven.Inferno, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="SecurityDriven.Inferno, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Inferno.1.2.0\lib\net452\SecurityDriven.Inferno.dll</HintPath> <HintPath>..\packages\Inferno.1.2.1\lib\net452\SecurityDriven.Inferno.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
@ -136,12 +136,12 @@
</COMReference> </COMReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets')" /> <Import Project="..\packages\GitVersionTask.3.5.4\build\dotnet\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.3.5.4\build\dotnet\GitVersionTask.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets'))" /> <Error Condition="!Exists('..\packages\GitVersionTask.3.5.4\build\dotnet\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.3.5.4\build\dotnet\GitVersionTask.targets'))" />
</Target> </Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -3,8 +3,8 @@
<package id="BouncyCastle" version="1.8.1" targetFramework="net452" /> <package id="BouncyCastle" version="1.8.1" targetFramework="net452" />
<package id="CommandLineParser" version="1.9.71" targetFramework="net452" /> <package id="CommandLineParser" version="1.9.71" targetFramework="net452" />
<package id="EntityFramework" version="6.1.3" targetFramework="net452" /> <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
<package id="GitVersionTask" version="3.5.3" targetFramework="net452" developmentDependency="true" /> <package id="GitVersionTask" version="3.5.4" targetFramework="net452" developmentDependency="true" />
<package id="Inferno" version="1.2.0" targetFramework="net452" /> <package id="Inferno" version="1.2.1" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" /> <package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net452" /> <package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net452" />
<package id="nClam" version="2.0.6.0" targetFramework="net452" /> <package id="nClam" version="2.0.6.0" targetFramework="net452" />

View File

@ -65,16 +65,20 @@ namespace Teknik.Areas.Paste.Controllers
// The paste has a password set // The paste has a password set
if (!string.IsNullOrEmpty(paste.HashedPassword)) if (!string.IsNullOrEmpty(paste.HashedPassword))
{ {
byte[] passBytes = Helpers.SHA384.Hash(paste.Key, password); string hash = string.Empty;
string hash = passBytes.ToHex(); if (!string.IsNullOrEmpty(password))
// We need to convert old pastes to the new password scheme
if (paste.Transfers.ToList().Exists(t => t.Type == TransferTypes.ASCIIPassword))
{ {
hash = Encoding.ASCII.GetString(passBytes); byte[] passBytes = Helpers.SHA384.Hash(paste.Key, password);
// Remove the transfer types hash = passBytes.ToHex();
paste.Transfers.Clear(); // We need to convert old pastes to the new password scheme
db.Entry(paste).State = EntityState.Modified; if (paste.Transfers.ToList().Exists(t => t.Type == TransferTypes.ASCIIPassword))
db.SaveChanges(); {
hash = Encoding.ASCII.GetString(passBytes);
// Remove the transfer types
paste.Transfers.Clear();
db.Entry(paste).State = EntityState.Modified;
db.SaveChanges();
}
} }
if (string.IsNullOrEmpty(password) || hash != paste.HashedPassword) if (string.IsNullOrEmpty(password) || hash != paste.HashedPassword)
{ {

View File

@ -95,8 +95,8 @@
<HintPath>..\packages\routedebugger.2.1.5\lib\net40\RouteDebugger.dll</HintPath> <HintPath>..\packages\routedebugger.2.1.5\lib\net40\RouteDebugger.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="SecurityDriven.Inferno, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="SecurityDriven.Inferno, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Inferno.1.2.0\lib\net452\SecurityDriven.Inferno.dll</HintPath> <HintPath>..\packages\Inferno.1.2.1\lib\net452\SecurityDriven.Inferno.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
@ -707,12 +707,12 @@
</FlavorProperties> </FlavorProperties>
</VisualStudio> </VisualStudio>
</ProjectExtensions> </ProjectExtensions>
<Import Project="..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets')" /> <Import Project="..\packages\GitVersionTask.3.5.4\build\dotnet\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.3.5.4\build\dotnet\GitVersionTask.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.3.5.3\build\dotnet\GitVersionTask.targets'))" /> <Error Condition="!Exists('..\packages\GitVersionTask.3.5.4\build\dotnet\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.3.5.4\build\dotnet\GitVersionTask.targets'))" />
</Target> </Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -7,8 +7,8 @@
<package id="BouncyCastle" version="1.8.1" targetFramework="net452" /> <package id="BouncyCastle" version="1.8.1" targetFramework="net452" />
<package id="EntityFramework" version="6.1.3" targetFramework="net452" userInstalled="true" /> <package id="EntityFramework" version="6.1.3" targetFramework="net452" userInstalled="true" />
<package id="FontAwesome" version="4.4.0" targetFramework="net452" userInstalled="true" /> <package id="FontAwesome" version="4.4.0" targetFramework="net452" userInstalled="true" />
<package id="GitVersionTask" version="3.5.3" targetFramework="net452" developmentDependency="true" /> <package id="GitVersionTask" version="3.5.4" targetFramework="net452" developmentDependency="true" />
<package id="Inferno" version="1.2.0" targetFramework="net452" userInstalled="true" /> <package id="Inferno" version="1.2.1" targetFramework="net452" userInstalled="true" />
<package id="jQuery" version="2.2.3" targetFramework="net452" userInstalled="true" /> <package id="jQuery" version="2.2.3" targetFramework="net452" userInstalled="true" />
<package id="jQuery.Validation" version="1.15.0" targetFramework="net452" userInstalled="true" /> <package id="jQuery.Validation" version="1.15.0" targetFramework="net452" userInstalled="true" />
<package id="MarkdownDeep.Full" version="1.5" targetFramework="net452" /> <package id="MarkdownDeep.Full" version="1.5" targetFramework="net452" />