Repository navigation
fix(authentication): service account becomes invalid on macos when the service account key is too big for keychain - #1758
Conversation
…n mac when the Service Account Key is too big for keychain
e71e239 to
e061960
Compare
| } | ||
|
|
||
| textFilePath := filepath.Join(config.GetProfileFolderPath(profile), textFileName) | ||
| _ = os.Remove(textFilePath) |
There was a problem hiding this comment.
this looks like it removes my real cli-auth-storage.txt
There was a problem hiding this comment.
I added a SetDefaultConfigFolderPath function which allows overwriting the path for the profiles. Each tests runs now in a test dir for the profiles and don't has conflicts anymore with existing configs or modifies there anything
There was a problem hiding this comment.
$ ls ~/Library/Application\ Support/stackit
cli-api-auth-storage.txt cli-config.json profiles/
cli-auth-storage.txt cli-profile.txt
$ make test
$ ls ~/Library/Application\ Support/stackit
cli-api-auth-storage.txt cli-config.json profiles/
I'm not sure where, but there are still deletes in my real files
| _ = deleteAuthFieldInKeyring(profile, key) | ||
| } else { | ||
| // If writing to the keyring succeeded, clean up any old entry from the encoded text file. | ||
| _ = deleteAuthFieldInEncodedTextFile(profile, key) |
There was a problem hiding this comment.
why isn't error handling necessary here?
There was a problem hiding this comment.
It just tries to remove stale keys. If the deletion for the keyring fails, it means that there was no key before. For the deletion in the encoded text files it can have multiple issues, mostly permission issues or a broken file. If we would have a logger here, we could do log the here, but I wouldn't return an error when something in deleteAuthFieldInEncodedTextFile failed while the actual setting of auth fields in the keyring was successful
There was a problem hiding this comment.
checked the library: it'll return keyring.ErrNotFound when not found. I'd add a conditional and report the other errors to the user.
Merging this branch changes the coverage (1 decrease, 1 increase)
Coverage detailsCompared to commit 03f7993 (run #44488115488)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files:
|
Description
relates to STACKITCLI-252 and #1716
Checklist
make fmtmake generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)