Skip to content
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

Allowing developers to optionally disable MD5 content validation. #203

Open
wants to merge 32 commits into
base: develop-version-3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b9e4bd6
Merge commit '0a10d642167b49670d1fcb2bb12365aed9bbcecc'
Jeavon Nov 26, 2018
f825fa9
Merge commit 'dfb3959ef8844eacb8580b87463e3b1dfca4528d'
Jeavon Nov 26, 2018
319533f
Updating symbol server to use MyGet
Jeavon Oct 2, 2018
d994a5a
Update README.md
Jeavon Apr 8, 2019
eced146
Setting blob hostnames to use HTTPS by default
callumbwhyte Jul 16, 2019
3d570dc
Merge pull request #145 from callumbwhyte/blob-hostname-https
Jeavon Jul 17, 2019
365db14
Stream blob back to client rather than read into memory.
darrenferguson Jan 16, 2020
0cd5632
Merge pull request #156 from darrenferguson/feature/stream-blob
Jeavon Jan 28, 2020
d4ba8ca
Updating deployment keys
Jeavon Jan 28, 2020
8aca139
Update Myget key
Jeavon Jan 28, 2020
c60bb20
Remove old v1 MyGet
Jeavon Jan 28, 2020
efbc391
Update readme
Jeavon Jan 28, 2020
ae93f38
Bump to v1.1.0
Jeavon Feb 10, 2020
44ce92a
Version bump
Jeavon Feb 19, 2020
d4f1468
Revert "Stream blob back to client rather than read into memory."
Jeavon Mar 3, 2020
6a6e12a
Added ServicePointManager.SecurityProtocol to constructor to allow Um…
marshallcomp Mar 23, 2021
d5a81b7
Put it back to how it was
marshallcomp Mar 23, 2021
fd02074
Added ServicePointManager.SecurityProtocol to AzureFileSystem constru…
marshallcomp Mar 23, 2021
dc725be
Added support for Azure Key Vault in Umbraco 7, based on #182
Apr 5, 2021
24ec96e
Merge pull request #190 from RachBreeze/feature/tmpAzureKeyVaultv7
Jeavon Jul 9, 2021
5d993ea
Update appveyor.yml
Jeavon Jul 9, 2021
1109ca6
Merge pull request #187 from binraider/tls_1.2_fix
Jeavon Jul 14, 2021
77e1f3c
Update TLS setting to only add 1.2 if it doesn't exist already
Jeavon Jul 14, 2021
ee7f3aa
Bump
Jeavon Jul 14, 2021
10af7cf
Update for branch renames
Jeavon Sep 15, 2021
b288d6e
Update v1 build tools
Jeavon Sep 15, 2021
a06e5ae
Update AssemblyInfo
Jeavon Sep 15, 2021
b672a1e
Swap assembly patching
Jeavon Sep 15, 2021
8dd36a1
Remove release checking from proj
Jeavon Sep 15, 2021
d31051f
Gone
Jeavon Sep 15, 2021
d7f0f05
Set NuGet to have Umbraco dependancy <8 for v1
Jeavon Sep 15, 2021
97134b5
Allowed developers to optionally disable MD5 validation
Oct 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#VS 2015 hidden folder
src/.vs/*

build/tools/vswhere.2.0.2
build/tools/vswhere*
build/tools/vswhere.exe

artifacts/*
Expand Down
57 changes: 51 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# UmbracoFileSystemProviders.Azure
# UmbracoFileSystemProviders.Azure v1

**This version is for Umbraco v7 only**. For the v2 package for **Umbraco v8** please visit the [develop-umbraco-version-8 branch](https://github.com/JimBobSquarePants/UmbracoFileSystemProviders.Azure/tree/develop-umbraco-version-8)

![Image Alt](build/assets/logo/azure-logo-256.png)

Expand All @@ -16,7 +18,7 @@ Both NuGet and Umbraco packages are available. If you use NuGet but would like t
|NuGet Packages |Version |
|:-----------------|:-----------------|
|**Release**|[![NuGet download](http://img.shields.io/nuget/v/UmbracoFileSystemProviders.Azure.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure/)|[![NuGet count](https://img.shields.io/nuget/dt/UmbracoFileSystemProviders.Azure.svg)](https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure/)|
|**Pre-release**|[![MyGet download](https://img.shields.io/myget/umbracofilesystemproviders-azure/vpre/UmbracoFileSystemProviders.Azure.svg)](https://www.myget.org/gallery/umbracofilesystemproviders-azure)|[![MyGet count](https://img.shields.io/myget/umbracofilesystemproviders-azure/dt/UmbracoFileSystemProviders.Azure.svg)](https://www.myget.org/gallery/umbracofilesystemproviders-azure)|
|**Pre-release**|[![MyGet download](https://img.shields.io/myget/umbraco-packages/vpre/UmbracoFileSystemProviders.Azure.svg)](https://www.myget.org/feed/umbraco-packages/package/nuget/UmbracoFileSystemProviders.Azure)|[![MyGet count](https://img.shields.io/myget/umbraco-packages/dt/UmbracoFileSystemProviders.Azure.svg)](https://www.myget.org/feed/umbraco-packages/package/nuget/UmbracoFileSystemProviders.Azure)|

|Umbraco Packages | |
|:-----------------|:-----------------|
Expand Down Expand Up @@ -51,7 +53,7 @@ Update `~/Config/FileSystemProviders.config` replacing the default provider with
<Provider alias="media" type="Our.Umbraco.FileSystemProviders.Azure.AzureBlobFileSystem, Our.Umbraco.FileSystemProviders.Azure">
<Parameters>
<add key="containerName" value="media" />
<add key="rootUrl" value="http://[myAccountName].blob.core.windows.net/" />
<add key="rootUrl" value="https://[myAccountName].blob.core.windows.net/" />
<add key="connectionString" value="DefaultEndpointsProtocol=https;AccountName=[myAccountName];AccountKey=[myAccountKey]"/>
<!--
Optional configuration value determining the maximum number of days to cache items in the browser.
Expand Down Expand Up @@ -125,17 +127,60 @@ In `FileSystemProviders.config` remove the default parameters and add a new one
</FileSystemProviders>
```


In `Web.config` create the new application keys and post fix each key with the `alias` defined in `FileSystemProviders.config` after a colon.

```xml
<add key="AzureBlobFileSystem.ConnectionString:media" value="DefaultEndpointsProtocol=https;AccountName=[myAccountName];AccountKey=[myAccountKey]" />
<add key="AzureBlobFileSystem.ContainerName:media" value="media" />
<add key="AzureBlobFileSystem.RootUrl:media" value="http://[myAccountName].blob.core.windows.net/" />
<add key="AzureBlobFileSystem.RootUrl:media" value="https://[myAccountName].blob.core.windows.net/" />
<add key="AzureBlobFileSystem.MaxDays:media" value="365" />
<add key="AzureBlobFileSystem.UseDefaultRoute:media" value="true" />
<add key="AzureBlobFileSystem.UsePrivateContainer:media" value="false" />
```

**Available in v1.1.2+**
It is possible to disable the MD5 Content Validation.

MD5 Is used to check the integrity of files downloaded. Only disable MD5 validation if you trust the source of the files and know that there has been no issue with file upload.
For example open the file directly from blobstorage to check that it opens without issue.

To use this property:

In `FileSystemProviders.config` remove the default parameters and add a new one with the key `disableContentMD5Validation`, the value should be true to disable it, by default it is enabled

```xml
<?xml version="1.0"?>
<FileSystemProviders>

<!-- Media -->
<Provider alias="media" type="Our.Umbraco.FileSystemProviders.Azure.AzureBlobFileSystem, Our.Umbraco.FileSystemProviders.Azure">
<Parameters>
<add key="disableContentMD5Validation" value="true"/>
</Parameters>
</Provider>

</FileSystemProviders>
```

Or in `Web.config`

```xml
<add key="AzureBlobFileSystem.UsePrivateContainer:disableContentMD5Validation" value="true" />
```

#### Configuration for Azure Key Vault
For Azure Key Vault only the key values in the `Web.config` should use '-', rather than a '.' or ':' as shown below

```xml
<add key="AzureBlobFileSystem-ConnectionString-media" value="DefaultEndpointsProtocol=https;AccountName=[myAccountName];AccountKey=[myAccountKey]" />
<add key="AzureBlobFileSystem-ContainerName-media" value="media" />
<add key="AzureBlobFileSystem-RootUrl-media" value="https://[myAccountName].blob.core.windows.net/" />
<add key="AzureBlobFileSystem-MaxDays-media" value="365" />
<add key="AzureBlobFileSystem-UseDefaultRoute-media" value="true" />
<add key="AzureBlobFileSystem-UsePrivateContainer-media" value="false" />
```

## Virtual Path Provider
By default the plugin will serve files transparently from your domain or serve media directly from Azure. This is made possible by using a custom [Virtual Path Provider](https://msdn.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider%28v=vs.110%29.aspx) included and automatically initialised upon application startup. This can be disable by adding the configuration setting noted above.

Expand Down Expand Up @@ -186,7 +231,7 @@ the cloud simply install the [configuration package](https://www.nuget.org/packa
<settings>
<setting key="MaxBytes" value="8194304"/>
<setting key="Timeout" value="30000"/>
<setting key="Host" value="http://[myAccountName].blob.core.windows.net/media/"/>
<setting key="Host" value="https://[myAccountName].blob.core.windows.net/media/"/>
</settings>
</service>
</services>
Expand All @@ -206,7 +251,7 @@ If using a version of ImageProcessor.Web version [4.5.0](https://www.nuget.org/p
<setting key="Container" value="media"/>
<setting key="MaxBytes" value="8194304"/>
<setting key="Timeout" value="30000"/>
<setting key="Host" value="http://[myAccountName].blob.core.windows.net/media"/>
<setting key="Host" value="https://[myAccountName].blob.core.windows.net/media"/>
</settings>
</service>
</services>
Expand Down
118 changes: 100 additions & 18 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,49 @@
os: Visual Studio 2017

# Version format
version: 1.0.3.{build}
version: 1.2.1.{build}

cache:
- src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified

# UMBRACO_PACKAGE_PRERELEASE_SUFFIX if a rtm release build this should be blank, otherwise if empty will default to alpha
# example UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta
init:
- set UMBRACO_PACKAGE_PRERELEASE_SUFFIX=
configuration: Release

environment:
# Version Suffix
version_suffix: alpha

install:
- ps: .\build\appveyor-semver.ps1
- ps: .\build\check-release-version.ps1
- ps: Update-AppveyorBuild -Version $Env:appveyor_version
- cmd: >-
cd build

npm install

cd..
- ps: >-
$msiPath = "$($env:USERPROFILE)\MicrosoftAzureStorageEmulator.msi"

(New-Object Net.WebClient).DownloadFile('https://download.microsoft.com/download/F/3/8/F3857A38-D344-43B4-8E5B-2D03489909B9/MicrosoftAzureStorageEmulator.msi', $msiPath)

cmd /c start /wait msiexec /i $msiPath /quiet

assembly_info:
patch: true
file: 'src\UmbracoFileSystemProviders.Azure**\AssemblyInfo.*'
assembly_version: '$(appveyor_file_version)'
assembly_file_version: '$(appveyor_file_version)'
assembly_informational_version: '$(mssemver)'

build_script:
- build-appveyor.cmd
- cmd: >-
build-appveyor.cmd

cd..

before_test:
- cmd: '"%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" start'
- cmd: '"%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" start'
# Turn tests off just now
test: on

Expand All @@ -32,33 +52,95 @@ artifacts:
- path: artifacts\*.zip

deploy:
# MyGet Deployment for builds & releases
# Umbraco MyGet community feed - v3
- provider: NuGet
server: https://www.myget.org/F/umbraco-packages/api/v2/package
symbol_server: https://www.myget.org/F/umbraco-packages/symbols/api/v2/package
api_key:
secure: yvlnQEq6tmxGOdbtTuKyAhcdY1GCD98/sG9+Qo7y7SNb89GAbjLXxueOMspkjvUh
artifact: /.*\.nupkg/
on:
branch: develop-version-3

# GitHub Deployment for releases -v3
- provider: GitHub
auth_token:
secure: Kucu1gQQf8bjRlkR72fyZUiUtmkz7rtZEIgK/RMT1pMnq700m5sSQTiFHOSQUdR5
artifact: /.*\.zip/ # upload all Zip packages to release assets
draft: false
prerelease: false
on:
branch: main-version-3
appveyor_repo_tag: true # deploy on tag push only

# NuGet Deployment for releases - v3
- provider: NuGet
server:
api_key:
secure: TtE4dizVNNLoy4gfrJDGRH1/vfNMTXiAxuMW0va1bcO1ZPXCw0qy12PUfIB+h9O3
artifact: /.*\.nupkg/
on:
branch: main-version-3
appveyor_repo_tag: true

# Umbraco MyGet community feed
- provider: NuGet
server: https://www.myget.org/F/umbraco-packages/api/v2/package
symbol_server: https://www.myget.org/F/umbraco-packages/symbols/api/v2/package
api_key:
secure: yvlnQEq6tmxGOdbtTuKyAhcdY1GCD98/sG9+Qo7y7SNb89GAbjLXxueOMspkjvUh
artifact: /.*\.nupkg/
on:
branch: develop-version-2

# GitHub Deployment for releases -v2
- provider: GitHub
auth_token:
secure: Kucu1gQQf8bjRlkR72fyZUiUtmkz7rtZEIgK/RMT1pMnq700m5sSQTiFHOSQUdR5
artifact: /.*\.zip/ # upload all Zip packages to release assets
draft: false
prerelease: false
on:
branch: master-version-2
appveyor_repo_tag: true # deploy on tag push only

# NuGet Deployment for releases - v2
- provider: NuGet
server:
api_key:
secure: TtE4dizVNNLoy4gfrJDGRH1/vfNMTXiAxuMW0va1bcO1ZPXCw0qy12PUfIB+h9O3
artifact: /.*\.nupkg/
on:
branch: master-version-2
appveyor_repo_tag: true

# MyGet Deployment for builds & releases -v1
- provider: NuGet
server: https://www.myget.org/F/umbracofilesystemproviders-azure/api/v2/package
symbol_server: https://www.myget.org/F/umbracofilesystemproviders-azure/symbols/api/v2/package
server: https://www.myget.org/F/umbraco-packages/api/v2/package
symbol_server: https://www.myget.org/F/umbraco-packages/symbols/api/v2/package
api_key:
secure: fz0rUrt3B1HczUC1ZehwVsrFSWX9WZGDQoueDztLte9/+yQG+BBU7UrO+coE8lUf
secure: yvlnQEq6tmxGOdbtTuKyAhcdY1GCD98/sG9+Qo7y7SNb89GAbjLXxueOMspkjvUh
artifact: /.*\.nupkg/
on:
branch: develop
branch: develop-version-1

# GitHub Deployment for releases
# GitHub Deployment for releases -v1
- provider: GitHub
auth_token:
secure: gnJNHw3btYiQ7G0GexIGpSyA3moAz/GuJvgGZvJmz63/+YVLFC+qew/xlniRLDSk
secure: Kucu1gQQf8bjRlkR72fyZUiUtmkz7rtZEIgK/RMT1pMnq700m5sSQTiFHOSQUdR5
artifact: /.*\.zip/ # upload all Zip packages to release assets
draft: false
prerelease: false
on:
branch: master
branch: main-version-1
appveyor_repo_tag: true # deploy on tag push only

# NuGet Deployment for releases
# NuGet Deployment for releases - v1
- provider: NuGet
server:
api_key:
secure: kHataLiMb9nmJEdwBE4BTXvA4nOpoD3Fw14zVeDP6Vs0ZXpL7c8qeegMv/jMZECP
secure: TtE4dizVNNLoy4gfrJDGRH1/vfNMTXiAxuMW0va1bcO1ZPXCw0qy12PUfIB+h9O3
artifact: /.*\.nupkg/
on:
branch: master
branch: main-version-1
appveyor_repo_tag: true
21 changes: 13 additions & 8 deletions build-appveyor.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ECHO APPVEYOR_REPO_BRANCH: %APPVEYOR_REPO_BRANCH%
ECHO APPVEYOR_REPO_TAG: %APPVEYOR_REPO_TAG%
ECHO APPVEYOR_BUILD_NUMBER : %APPVEYOR_BUILD_NUMBER%
ECHO APPVEYOR_BUILD_VERSION : %APPVEYOR_BUILD_VERSION%
ECHO CONFIGURATION : %CONFIGURATION%

CALL NuGet.exe restore src\UmbracoFileSystemProviders.Azure.sln

Expand All @@ -14,24 +15,28 @@ IF NOT EXIST "%toolsFolder%" (

IF NOT EXIST "%toolsFolder%vswhere.exe" (
ECHO vswhere not found - fetching now
nuget install vswhere -Version 2.0.2 -Source nuget.org -OutputDirectory tools
nuget install vswhere -Version 2.7.1 -Source nuget.org -OutputDirectory tools
)

FOR /f "delims=" %%A in ('dir "%toolsFolder%vswhere.*" /b') DO SET "vswhereExePath=%toolsFolder%%%A\"
MOVE "%vswhereExePath%tools\vswhere.exe" "%toolsFolder%vswhere.exe"

for /f "usebackq tokens=1* delims=: " %%i in (`"%CD%\tools\vswhere.exe" -latest -requires Microsoft.Component.MSBuild`) do (
if /i "%%i"=="installationPath" set InstallDir=%%j
)
SETLOCAL EnableDelayedExpansion

:: This string specifies vs 2019
:: set vswherestr=^"!%CD%\tools\vswhere.exe^" -version [16.0,17.0^^) -latest -prerelease -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe

SET VSWherePath="%InstallDir%\MSBuild"
set vswherestr=^"!%CD%\tools\vswhere.exe^" -latest -prerelease -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe
for /f "usebackq tokens=*" %%i in (`!vswherestr!`) do (
set MsBuildDir=%%i
)

ECHO.
ECHO Visual Studio is installed in: %InstallDir%
ECHO MsBuild is installed in: %MsBuildDir%

CALL "%InstallDir%\MSBuild\15.0\Bin\amd64\MsBuild.exe" package.proj %~1
CALL "%MsBuildDir%" package.proj %~1

@IF %ERRORLEVEL% NEQ 0 GOTO err
@EXIT /B 0
:err
@EXIT /B 1
@EXIT /B 1
13 changes: 11 additions & 2 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ECHO off

SET /P APPVEYOR_BUILD_NUMBER=Please enter a build number (e.g. 134):
SET /P PACKAGE_VERISON=Please enter your package version (e.g. 1.0.5):
SET /P UMBRACO_PACKAGE_PRERELEASE_SUFFIX=Please enter your package release suffix or leave empty (e.g. beta):
SET /P version_suffix=Please enter your package release suffix or leave empty (e.g. beta):

SET /P APPVEYOR_REPO_TAG=If you want to simulate a GitHub tag for a release (e.g. true):

Expand All @@ -13,10 +13,19 @@ if "%PACKAGE_VERISON%" == "" (
SET PACKAGE_VERISON=0.1.0
)

SET APPVEYOR_BUILD_VERSION=%PACKAGE_VERISON%.%APPVEYOR_BUILD_NUMBER%
SET mssemver=%PACKAGE_VERISON%-beta-%APPVEYOR_BUILD_NUMBER%

SET CONFIGURATION=Debug

cd build
call npm install
call node appveyor-nuspec-patch.js
cd..

build-appveyor.cmd

cd..

@IF %ERRORLEVEL% NEQ 0 GOTO err
@EXIT /B 0
:err
Expand Down