Issue with encryption newrelic yml license_key - text gets removed after encryption
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.1k
- Forks
- 1.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
I have been trying to use sops to encrypt the license_key parameter in a newrelic config file that looks like this:
https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-config-file-template/
At the beginning of the config a text like this exists:
common: &default_settings
license_key: some_key
# Agent Enabled
# Use this setting to disable the agent instead of removing it from the startup command.
# Default is true.
agent_enabled: false
# Set the name of your application as you'd like it show up in New Relic.
# If enable_auto_app_naming is false, the agent reports all data to this application.
# Otherwise, the agent reports only background tasks (transactions for non-web applications)
# to this application. To report data to more than one application
# (useful for rollup reporting), separate the application names with ";".
# For example, to report data to "My Application" and "My Application 2" use this:
# app_name: My Application;My Application 2
# This setting is required. Up to 3 different application names can be specified.
# The first application name must be unique.
app_name: Some Application
Command I use to encrypt this:
sops -i -e --encrypted-regex '^license_key' -k <arn> newrelic.yml
After encryption
common:
license_key: ENC[...]
# Agent Enabled
# Use this setting to disable the agent instead of removing it from the startup command.
# Default is true.
agent_enabled: false
# Set the name of your application as you'd like it show up in New Relic.
# If enable_auto_app_naming is false, the agent reports all data to this application.
# Otherwise, the agent reports only background tasks (transactions for non-web applications)
# to this application. To report data to more than one application
# (useful for rollup reporting), separate the application names with ";".
# For example, to report data to "My Application" and "My Application 2" use this:
# app_name: My Application;My Application 2
# This setting is required. Up to 3 different application names can be specified.
# The first application name must be unique.
app_name: Some Application
If you notice "&default_settings" has gone away after encryption.
Even if I explicitly add it to the file and then decrypt using
sops -d newrelic.yml > new.yml
I don't see the "&default_settings" in the output file new.yml.
Is there a way for this to not get removed at all?
The only way I can think of is to use sed or something to automatically add it after the decryption, but that's not clean enough.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with the supplied newrelic.yml, the encryption command, and the decryption command, checking how the YAML anchor is represented before and after each step. Trace the YAML parsing and serialization path; done means the &default_settings anchor survives encryption and decryption unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- yaml
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100