Giter VIP home page Giter VIP logo

evanbaldonado / github-pages-jekyll-password-protection Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 2.0 28 KB

Automatically password protect (with encryption) certain pages on GitHub Pages/Jekyll sites using PageCrypt.

Home Page: https://evanbaldonado.github.io/github-pages-jekyll-password-protection/

License: GNU Affero General Public License v3.0

action encryption github-pages jekyll pagecrypt password password-protection webcrypto workflow web-cryptography-api

github-pages-jekyll-password-protection's Introduction

GitHub Pages/Jekyll Password Protection

Automatically password protect (with encryption) certain pages on GitHub Pages/Jekyll sites using PageCrypt.

Demo

This repository serves as an example repository for password protecting pages. See example.html (password: examplepassword) and example-2.html (password: repo_by_evanbaldonado.com!).

Usage

  1. Configure passwords for .html pages in _protected_pages.txt.
    • Add one file per line (space-delimited in the format filename.html password).
    • Note that GitHub converts markdown (.md) files to .html files.
    • Because this file begins with an underscore, it will not be published when your site is deployed.
  2. Add a GitHub action/workflow for encrypting pages: /.github/workflows/pages-with-encryption.yml.
    • Make sure that it targets the correct branch you want to use for deployment (see line 6: branches: ["main"]).
  3. Automatically deploy this repository with GitHub Pages using GitHub Actions: Settings > Code and automation > Pages > Build and deployment > Source > Github Actions. You can manually run this Action; it will also automatically run when you update your repository.

Security

  • Static websites deployed with GitHub pages can't run server-side code, which means that traditional authentication approaches to access protected files aren't possible. Additionally, GitHub pages does not support .htaccess files, another easy way to password-protect pages.
  • This method relies on PageCrypt to encrypt pages using the Web Crypto API. This allows the user to view/access/download pages but only see their contents with a password.
    • Because the user can access these files, they can download them and perform a brute-force attack to attempt to unencrypt them. Your files are only as secure as the Web Crypto API, PageCrypt, and your passwords.
    • PageCrypt only encrypts .html files. For other assets (ex: .css files, .js files, and images), consider inlining them if they must remain private. See PageCrypt's documentation.
  • Note: although the password file (_protected_pages.txt) is not published along with your site, anyone with access to the repository itself can view it.
  • For more information, see PageCrypt's documentation.

License & credits

This repository by Evan Baldonado is published under the AGPL-3.0 license. It utilizes PageCrypt by Samuel Plumppu (a complete rewrite of Maximillian Laumeister's original code).

Contributing

Feel free to submit issues/pull requests!

Contact

You can start a discussion on this repository or contact [email protected] with questions. The PageCrypt repository also has additional information about the encryption process itself.

github-pages-jekyll-password-protection's People

Contributors

evanbaldonado avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

github-pages-jekyll-password-protection's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.