summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gonzalez <daniel@gonzalez-nothnagel.de>2016-10-17 10:22:42 +0200
committerDaniel Gonzalez <daniel@gonzalez-nothnagel.de>2016-11-03 08:52:48 +0100
commitabfe2370edf7eda54fb5d7fc022d1e79974c8dfd (patch)
tree314bac31c3a56c9637fbff5c3abf634716ecab7d
parent75d5895bf58b81806797f4886dcd35b368839c83 (diff)
downloadheat-stable/liberty.tar.gz
Prevent template validate from scanning portsliberty-eolstable/liberty
The template validation method in the heat API allows to specify the template to validate using a URL with the 'template_url' parameter. By entering invalid http URLs, like 'http://localhost:22' it is possible to scan ports by evaluating the error message of the request. For example, the request curl -H "Content-Type: application/json" -H "X-Auth-Token: <TOKEN>" \ -X POST -d '{"template_url": "http://localhost:22"}' \ http://127.0.0.1:8004/v1/<TENANT_ID>/validate causes the following error message to be returned to the user: "Could not retrieve template: Failed to retrieve template: ('Connection aborted.', BadStatusLine('SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1\\r\\n',))" This could be misused by tenants to gain knowledge about the internal network the heat API runs in. To prevent this information leak, this patch alters the error message to not include such details when the url scheme is not 'file'. SecurityImpact Closes-Bug: #1606500 Change-Id: Id1f86f41c1e6c028d889eca7ccbb9cde67631950 (cherry picked from commit eab9a33ce760c55695a5beb2e541487588b08c98)
-rw-r--r--heat/common/urlfetch.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/heat/common/urlfetch.py b/heat/common/urlfetch.py
index 9cec56323..6a40d895b 100644
--- a/heat/common/urlfetch.py
+++ b/heat/common/urlfetch.py
@@ -75,4 +75,5 @@ def get(url, allowed_schemes=('http', 'https')):
return result
except exceptions.RequestException as ex:
- raise URLFetchError(_('Failed to retrieve template: %s') % ex)
+ LOG.info(_LI('Failed to retrieve template: %s') % ex)
+ raise URLFetchError(_('Failed to retrieve template from %s') % url)