将sphinx文档设为私有

时间:2017-09-11 11:14:43

标签: javascript git docker encryption python-sphinx

所以这是一个反复出现的问题,我没有资格解决它,但我需要修复它,所以我将不得不学习。有关过时/不可行的解决方案,请参阅this questionfor a similar question without answer.

基本问题,我需要提供私有python模块的文档。该项目托管在gitlab上,我使用CI生成文档。它们对世界是可见的,这并不理想。这是known issue,gitlab最终可能提供解决方案。我不能等那么久。我的计划是使用这个项目(crypto-js)代码并将其包含在docker runner中。不幸的是,我不知道如何去做,或者甚至可能。

我的ci.yml是:

image: tsgkadot/sphinx-plantuml

stages:
  - build
pages:
  stage: build
  script:
    #- pip install -r requirements.txt -U
    - sphinx-build -b html ./doc public
  artifacts:
    paths:
      - public
  tags:
    - docker

据我所知,crypto-js是这样接口的:

var unencrypted = document.getElementById('unencrypted_html').value;
var passphrase = document.getElementById('passphrase').value;
var encrypted = CryptoJS.AES.encrypt(unencrypted, passphrase);
var hmac = CryptoJS.HmacSHA256(encrypted.toString(), CryptoJS.SHA256(passphrase)).toString();
var encryptedMsg = hmac + encrypted;

从sphinx生成的html文件必须传递给js,输出替换文件。或者,我在SO上读到可以在sphinx中包含js,但是我没有看到文件如何加密自身。我不介意使用一个密码来加密所有文档,然后与相关方共享密码。

我还在gitlab的相关问题上发布了这些想法,但由于他们正在寻找更完整的解决方案,因此似乎没有什么进展。

如果有像gitlab这样的git托管服务提供类似私有存储库的页面,我也很乐意切换到那个。关于如何实现这个的任何想法或指示?

3 个答案:

答案 0 :(得分:2)

所以我做了一个现在有效的基本修复:

这个gitlab repo显示了一个工作示例here

它使用static password protection,并在此issue中进行了讨论。

答案 1 :(得分:1)

GitLab现在支持页面的访问控制:

https://docs.gitlab.com/ce/administration/pages/#access-control

  

当前默认情况下禁用页面访问控制。要启用它,您必须:

     
      
  1. 在/etc/gitlab/gitlab.rb

    中启用它      

    gitlab_pages['access_control'] = true

  2.   
  3. Reconfigure GitLab

  4.   

答案 2 :(得分:1)

现在,GitLab页面具有与项目中相同的权限。如果项目是私有的,则页面也将是私有的。

我已经尝试过本教程:https://gitlab.com/pages/sphinx/tree/master