
Security News
Researcher Exposes Zero-Day Clickjacking Vulnerabilities in Major Password Managers
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
bridgetown_credentials
Advanced tools
This plugin adds Rails-like encrypted credentials to Bridgetown.
Credentials like passwords, access tokens and other secrets are often passed to sites each by its own ENV variable. This is both uncool, non-atomic and therefore unreliable. Use this plugin to store your credentials in encrypted YAML files which you can safely commit to your source code repository. In order to use all of them in Bridgetown, you have to set or pass exactly one ENV variable holding the key to decrypt.
Thank you for supporting free and open-source software by sponsoring on GitHub or on Donorbox. Any gesture is appreciated, from a single Euro for a ☕️ cup of coffee to 🍹 early retirement.
First add this gem to your bundle:
$ bundle add bridgetown_credentials
Then enable it in config/initializers.rb
:
init :bridgetown_credentials
For the time being, it's necessary to require this gem early in the boot process for the commands to be picked up. Add config/boot.rb
to your site reading:
Bundler.setup(:default, Bridgetown.env)
require "bridgetown_credentials"
From version 1.0.0 upwards, this gem uses Dry::Credentials instead of ActiveSupport (which is planned to be ditched from Bridgetown at some point in the future). This requires you to take some additional steps:
bin/bridgetown credentials edit -e ENVIRONMENT
rm config/credentials/*
bundle update bridgetown_credentials
bin/bridgetown credentials edit -e ENVIRONMENT
DEVELOPMENT_CREDENTIALS_KEY
replaces the old ENV variable BRIDGETOWN_DEVELOPMENT_KEY
.Please note that Dry::Credentials does not support unified environments (one config/credentials.yml.enc
for both development and production) anymore!
Also, nested credentials have to be queried differently now and thus you might have to update your Bridgetown site accordingly. Given the example credentials from the Usage section below:
# Queries on version 0.x.x
Bridgetown.credentials.foo # => "bar"
Bridgetown.credentials.aws[:access_key_id] # => "awsXid"
Bridgetown.credentials.google.dig((:maps, :api_key) # => "goomXkey"
# Queries on version 1.x.x
Bridgetown.credentials.foo # => "bar"
Bridgetown.credentials.aws.access_key_id # => "awsXid"
Bridgetown.credentials.google.maps.api_key # => "goomXkey"
Make sure you have set the EDITOR
variable to your favourite editor and then create a new credentials file:
echo $EDITOR
bin/bridgetown credentials edit
You might want to add something along the lines of:
foo: bar
aws:
access_key_id: awsXid
secret_access_key: awsXsecret
google:
maps:
api_key: goomXkey
places:
api_key: goopXkey
After saving, the private key required to encrypt/decrypt the credentials is printed this first time only. Make sure you store this information in a safe place, you will need it in the future.
The credentials you've edited above has been written to config/credentials/development.yml.enc
and will be loaded when Bridgetown is in development
mode.
To edit the credentials for production
mode:
bin/bridgetown credentials edit -e production
To edit or query credentials from now on, the corresponding ENV variable with the private key has to be set:
export DEVELOPMENT_CREDENTIALS_KEY="4c87...af93"
export PRODUCTION_CREDENTIALS_KEY="92bb...820f"
The command is the same as the first time:
bin/bridgetown credentials edit
bin/bridgetown credentials edit -e production
Throughout the Bridgetown stack, you can now use the credentials as follows:
Bridgetown.credentials.foo # => "bar"
Bridgetown.credentials.aws.access_key_id # => "awsXid"
Bridgetown.credentials.google.maps.api_key # => "goomXkey"
bundle exec rake test
to run the test suitescript/cibuild
to validate with Rubocop and Minitest togetherYou're welcome to submit issues and contribute code by forking the project and submitting pull requests.
FAQs
Unknown package
We found that bridgetown_credentials demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.