-
Notifications
You must be signed in to change notification settings - Fork 62
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
Fix #33: Add X-Watchman-Version
header to responses
#35
Conversation
* Add response header * Add tests for dashboard / watchman json views * Update history.rst
'checks': check_types, | ||
'overall_status': overall_status | ||
}) | ||
|
||
response[WATCHMAN_VERSION_HEADER] = __version__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that feels so hacky but I know of no better way 🌟
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's how they say to do it in the docs: https://docs.djangoproject.com/en/1.8/ref/request-response/#setting-header-fields
👍 |
Conflicts: HISTORY.rst watchman/views.py
Fix #33: Add `X-Watchman-Version` header to responses
I'm curious - what was the motivation for this? A long, long time ago [in a galaxy far away] PHPBB included its version number in the footer at the bottom of it's pages. Then arose a character [aligned with the dark side], who wrote a novel piece of malware that would infect vulnerable versions of PHPBB by automatically Googling for the vulnerable version strings, and then attack them [with lightsabers]. Eventually [the prophecy of] a more secure PHPBB version came to pass, which removed its version string from the footer and fixed the exploit, and the malware was stopped [by a well-aimed shot into one of its exhaust ports]. So, if an attacker can get the version of watchman, they can limit their known range of versions of Django (eg: version Basically: version information disclosure to malicious parties violates defense-in-depth guidelines. Now, this is only an issue when either of the following is true:
The first is unlikely yet possible with PR #30 if the authentication/authorization decorator is flawed, and the second is a misplaced trust issue to being with. There are also a few ameliorating factors:
Given all of that, this isn't a huge deal, I just want to recognize that this PR creates a small, mild defense-in-depth violation for essentially what are misconfigured systems already. Making a note about this issue in the documentation for watchman might be a good idea to help users avoid this potential pitfall. But I think "secure by default" should be the accepted practice, so I would also suggest turning off this feature by default, and letting users turn it on if they wish. This comment kind of got away from me and I apologize for the terrible timing and the length. 😄 Your thoughts? |
Welp, that was quite a read. 😄 Basically, this feature came up as a result of managing about 10 or so systems, and those systems running 3 different versions of watchman - there were some questions about the names of the checks to use in the I figured this was something safe to enable as watchman is a read-only service, and I figured most people would've used the token auth to restrict access. However, you bring up a good point - I'll open an issue to track it / continue discussion. |
Response headers (json)
Response headers (dashboard)