Skip to main content

Add routes to your vercel.json that enforces password authentication

Project description

vercel-pw-protection

This plugin overwrites your vercel.json's routes attribute so that your deployment is password protected.

Login on demo: https://mkdocs-vercel-pw-plugin.vercel.app/#Täßt😀Emoji

This plugin is an implementation of the cookie method from https://github.com/six-two/mkdocs-vercel-basic-auth-example.

Prerequesites: You have created a vercel.json file and it does not have any existing routes.

Usage

Install the package via pip:

pip install mkdocs-vercel-pw-plugin

Then add the plugin to your mkdocs.yml:

plugins:
- vercel_pw:
    cookie_name: JSESSIONID
    password: Monkey123!
    restrict_to_domain: mkdocs-pw-protection.vercel.app
    vercel_json_path: ../vercel.json

Optional: You can link to /logout.html.

You need to run a successful build (mkdocs build or mkdocs serve) after changing the config before pushing your changes to Vercel. This is because the vercel.json is only updated after a build is performed.

Customization

By default the "login" page mimics the Vercel deployment not found page. This serves as a small security by obscurity measure. Of course you can also provide your own docs/deployment_not_found.html that instead shows a login form or something like that.

Notable changes

Version 0.1.0

  • Use hex encoding instead of base64. The issue is that vercel's header matching is case insensitive, which makes password brute forcing much easier. For example if the password was aa (YWE=), the password c (YwE=) would also be accepted. The new encoding should also accept Unicode characters like Umlauts, emojis, etc. But I would recommend sticking to ASCII, since Unicode is tricky and I am not sure if JavaScript and Python handle encoding exactly the same.

Version 0.0.2

  • Hide the Plugin 'vercel_pw' was specified multiple times warning

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_vercel_pw_plugin-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_vercel_pw_plugin-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_vercel_pw_plugin-0.1.0.tar.gz.

File metadata

  • Download URL: mkdocs_vercel_pw_plugin-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for mkdocs_vercel_pw_plugin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 416a84da8dac511524275c9bfcfd4cc3f194e6d9d966aa816931213d62fe5f17
MD5 79bf249dfef986d7956e216008ae4592
BLAKE2b-256 2f2a55c204b01d884b2f5cafc447bbc87f7c884e3bb3470321ebcde74c91b0c1

See more details on using hashes here.

File details

Details for the file mkdocs_vercel_pw_plugin-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_vercel_pw_plugin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3464ec1ea094dee7f67b37fb9a7b1c4f12aa544fb6d5e2f2178a96dd3cb21613
MD5 6ff20d10490ed51f636e54d117b7dc02
BLAKE2b-256 86bb9be235726fa227d699ffb2a4660d13409d4e65144a30a66fcd6d711289d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page