简体   繁体   English

使用源控件时处理敏感数据的最佳方法是什么?

[英]What's the best way to deal with sensitve data while using a source control?

Recently I started using codeplex.com for hosting a project I'm doing which I want to share with people. 最近,我开始使用codeplex.com托管一个我正在与他人共享的项目。 I'm new to using Source Control and Open Source treatment. 我是使用Source Control和Open Source处理的新手。

My application deals with Twitter, and of course I have to use Twitter API keys. 我的应用程序处理Twitter,当然我必须使用Twitter API密钥。

I'm using Visual Studio 2010 and TortoiseHg for the source control. 我将Visual Studio 2010和TortoiseHg用于源代码管理。

So my question is: How can I push the code without sharing the sensitive data such as the API Key? 所以我的问题是:如何在不共享敏感数据(例如API密钥)的情况下推送代码? I'm supposed not to share these key, right? 我应该不分享这些密钥,对吗? Twitter API keys, TwitPic API Key, Plixi API key... Twitter API密钥,TwitPic API密钥,Plixi API密钥...

Do I have to clean the sensitive data every time before pushing my code? 每次推送代码之前,我是否都必须清除敏感数据?

Also, could you please tell me where can I learn best practices for using source control? 另外,您能告诉我在哪里可以学习使用源代码管理的最佳实践?

You should externalize all sensitive information into a dedicated property file. 您应该将所有敏感信息外部化为专用属性文件。 This file should be excluded from source control. 此文件应从源代码管理中排除。 Most (if not all) source control systems will allow you to mark a file as not to be versionned. 大多数(如果不是全部)源代码管理系统将允许您将文件标记为不进行版本控制。 I dont know specifically about Hg, but .hgignore seems to be the place. 我不特别了解Hg,但是.hgignore似乎是那里。

All source control systems are particularly annoying when it comes to removing informations from the repository. 当涉及从存储库中删除信息时,所有源代码控制系统都特别令人讨厌。 We could almost think that they were created to record the full history of a project ;-) So be ready to change your API key once it gets commited by mistake (not that I have ever done something like this). 我们几乎可以认为它们是创建来记录项目的完整历史的;-)因此,一旦错误提交了API密钥,请准备好更改它(不是我做过这样的事情)。

Edit as it seems I wasnt clear enough : 编辑 ,因为我似乎还不够清楚:

The most important part is to clearly separate the sensitive information from the standard informations. 最重要的部分是将敏感信息与标准信息明确分开。 You should have one file that contains sensitive and only sensitive information. 您应该有一个仅包含敏感信息的文件。 Then tag this file as "not versioned". 然后将此文件标记为“未版本控制”。 If you dont, you will invariably end up commiting your sensitive informations. 如果您不这样做,您肯定会最终提交您的敏感信息。 And once they are out, there is almost no way to make them disapear. 一旦它们消失了,几乎没有办法让它们消失。

One other way is to encrypt sensitive data, commit the encrypted data and have the decryption key only present on the server (or on some other carefully controlled location, far from your version control system). 另一种方法是加密敏感数据,提交加密数据并使解密密钥仅出现在服务器上(或其他一些经过仔细控制的位置,远离版本控制系统)。 We actually use this solution in the private bank where I work, so that the developers dont have access to the passwords of the production systems. 我们实际上是在我工作的私人银行中使用此解决方案的,因此开发人员无法访问生产系统的密码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在调试时可视化DataTable的最佳方法是什么? - What is the best way to visualize a DataTable while debugging? 在Visual Studio中使用C ++创建Windows窗体应用程序时的最佳线程化方法是什么? - What is the best way of threading while using c++ to create windows form application in visual studio? 返回指向向量数据的指针的最佳方法是什么? 常量还是非常量? - what is the best way to return a pointer to vector's data? const or non-const? 检查服务器收到的第一条消息的最佳方法是什么? - What's the best way to check the first message that's received by the server? 反复引用代码的最佳方式是什么? - What's the best way to reference code over and over? 根据解决方案的位置加载MEF扩展的最佳方法是什么? - What's the best way to load MEF extensions based on solution's location? 在VS2010 Web应用程序的生成服务器上升级msbuild组件的最佳方法是什么? - What's the best way to upgrade the msbuild components on a build server for a VS2010 web application? 从VS 2010中创建的表中获取表创建脚本的最佳方法是什么? - What's the best way to get table creation scripts from a table created in VS 2010? 多人团队使用 NuGet 和源代码控制 - Multiperson team using NuGet and source control 在Visual Studio中的单个解决方案中管理多个网站的最佳方法是什么 - What's the best way to manage multiple websites within a single solution in Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM