Repository navigation
Newline trim fix - #4
Conversation
Roasbeef
left a comment
There was a problem hiding this comment.
Easy fix, only comment is to extract the routine to add a basic test case to make sure we don't regress to what incident that happened on prod after deployment.
| } | ||
| } | ||
|
|
||
| fmt.Printf("%s\n", passwordString) |
There was a problem hiding this comment.
This is just a defense in depth fix, and the seeds actually weren't affected by this issue right? Or I guess maybe eventually a deployed seed would, as it's a random event that the characters line up
There was a problem hiding this comment.
Just to be a bit more consistent. A tool that is sensitive to newline characters in certain things should also be careful about not writing them by default. Also, we have comments like "lndinit doesn't add newlines itself" in some places. So I think this is just best practice.
| // Remove any newlines at the end of the file. We won't ever write a | ||
| // newline ourselves but maybe the file was provisioned by another | ||
| // process or user. | ||
| content := stripNewline(string(secret.Data[opts.SecretKeyName])) |
There was a problem hiding this comment.
One way we can programmatically confirm/harden the fix would be to extra this routine into a simple function and add a test (based on a similar instance as we saw in prod) to make sure future changes here don't regress.
There was a problem hiding this comment.
I did some refactoring and added unit tests. Hope that's what you had in mind.
fd593ee to
a6debff
Compare
To avoid a newline being added to any password or seed secret created with lndinit, we shouldn't print one to the console.
a6debff to
f9426c4
Compare
f9426c4 to
fd7a6d3
Compare
This PR fixes an issue where trailing newline characters (0x0d and 0x0a) were trimmed from macaroon files.