{"id":22369709,"url":"https://github.com/flywirecorp/secrets_parser","last_synced_at":"2026-07-06T03:30:57.801Z","repository":{"id":56894683,"uuid":"139589665","full_name":"flywirecorp/secrets_parser","owner":"flywirecorp","description":"This gem parses the secrets reading a field in a JSON file, download the encrypted secrets file from S3 and change the values for the encrypted ones","archived":false,"fork":false,"pushed_at":"2023-06-16T10:11:39.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2026-05-16T06:04:27.733Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flywirecorp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-07-03T13:44:29.000Z","updated_at":"2023-06-16T10:11:38.000Z","dependencies_parsed_at":"2023-07-15T15:26:57.773Z","dependency_job_id":null,"html_url":"https://github.com/flywirecorp/secrets_parser","commit_stats":null,"previous_names":["peertransfer/secrets_parser"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/flywirecorp/secrets_parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flywirecorp%2Fsecrets_parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flywirecorp%2Fsecrets_parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flywirecorp%2Fsecrets_parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flywirecorp%2Fsecrets_parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flywirecorp","download_url":"https://codeload.github.com/flywirecorp/secrets_parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flywirecorp%2Fsecrets_parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35177220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-06T02:00:07.184Z","response_time":106,"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":[],"created_at":"2024-12-04T19:27:41.358Z","updated_at":"2026-07-06T03:30:57.773Z","avatar_url":"https://github.com/flywirecorp.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Secrets Parser\n\n![test](https://github.com/flywirecorp/secrets_parser/actions/workflows/test.yml/badge.svg)\n\nThis gem parse the secrets reading a field in a JSON file, download the encrypted secrets file from S3 and change the values for the encrypted ones.\n\n## Usage\n\nFor using correctly this gem, we will need 4 basic things: a JSON file to parse, an S3 bucket and a JSON file encrypted with a AWS KMS key that will store the secret values.\n\n#### JSON File to parse\n\nThis file is where there are going to be the references to the secrets in S3. Example:\n\n```\n{\n    \"variables\": {\n      \"MY_SECRET\": \"secret:bucket_name/path:my_secret\",\n      \"OTHER_SECRET\": \"secret:bucket_name/path:other_secret\"\n    }\n}\n```\n\nThe example has 2 secrets in it, these references have 3 parts:\n\n* `secret:` : This is needed to let the gem idetify that the value is a reference to a secret.\n* `bucket_name/path` : Path where is located the secret file, bucket_name + path, the extension of the file is inside the gem and it's `json.encrypted`, so in this case, there is a file in this bucket named *secret-testing.json.encrypted*.\n* `:my_secret` and `:other_secret` : That's the key that's inside the encrypted file.\n\n*This allow us to let the secret managers decide where to put those secrets*\n\n#### KMS Key\n\nAWS KMS key used to encrypt the secrets and the S3 bucket where secrets are going to be stored.\n\n#### S3 Bucket\n\nJust a AWS S3 Bucket, it's recommended to have it encrypted at rest too with the same KMS key.\n\n#### Encrypted JSON file\n\nHere is where secrets are going to be stored, a simple JSON with all the keys and secrets. Example:\n\n```\n{\n  \"my_secret\": \"This is a secret weeee\",\n  \"other_secret\": \"PINCODE: 12345\"\n}\n```\n\nAfter configuring it, encrypt it with:\n```\naws kms encrypt --key-id $YOUR_KMS_KEY_ID --plaintext fileb://YOUR_FILE.json --output text --query CiphertextBlob | base64 --decode \u003e YOUR_FILE.json.encrypted\n```\n\nAfter that, upload it to your S3 and copy the reference in your JSON.\n\n### Usage example\n\nFirst, set the AWS credentials needed for accesing the S3 bucket and decrypting files.\n\n**Ruby example code:**\n\n```\n#!/usr/bin/env ruby\n\nrequire 'bundler/setup'\nrequire 'secrets_parser'\nrequire 'aws-sdk-s3'\n\nfile_json = './app.json' #Path to your json file to be parsed, now using the described in the example\nfield_to_parse = 'variables' # Field to parse\n\nparser = Secrets::Parser.new\nparser.set_config do |config|\n  config[:s3_client] = Aws::S3::Client.new(region: ENV['AWS_DEFAULT_REGION'])\n  config[:kms_client] = Aws::KMS::Client.new(region: ENV['AWS_DEFAULT_REGION'])\nend\n\nparsed_file = parser.parse(file_json, field_to_parse)\n\nputs JSON.pretty_generate(parsed_file)\n\n```\n\n**Output:**\n\n```\n{\n  \"variables\": {\n    \"my_secret\": \"This is a secret weeee\",\n    \"other_secret\": \"PINCODE: 12345\"\n  }\n}\n```\n\n### Logging\n\nTo enable logging feature just configure `:logger` key injecting a logger that implements [Logger interface](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html).\n\nSample using ruby's Logger stdlib:\n\n```\nrequire 'secrets_parser'\nrequire 'logger'\n\nparser = Secrets::Parser.new\nparser.set_config do |config|\n  config[:logger] = Logger.new(STDOUT)\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflywirecorp%2Fsecrets_parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflywirecorp%2Fsecrets_parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflywirecorp%2Fsecrets_parser/lists"}