简体   繁体   English

Git和混淆代码

[英]Git and Obfuscated Code

I've been working on an idea, and needed to run it past someone to see if I'd gone off the deep end. 我一直在研究一个想法,需要让它超越某人,以了解我是否走出了深渊。

I'm working on a decently complex PHP project, I am the only developer. 我正在开发一个相当复杂的PHP项目,我是唯一的开发人员。 We're looking to hire some one else to help with the programming effort, but don't want them to see everything on day one. 我们希望聘请其他人来帮助进行编程工作,但不希望他们在第一天就看到一切。 There is a pretty clear line between what would be "core architecture" and "non-core". 在“核心体系结构”和“非核心”之间有一个清晰的界线。 I'd like the new person to have be able to read and modify the "non-core" section. 我希望新人能够阅读和修改“非核心”部分。 The core section is required for the non-core to work. 非核心工作需要核心部分。

My plan id this: 我的计划是这样的:

  1. Make the Core and Non-Core sections separate git repositories 使核心和非核心部分分开的git存储库
  2. Make the Core section a submodule of the Non-Core 将“核心”部分设为“非核心”的子模块
  3. Add a post-commit hook to the Core repository, to run code obfuscation 将提交后的钩子添加到Core存储库,以运行代码混淆

Then when the submodule is updated, the files will execute, but will be very hard to read. 然后,当子模块更新时,文件将执行,但是很难读取。

#1 and #2 are pretty easy. #1和#2很容易。 But #3... I don't know if it can even be done. 但是#3 ...我什至不知道它是否可以完成。 I was looking into the git internals, to see how the files are actually stored, but it seems like they are just stored in the file system. 我正在研究git内部,以查看文件的实际存储方式,但似乎它们只是存储在文件系统中。 So there wouldn't be any way to edit them and add obfuscation without totally trashing the "good" copy. 因此,在不完全破坏“好”副本的情况下,将无法进行任何编辑和添加混淆处理。 That being said, I could always daisy chain another repo on there. 话虽这么说,我总是可以在那儿以菊花链方式链接另一个回购协议。

Good Repo -> Core Repo (with Obfuscation) -> Non-Core 好回购->核心回购(含混淆)->非核心

I'm just wondering if there's a cleaner way to do this. 我只是想知道是否有更干净的方法可以做到这一点。


Just another thought, but I could not use a repository for the obfuscated code. 只是另一个想法,但是我无法使用存储库来处理混淆的代码。 Instead have the git commit hook call a script to copy and obfuscate the Core code and place it in the non-core repo. 取而代之的是让git commit hook调用脚本来复制和模糊化Core代码并将其放置在非核心仓库中。 Add a .getignore so that folder isn't part of the non-core codebase. 添加一个.getignore,以便该文件夹不属于非核心代码库。

Expose your core functionality as web services and access them over HTTP. 将您的核心功能公开为Web服务,并通过HTTP访问它们。 Keep the non-core bits in the repository. 将非核心部分保留在存储库中。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM