博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Serving websites from svn checkout considered harmful
阅读量:6262 次
发布时间:2019-06-22

本文共 2408 字,大约阅读时间需要 8 分钟。

Serving from a working copy

A simple way to update sites is to serve them from Subversion working copies. Checkout the code on the server, develop and commit changes, then svn update the server when you’re ready to release.

Security concerns

There’s a potential security problem with this. Subversion keeps track of meta-data and original versions of files by storing them in .svn directories in the working copy. If your web server allows requests that include these .svn directories, anything within them could be served to whoever requests it.

Requests would look like:

http://example.com/stuff/.svn/entries

http://example.com/stuff/.svn/text-base/page.php.svn-base
http://example.com/stuff/.svn/text-base/settings.py.svn-base

The first one would reveal some meta-data about your project, such as file paths, repository urls and usernames.

The second one may be interpreted as a PHP script, in which case there’s little risk. Or it may return the PHP source file, which is a much bigger risk.

The third one (assumed to be a Django project) should never happen. The request can only be for files within the web server’s document root. Code itself doesn’t need to be there, only media files do.

Alternatives

Instead of serving sites from a working copy, you can use svn export to get a “clean” copy of the site which does not include .svn directories. If you svn export from the repository, you must export the complete site, rather than just update the changed files, which could be a lot more data.

However, you can svn export from a working copy on the server. It’s still a complete export, but you don’t have to trouble the repository, so it’s typically much quicker.

An alternative is to update a working copy which is stored on the server, but not in the web document root, then use rsync or some file copying to update the “clean” copy in the web document root. In this case, only changed files are affected.

Protection through web server config

If you do serve from working copies, you should configure the web server to block all requests which include .svn in the url. Here’s how to do it for some popular web servers:

Apache

Order allow,deny Deny from all

Lighttpd

$HTTP["url"] =~ ".*\.svn.*" {  url.access-deny = ("")}

Nginx

Using the location directive which must appear in the context of server.

 

本文转hackfreer51CTO博客,原文链接:http://blog.51cto.com/pnig0s1992/767864,如需转载请自行联系原作者

你可能感兴趣的文章
总结一下,MariaDB 10(MySQL5.6企业版分支)的主要新特性
查看>>
MS UC 2013-0-虚拟机-标准化-部署-2-模板机-制作-3-安装-Tool
查看>>
IDS与IPS的区别
查看>>
初试Windows 8 RTM
查看>>
Linux 下rpm包搭建LAMP环境
查看>>
Windows Server 2016-Nano Server介绍
查看>>
未来架构师的平台战略范例(4)_大数据
查看>>
Grizzly学习笔记(二)
查看>>
思科路由器动态VTI IPSec***配置
查看>>
***S启动时遇到1053错误
查看>>
CentOS7.5 使用 kubeadm 安装配置 Kubernetes1.12(四)
查看>>
shell脚本实现对系统的自动分区
查看>>
Tokyo Tyrant基本规范(5)--教程
查看>>
理解图形化执行计划 -- 第3部分:分析执行计划
查看>>
90后美女的全能测试蜕变之路
查看>>
audit.rules
查看>>
Windows 10企业批量部署实战之WDS配置
查看>>
百元百鸡问题
查看>>
Microsoft System Center 2012部署(二)
查看>>
谈谈网站安全性的问题
查看>>