Giter VIP home page Giter VIP logo

keystone's Introduction

Keystone

Coverage Status

Secrets synced and safe.

Sync your environment variables across team members, environments and codebase versions without leaving your terminal.

Installation

Linux

Use snap to install this package.

snap install keystone-cli

By default, you can call keystone command with keystone-cli.ks. You might want to create an alias using snap aliases.

snap alias keystone-cli.ks ks

macOS (via homebrew)

Install the Keystone tap

brew tap wearedevx/keystone

Install the latest stable version

brew install wearedevx/keystone/keystone

You can also install the development version with

brew install wearedevx/keystone/keystone-develop

And to update the development version

brew reinstall wearedevx/keystone/keystone-develop

Usage

To start using Keystone you will need to login with ks login, using your GitHub or GitLab account. If your project is not keystone-managed yet, bootstrap it with ks init <YOUR_PROJECT_NAME>.

To start managing secrets and files, and access all of Keystone’s features, refer to the complete CLI documentation

keystone's People

Contributors

dependabot[bot] avatar devx-opensource avatar gaelph avatar godjirax avatar kvnloo avatar labigael avatar millette avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

keystone's Issues

Refactor the CI command(s)

  • move the ci service to cli/internal
  • create ci command (ks ci [command])
  • rename push-ci to ci send (ks ci send)
  • move the setup (service selection, keys prompts, etc) to ks ci setup
  • service provider specifics (key prompts, etc) should be handled by the service implementation for that provider (eg github)
  • ks ci reset, ks ci clean
  • assess : should ks ci send send all (prod and staging) environments or only the active one (or the one specified by --env ?
  • split message in slot

ks init - Create configuration files for a keystone project

  • keystone.yaml - YAML configuration file. See structure below
  • .keystone - Keystone folder holding the cache (files + .env) and a file pointing to the current environment. See structure below.
  • if not already present, add the folder .keystone to .gitignore

keystone.yaml

---
projectId: djkfhkqjhgjhdgsjhgdsf
env:
- key: ALGOLIA_TOKEN
  strict: true
- SENTRY
files:
- config/credentials.json
- config/cert.ca
options:
  strict: true

.keystone/

.keystone/
  |- environment // holds the current environment name
  |-  cache/ 
       |- .env // cache for all the environment variables
       |- [...other files] are secrets files to cache

All commands description

Get remote modifications:

$ ks fetch

sync .keystone folder

  • send current env hash
    • 204 No content (no message, and user sens last hash 🐱 )
    • 200 Env hash / last message for me
      • if 200 and no message, ask someone to forge hash message for me.

Load keystone env, before start your program:

$ eval(ks source)
  • create digest output by current system (load env vars, show warings)
  • if missing files :
    • write file
  • if existing files, but same:
    • do nothing
  • if existing files, and different:
    • show warnings

Add a new file

$ ks file add config/myfile
  • execute ks fetch
  • retrieve all public keys from current project env
  • for each one, prepare message

Multiple ci : ks ci, ks ci add, ks ci rm. ks ci setup no more !

To handle multiple repositories situations, it is necessary that multiple ci services be setup.
Therefore, ks ci setup is a goner, replaced by:

  • ks ci add: to add a service
  • ks ci rm: to remove a service
  • ks ci: to list currently configured services

On top of that, ks ci send should send the current environment to all configured services. Maybe a switch could allow to send to only one service (or a defined list of services), but is there a case for it ?

Push secrets to third parties (CI integration)

Push secrets from the command line. This avoid keystone to store the secrets for a long time on its server.

  • Integration with Github
  • Integration with Gitlab

Push one secret as a message, if message is too large split it

Can't create .env file

Secrets are stored in .keystone/<env>/.env file.
And files are store in .keystone/<env>/<file-path>.

Conflict if file-path is .env

Allow multiple keys for mulitiple devices per user

Currenty key pairs are bound to the third-party account used to login. It unfortunately bounds an account to only one device.

To allow a user to use Keystone smoothly on multiple devices, a user could have more one key pair, and not have it bound to a third party service.

  • in DB, rework the relation, so that User has many PublicKey (or use an embedded array ?);
  • upon login, if, there is no key pair in config, generate one and add the public key the that relation;
  • when sending messages, send for all the public keys; when fetching, fetch for the public key in the .config; Rework the DB relation to all this (maybe);
  • Store device name in .config and add it to relation in db;
  • in cli, a set of new commands (those are suggestions) : ks keys, to list keys; ks keys revoke [key index], to revoke a key;
  • Store in auth_token an uuid for the device, if revoked, the device can't interact with the project;
  • Can choose device name;
  • Send mail when new device registered to user and admins.

Have a loader

Due to the production context (Google Cloud Run) requests can take several seconds (2 to 3) because the server has to be "cold started".

It would be interesting to have some kind of a loader displayed if a requests takes more than a second to complete.
The loader should not be used in ks source, tho

ks file is crashing bad

with this output

$ ks file
Failed to render template files list (template: files list:3:29: executing "files list" at <8>
: wrong type for value; expected string; got keystonefile.FileKey)

Ability to destroy a project

There is currently no way to "destroy" a project. Should not there be a ks destroy ? Or ks delete-project (so that’s harder to type and we are sure the user actually meant it when they type that) ?

ks fetch

Get remote modifications:

$ ks fetch

sync .keystone folder

  • send current env hash
    • 204 No content (no message, and user sens last hash 🐱 )
    • 200 Env hash / last message for me
      • if 200 and no message, ask someone to forge hash message for me.

Prompt ui ctrl+c

We set values for each environment for secret.
But if we want to stop process (with ctrl+c), cli doesn't kill process. Same as "enter" press.

Invitation

Requirements

  • Invitee needs a keystone account (in order to have pub keys to use)

Flow:

  • Invitee provide a token/code to the project owner
  • the project owner uses the code to add him to the project
  • the project owner can send an email with the instructions to create an account and generate a code

`ks status` On environment undefined

When no environment has been checkout, the command ks status reports undefined. It should state that the user need to checkout an environment.

See screenshot below:

image

User management

  • Endpoint to retrieve the project users and their pub keys to send secure messages
  • Backup command to export and import Keystone user conf on another computer

CLI: maybe cache known members public keys locally ?

There is going to be a need for a request for fetching a user public key. Since this operation will have to be done on every message fetch, shouldn’t we cache those public keys ?

Then lands the question of cache invalidation of course…

Define Role Seed

What should a developer, a devops or an admin/owner should be allowed to do on the dev, ci, stagingand prod environments.

Explain how to install the CLI on windows

The NPM install doesn't work but the binary installer does.

We should ask windows users to download the binary, launch the installer and set their path to the program located in Program Files

setx /M PATH "%PATH%;C:\Something\bin"

To handle updates, we could detect the user system and ask them to download the latest binary if any instead of asking them to run the npm -g i @keystone/clicommand.

ks rm / ks purge

rm should not remove secret from the cache, just in keystone.yml
purge should remove secret from cache

JWT Token expiration handling

JWT Token expiration is currently not handled at all, leading to confusing errors such as 'Project doesn't exist', even though it is known to exist.

Changing the content of a file for a single environment.

There is currently no way to set the content of a file for a single environment. The current only solution would be to ks file add it but the content of the file will be asked for all the environment, as the --env flag as no effect on ks file add.

One option would be to mimic ks secret set with a ks file set that would set the content for the current environment, automatically enabling the --env switch.

An other is to make file add sensible to --env switch, requiring some rework of how this flag is currently handled : it would affect all commands where the --env works.

A third and rather wild one, would be to have a deamon monitoring keystoned files and send messages to members when cache content is modified. But I’m afraid that would require a lotta work.

Adding a secret that exists but is unused show ERROR

What I did

I listed secrets with ks secret and saw that there already was a MANDRILL_API_KEY but was unused (not in the keystone.yml.

I wanted to use it, so I went for ks secret add MANDRILL_API_KEY, but was welcome by a first error stating ks secret add requires two positional arguments.
So I went for ks secret add MANDRILL_API_KEY "", but then, this happened :

keystone develop [$]
❯ ks secret add MANDRILL_API_KEY ""
{MANDRILL_API_KEY false map[dev:*** prod:** staging:***] false}
The secret already exist. Values are:
dev: ***
prod: ***
staging: ***
✗ Do you want to override the values:

 ERROR

I was asked whether I wanted to overwrite the existing values and said no.

What I expected

I expected several things to go differently :

  • ks secret add to accept one argument and use prompts for the secret value, or simply ask me to use the existing values, and add the secret to the keystone.yml
  • ks secret add <secret name> <secret value> to add the secret to the keystone.yml and say SUCCESS when I say "no" to "Do you want to overwrite the exiting values?"

New Roles and User Project and Environments relations

  1. new table roles: name(string), description(string)
  2. new table environment_types: name(string)
  3. new relation between roles and environment_types: rights: enum(admin, read, write, none)
  4. new link from environments to environment_types
  5. define seed (which roles can do what on which environments)
  6. project_members links projects, users and roles
  7. environments references projects (belongs to)
  8. environments have a versionID

API
new route /roles

CLI
new command : ks role -> list roles
maybe later has CRUD ops

ks member add -> help lists roles
for each members prompts the role
ks member add --role developer

ks member set-role developer

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.