GithubHelp home page GithubHelp logo

dbx12 / envmanager Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 169 KB

A tool to manage your shell environment using secure storage for your secrets.

License: GNU General Public License v3.0

Makefile 1.15% Go 97.49% Shell 1.36%

envmanager's People

Contributors

dbx12 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

particleflux

envmanager's Issues

Expired keys lead to unexpected output

Only affects password storage pass

Steps to reproduce:

  • have a profile using pass as storage backend
  • gpg key used to encrypt secrets is expired (or at least the subkey with usage E is)
  • attempt to load the profile
  • see the following output
Command 'gpg:' not found, did you mean: command 'gpgv' from deb gpgv (2.2.19-3ubuntu2.2)
 command 'gpg2' from deb gnupg2 (2.2.19-3ubuntu2.2)
 command 'gpg1' from deb gnupg1 (1.4.23-1)
 command 'gpg' from deb gpg (2.2.19-3ubuntu2.2)Try: sudo apt install <deb name>

What happened?

Apparently the library github.com/gopasspw/gopass uses the gpg binary internally. And this binary outputs a note (gpg: Note: secret key <fingerprint> expired at Wed 31 Aug 2022 09:43:32 AM CEST) if an expired key is used for decryption. That output on stderr is not caught by the library and emitted on the stderr of envManager along with the export statements. The wrapper takes this output on stderr and evals it to execute the export statements.

Conlusions

  • Communication over stderr is not as optimal as initially thought since libraries can pollute stderr output
  • Running eval on the output of the envManager binary can pose a security risk. Potential scenario is a targeted supply chain attack on this project by a library which outputs malicious code on stderr with the intent of having envManager eval-ing it.

Directory mapping allows conflicting environment variables

Actual behavior
If two profiles define the same environment variable and both profiles are loaded, the last profile wins and overwrites the earlier loaded environment variables.

Expected behavior
An error message / warning is shown when one profile overwrites a variable set by another profile during the same load command.

Additional notes

  • The check should only be performed during one load operation (e.g. envManager load profA profB)
  • It is particularly easy to "achieve" this with directory mappings since they are another redirection
  • This condition can probably also be reached via dependencies

How to to reproduce
Config:

storage:
  pass:
    type: pass
profiles:
  profA:
    storage: pass
    path: credA
    constEnv:
      CONST_ENV: i-am-from-profile-A
  profB:
    storage: pass
    path: credB
    constEnv:
      CONST_ENV: i-am-from-profile-B
directoryMapping:
  /tmp:
    - profA
    - profB
  • Run envManager load profA profB and you see CONST_ENV=i-am-from-profile-B. Swap the profile names and you see the value of profile A
  • Run envManager load while in /tmp and see again the value from profile B

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.