Skip to content

fix: backport RSA key encoding (#148) and log-file output (#152) to release-0.17#153

Merged
JoshVanL merged 2 commits intodapr:release-0.17from
nelson-parente:backport/rsa-and-logfile
Apr 9, 2026
Merged

fix: backport RSA key encoding (#148) and log-file output (#152) to release-0.17#153
JoshVanL merged 2 commits intodapr:release-0.17from
nelson-parente:backport/rsa-and-logfile

Conversation

@nelson-parente
Copy link
Copy Markdown
Contributor

@nelson-parente nelson-parente commented Apr 9, 2026

Summary

Cherry-picks two merged PRs from main onto release-0.17 for a v0.17.1 patch release:

PR Title Merge commit
#148 fix: support RSA and fix ed25519 key encoding in EncodePrivateKey fd4e386
#152 feat: add OutputFile option for log destination in logger 18c6fce

nelson-parente and others added 2 commits April 9, 2026 16:20
…pr#148)

* fix: support RSA key encoding in EncodePrivateKey

EncodePrivateKey only handled *ecdsa.PrivateKey and ed25519.PrivateKey,
rejecting RSA keys with "unsupported key type". Since RSA keys also use
x509.MarshalPKCS8PrivateKey with the same PKCS#8 block type, add
*rsa.PrivateKey to the existing case list.

Adds table-driven tests covering RSA-2048, RSA-4096, ECDSA P-256,
Ed25519, and unsupported type with roundtrip verification through
DecodePEMPrivateKey.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>

* fix: address review feedback

- Drop RSA-4096 test case to avoid slow CI (2048 is sufficient coverage)
- Replace custom containsSubstr/searchSubstr with strings.Contains
- Remove unused helper functions

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>

---------

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
* feat: add OutputFile option for log destination in logger

Signed-off-by: MyMirelHub <15373565+MyMirelHub@users.noreply.github.com>

* feat: add file output support for logging

Signed-off-by: MyMirelHub <15373565+MyMirelHub@users.noreply.github.com>

* lint

Signed-off-by: MyMirelHub <15373565+MyMirelHub@users.noreply.github.com>

* add cleanup for file output logger in options tests

Signed-off-by: MyMirelHub <15373565+MyMirelHub@users.noreply.github.com>

* fix: address review feedback for log file output

- Relax file permissions from 0600 to 0644 to allow reads (per Albert's review)
- Track open log file handle in package-level state protected by mutex
  to prevent FD leaks when ApplyOptionsToLoggers is called multiple times
- Close previous log file before opening a new one on re-apply
- Revert output to stdout when OutputFile is empty (handles config reload)
- Extract setLogOutput helper for clarity
- Add TestApplyOptionsToLoggersFileOutputReapply test verifying
  re-apply closes the previous file and switches to the new one

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>

* fix: improve error handling and output file management in logging

Signed-off-by: MyMirelHub <15373565+MyMirelHub@users.noreply.github.com>

* fix: address Copilot review — atomic file swap and early test cleanup

- Open new log file before closing the old one so loggers are never
  left pointing at a closed FD if OpenFile fails
- Register t.Cleanup immediately after ApplyOptionsToLoggers to prevent
  FD leaks on assertion failures

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>

---------

Signed-off-by: MyMirelHub <15373565+MyMirelHub@users.noreply.github.com>
Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-authored-by: Nelson Parente <nelson_parente@live.com.pt>
@nelson-parente nelson-parente requested review from a team as code owners April 9, 2026 15:21
@JoshVanL JoshVanL merged commit 1452dea into dapr:release-0.17 Apr 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants