{"id":21906670,"url":"https://github.com/belthesar/sops-run","last_synced_at":"2025-10-09T12:30:59.762Z","repository":{"id":186025060,"uuid":"674488524","full_name":"belthesar/sops-run","owner":"belthesar","description":"Python wrapper for sops to execute commands with environment variables provided by a sops-encrypted file.","archived":false,"fork":false,"pushed_at":"2024-04-29T17:30:21.000Z","size":30,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-07T08:03:27.136Z","etag":null,"topics":["sops"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/belthesar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-04T04:25:32.000Z","updated_at":"2024-09-28T04:28:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"0fb1a391-c054-420a-95f6-0f5b55190bf0","html_url":"https://github.com/belthesar/sops-run","commit_stats":null,"previous_names":["belthesar/sops-run"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/belthesar/sops-run","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belthesar%2Fsops-run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belthesar%2Fsops-run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belthesar%2Fsops-run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belthesar%2Fsops-run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/belthesar","download_url":"https://codeload.github.com/belthesar/sops-run/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belthesar%2Fsops-run/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001443,"owners_count":26083078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sops"],"created_at":"2024-11-28T16:54:25.374Z","updated_at":"2025-10-09T12:30:59.465Z","avatar_url":"https://github.com/belthesar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sops-run\nA python wrapper for [sops](https://github.com/getsops/sops) to execute commands with environment variables decrypted from a sops encrypted file.\n\nVersion: 0.1.0\n\n```bash\nusage: sops-run [-h] [--create] [--edit] [--key KEY] command [command ...]\n\nRun a command with secrets decrypted from sops files.\n\npositional arguments:\n  command     Command to run\n\noptions:\n  -h, --help  show this help message and exit\n  --create    Create a new sops-run manifest\n  --edit      Edit a sops-run manifest\n  --key KEY   Path to age key to use for encryption/decryption\n```\n\n## Overview\nI frequently come across times when I want to run a command that has secrets provided via environment files. However, I didn't really like the concept of storing secrets in my user profile, loaded into my shell environment and readable by any process I run. I remembered hearing about [sops](https://github.com/getsops/sops) and did a little digging. Turns out it supports this exact use case with the argument `exec-env`, however I didn't want to remember the path to the sops file and the command to run every time I wanted to run a command. This wrapper addresses that. \n\n## Installation and setup\n### Requirements\n- python3 (tested against python 3.11)\n- [sops](https://github.com/getsops/sops)\n- [age](https://github.com/FiloSottile/age)\n\n### Installation\nTODO: Add the required structure to support installation via pipx\nFor now, you'll need to clone the repo, ideally set up a virtual environment and install the requirements. \n\n### Setup\nCurrently, sops-run assumes you're using `age` as your encryption key source, though I'd like to add support for external keys in the future. To get started, you'll need to create an age key pair. The `age` and `age-keygen` man pages are pretty great, so please look to there for the most accurate instructions on how to do this. \n\nsops-run expects to find your key file in `~/.local/age`, and will choose the first file it finds in that directory. If you have multiple keys, or if you'd like to specify a specific key, you can use the `--key` argument or set the `SOPS_AGE_KEY_FILE` environment variable. Note that the environment variable will take precedence over the argument.\n\n\n## Usage\nOnce your `age` key is all set up, the first thing you'll want to do is create a manifest, with the `--create` argument. (Example: `sops-run --create bash`). `sops-run` manifests are stored in `~/.config/sops-run`, and will create this directory if it doesn't exist when you create your first manifest. When you create a manifest, sops will open your default `$EDITOR`, and populate the file with an example yaml file. For more information on how this process works, see the `sops` documentation. Once you save your file and close your editor, sops will encrypt the file and save it in the manifest directory.\n\nOnce a manifest is created for a command, you can run it with `sops-run \u003ccommand\u003e`. (Example: `sops-run bash script.sh`) `sops-run` will look for a manifest with the same name as the first argument you provide. For example, if you run `sops-run bash script.py`, `sops-run` will load the manifest for `bash`. Currently, there is no way to override the manifest provided, but if you'd like to see this feature, please open an issue.\n\nIf you need to edit a manifest, you can use the `--edit` argument. (Example: `sops-run --edit bash`). This will open the manifest in your default `$EDITOR` and allow you to make changes. Once you save and close your editor, sops will re-encrypt the file and save it in the manifest directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelthesar%2Fsops-run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbelthesar%2Fsops-run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelthesar%2Fsops-run/lists"}