fix: parse hex-encoded macOS Keychain credentials#38
Conversation
macOS `security find-generic-password -w` outputs hex strings when credentials contain non-printable characters (\x07 prefix). Extract parseCredentialString() as a pure function that detects hex encoding, decodes it, and falls back to brace-matching for binary-prefixed JSON. Closes #37 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 Pull Request는 macOS Keychain에서 자격 증명을 읽을 때 발생하는 파싱 오류를 해결합니다. 기존에는 Keychain이 비인쇄 문자를 포함하는 암호를 헥스 인코딩된 문자열로 반환하여 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이 PR은 macOS Keychain에서 non-printable 문자가 포함된 credential을 읽어올 때 security 명령어가 16진수 문자열을 반환하여 발생하는 파싱 오류를 해결합니다. parseCredentialString이라는 순수 함수를 도입하여 16진수 감지 및 디코딩, 그리고 바이너리 접두사가 붙은 경우에 대한 처리를 포함한 파싱 로직을 캡슐화한 점이 좋습니다. 또한, 추가된 9개의 테스트 케이스는 새로운 함수의 동작을 다양한 엣지 케이스에 대해 검증하여 코드의 안정성을 높여줍니다. 전반적으로 훌륭한 수정이지만, 16진수 문자열을 감지하는 로직을 조금 더 견고하게 만들면 더 좋을 것 같습니다. 자세한 내용은 아래 주석을 참고해주세요.
Prevents false positives where short hex-like strings (e.g. "face") would be incorrectly decoded as hex-encoded credentials. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
security find-generic-password -w가 non-printable 문자(\x07prefix) 포함 시 hex 문자열로 출력하여JSON.parse()실패 →--show-usageusage 줄 미표시parseCredentialString()순수 함수 추출: hex 감지 → 디코딩 → JSON 파싱, binary prefix 시 brace-matching fallbacktoken.test.ts)Closes #37
Test plan
bun test전체 106개 통과--show-usage시 3번째 줄(⏳/📊/⏰/📅) 정상 표시 확인🤖 Generated with Claude Code