Almost every program that we run has access to the environment, so nothing stops them from curling our credentials to some nefarious server.

Why don’t we put credentials in files and then pass them to the programs that need them? Maybe coupled with some mechanism that prevents executables from reading any random file except those approved.

  • markstos@lemmy.world
    link
    fedilink
    English
    arrow-up
    8
    ·
    1 year ago

    The classic Unix user and permission system provides a solution for this.

    Create a user for the app you are worried about. Make the environment variables available to that user only.

    Other apps can’t read the secrets, and if the app itself gets exploited, it has access to the secrets in any case.