Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 039141a

Browse files
committed
Add v3.42.8
1 parent d5baa8b commit 039141a

File tree

7 files changed

+37
-16
lines changed

7 files changed

+37
-16
lines changed

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ I documented my installation process, with additional steps to add Sendgrid, SSL
99
In any case I suggest forking my repository into your own, this to avoid changes I make to my repository to negatively impact your installation.
1010

1111
### One-click deploy
12-
[![Deploy to Azure](https://azuredeploy.net/deploybutton.png)](https://azuredeploy.net/)
13-
[![Visualize](http://armviz.io/visualizebutton.png)](http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FYannickRe%2FGhost-Azure%2Fazure%2Fazuredeploy.json)
12+
[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FYannickRe%2FGhost-Azure%2Fmaster%2Fazuredeploy.json)
1413

1514
### Azure App Service Deployment Center
1615
More info on [Microsoft Docs](https://docs.microsoft.com/en-us/azure/app-service/deploy-continuous-deployment#deploy-continuously-from-github)

azuredeploy.json

+8-9
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
"hostingPlanName": {
99
"type": "string"
1010
},
11-
"siteLocation": {
12-
"type": "string"
13-
},
1411
"sku": {
1512
"type": "string",
1613
"allowedValues": [
@@ -56,10 +53,12 @@
5653
"defaultValue": ""
5754
},
5855
"repoUrl": {
59-
"type": "string"
56+
"type": "string",
57+
"defaultValue": "https://github.com/<<PutYourGitHubUserHere>>/Ghost-Azure"
6058
},
6159
"branch": {
62-
"type": "string"
60+
"type": "string",
61+
"defaultValue": "master"
6362
}
6463
},
6564
"variables": {
@@ -71,7 +70,7 @@
7170
{
7271
"name": "[parameters('hostingPlanName')]",
7372
"type": "Microsoft.Web/serverfarms",
74-
"location": "[parameters('siteLocation')]",
73+
"location": "[resourceGroup().location]",
7574
"apiVersion": "2018-02-01",
7675
"sku": {
7776
"name": "[variables('sku')]"
@@ -85,7 +84,7 @@
8584
{
8685
"name": "[parameters('siteName')]",
8786
"type": "Microsoft.Web/sites",
88-
"location": "[parameters('siteLocation')]",
87+
"location": "[resourceGroup().location]",
8988
"apiVersion": "2018-11-01",
9089
"dependsOn": [
9190
"[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
@@ -152,7 +151,7 @@
152151
{
153152
"name": "[variables('appInsightsName')]",
154153
"type": "Microsoft.Insights/components",
155-
"location": "[parameters('siteLocation')]",
154+
"location": "[resourceGroup().location]",
156155
"apiVersion": "2014-04-01",
157156
"condition": "[parameters('Deploy App Insights')]",
158157
"dependsOn": [
@@ -167,4 +166,4 @@
167166
}
168167
}
169168
]
170-
}
169+
}

core/frontend/helpers/url.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ module.exports = function url(options) {
1111
const absolute = options && options.hash.absolute && options.hash.absolute !== 'false';
1212
let outputUrl = getMetaDataUrl(this, absolute);
1313

14-
outputUrl = encodeURI(decodeURI(outputUrl));
14+
try {
15+
outputUrl = encodeURI(decodeURI(outputUrl));
16+
} catch (err) {
17+
// Happens when the outputURL contains an invalid URI character like "%%" or "%80"
18+
return new SafeString('');
19+
}
1520

1621
return new SafeString(outputUrl);
1722
};

core/server/services/oembed.js

+6
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class OEmbed {
8585
}
8686

8787
async fetchBookmarkData(url) {
88+
// Metascraper doesn't handle leading/trailing whitespace
89+
url = url.trim();
8890
const metascraper = require('metascraper')([
8991
require('metascraper-url')(),
9092
require('metascraper-title')(),
@@ -154,6 +156,10 @@ class OEmbed {
154156
}
155157

156158
fetchOembedData(_url, cardType) {
159+
// Trimming solves the difference of url validation between `new URL(url)`
160+
// and metascraper.
161+
_url = _url.trim();
162+
157163
// parse the url then validate the protocol and host to make sure it's
158164
// http(s) and not an IP address or localhost to avoid potential access to
159165
// internal network endpoints

core/server/web/site/middleware/handle-image-sizes.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const _ = require('lodash');
22
const path = require('path');
3+
const {GhostError} = require('@tryghost/errors');
34
const imageTransform = require('@tryghost/image-transform');
45
const storage = require('../../../adapters/storage');
56
const activeTheme = require('../../../../frontend/services/themes/active');
@@ -100,6 +101,12 @@ module.exports = function (req, res, next) {
100101
return storageInstance.read({path: storagePath});
101102
})
102103
.then((originalImageBuffer) => {
104+
if (originalImageBuffer.length <= 0) {
105+
throw new GhostError({
106+
errorType: 'NoContentError',
107+
statusCode: 204
108+
});
109+
}
103110
return imageTransform.resizeFromBuffer(originalImageBuffer, imageDimensionConfig);
104111
})
105112
.then((resizedImageBuffer) => {
@@ -108,7 +115,7 @@ module.exports = function (req, res, next) {
108115
}).then(() => {
109116
next();
110117
}).catch(function (err) {
111-
if (err.code === 'SHARP_INSTALLATION') {
118+
if (err.code === 'SHARP_INSTALLATION' || err.code === 'IMAGE_PROCESSING' || err.errorType === 'NoContentError') {
112119
return redirectToOriginal();
113120
}
114121
next(err);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ghost",
3-
"version": "3.42.7",
3+
"version": "3.42.8",
44
"description": "The professional publishing platform",
55
"author": "Ghost Foundation",
66
"homepage": "https://ghost.org",

web.config

+7-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,16 @@
4242
</rewrite>
4343
<httpProtocol>
4444
<customHeaders>
45-
<remove name="X-Powered-By" />
45+
<add name="X-Frame-Options" value="SAMEORIGIN"/>
46+
<add name="X-Content-Type-Options" value="nosniff"/>
47+
<add name="Content-Security-Policy" value="upgrade-insecure-requests; base-uri 'self'; frame-ancestors 'self'; form-action 'self'; object-src 'none';"/>
48+
<add name="Permissions-Policy" value="accelerometer=(self), camera=(self), geolocation=(self), gyroscope=(self), magnetometer=(self), microphone=(self), payment=(self), usb=(self)" />
49+
<add name="Referrer-Policy" value="strict-origin-when-cross-origin"/>
50+
<remove name="X-Powered-By" />
4651
</customHeaders>
4752
</httpProtocol>
4853
<security>
4954
<requestFiltering removeServerHeader="true" />
5055
</security>
5156
</system.webServer>
52-
</configuration>
57+
</configuration>

0 commit comments

Comments
 (0)