Skip to content

test(alias): cover non-UTF8 RC_HOST credential decoding#198

Open
overtrue wants to merge 1 commit into
mainfrom
test/rc-host-invalid-utf8-percent
Open

test(alias): cover non-UTF8 RC_HOST credential decoding#198
overtrue wants to merge 1 commit into
mainfrom
test/rc-host-invalid-utf8-percent

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

Summary

  • Add focused rc-core coverage for RC_HOST credentials that contain valid percent escapes but decode to invalid UTF-8.
  • Assert the error is classified as invalid percent-encoding for the secret key and does not expose credential material.

Background

Recent RC_HOST credential parsing changes added explicit malformed percent-encoding handling. The non-UTF-8 decode error branch remained uncovered, so this PR adds a narrow regression test around that path.

Validation

  • cargo test -p rc-core test_parse_rc_host_alias_rejects_non_utf8_percent_encoded_secret_key --lib
  • cargo test -p rc-core alias::tests --lib
  • make pre-commit

@overtrue overtrue marked this pull request as ready for review May 12, 2026 21:13
Copilot AI review requested due to automatic review settings May 12, 2026 21:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a targeted regression test in rc-core to cover the previously-uncovered error branch where RC_HOST credentials contain syntactically valid percent-escapes that decode into invalid UTF-8 (e.g., %FF). The test asserts the error is reported as invalid percent-encoding for the secret key and that the error message does not leak credential material.

Changes:

  • Add a unit test exercising non-UTF8 percent-decoded secret key handling in parse_env_alias.
  • Assert the returned error message is appropriately classified and does not include access/secret credential substrings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants