Sonnet Review Bot sonnet-review-bot
  • Joined on 2026-04-24
sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:55:09 +00:00
fix(action): detect VCS host type for version resolution and binary download

[NIT] The Python inline script for extracting BINARY_ASSET_ID uses sys.exit(1) in the else clause of the for loop, which will make curl's output silently disappear on failure. Combined with the if [ -z "$BINARY_ASSET_ID" ] check that follows, this creates a confusing double-check (the python exits 1 before the shell check fires). Either rely solely on the shell empty-check (remove sys.exit(1)) or rely solely on python's exit code — mixing both is redundant.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:55:09 +00:00
fix(action): detect VCS host type for version resolution and binary download

[MINOR] The grep -qP flag (Perl-compatible regex) is used for control character validation. The -P flag is not available in all environments (e.g., macOS grep, BusyBox grep). While ubuntu-* runners have GNU grep and this works fine in practice, a POSIX-compatible alternative using tr or LC_ALL=C grep -qP would be more portable if ever run on non-GNU environments. Low risk given the ubuntu-* constraint stated in the action.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:55:09 +00:00
fix(action): detect VCS host type for version resolution and binary download

[MINOR] The -H "$AUTH_HEADER" pattern passes a shell variable containing a header value directly to curl. If ACTION_TOKEN somehow contains a newline despite the control-character check, this could inject additional headers. A safer pattern is curl ... -H "Authorization: Bearer ${ACTION_TOKEN}" inline rather than building it as a variable. This is defense-in-depth only since the control character check should prevent this, but the inline form is more conventional and avoids the vector entirely.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:39:45 +00:00
fix(action): detect VCS host type for version resolution and binary download

[MINOR] The AUTH_HEADER variable is constructed as a plain string and passed via -H "$AUTH_HEADER". If the token ever contains shell metacharacters (unlikely for a well-formed token, but possible), this could cause issues. A more robust approach would be to pass the header components separately or use -H "$(printf '%s' ...)". Low risk in practice, but worth noting.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:39:45 +00:00
fix(action): detect VCS host type for version resolution and binary download

[NIT] The comment # 防止 path traversal (Chinese: 'prevent path traversal') appears twice. Mixed-language comments in a codebase should be consistent. Either translate to English or keep the Chinese, but mixing them in adjacent lines of the same file can be confusing to contributors who don't read Chinese.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:39:45 +00:00
fix(action): detect VCS host type for version resolution and binary download

[MINOR] The VERSION validation regex '[\n\r/[:space:]]' uses \n and \r inside a POSIX ERE passed to grep -qE. In POSIX ERE, \n is not a standard escape — it may or may not be interpreted as a literal newline depending on the grep implementation. The literal characters [:space:] already includes newline and carriage return in POSIX, so the \n\r prefixes are either redundant or potentially unreliable. Simplify to grep -qE '[/[:space:]]' or test with $'\n' separately, as was done for the SERVER_URL check above.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:39:45 +00:00
fix(action): detect VCS host type for version resolution and binary download

[NIT] In the 'Install review-bot' step, GITHUB_API_URL is re-read from ${{ github.api_url }} rather than from the step output ${{ steps.version.outputs.vcs_type }}. This is fine and consistent with the security rationale (using a trusted platform-provided value), but it means the GitHub path implicitly relies on github.api_url being non-empty whenever vcs_type == github. A comment linking back to the detection logic in the version step would aid future maintainers.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:39:45 +00:00
fix(action): detect VCS host type for version resolution and binary download

[MINOR] The regex validation '^https://[^[:space:]]+$' is applied after the newline check that immediately follows it (grep -q $'\n'), but the regex [^[:space:]] already excludes newlines since [:space:] includes \n. The second check is redundant and can never catch anything the first didn't. Consider removing the redundant newline check, or document that it's belt-and-suspenders.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:30:15 +00:00
fix(action): detect VCS host type for version resolution and binary download

[MINOR] The newline check using grep -q $'\n' is redundant. The preceding grep -qE '^https://[^[:space:]]+$' already rejects strings containing newlines because \n is a whitespace character matched by [[:space:]]. The second check adds noise and complexity without adding safety.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:30:15 +00:00
fix(action): detect VCS host type for version resolution and binary download

[MINOR] The VERSION validation regex [\n\r/[:space:]] uses POSIX ERE character class [[:space:]] combined with explicit \n\r. In bash with grep -qE, [[:space:]] already includes \n and \r, making those explicit escapes redundant. This is harmless but confusing.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:30:15 +00:00
fix(action): detect VCS host type for version resolution and binary download

[MINOR] The SERVER_URL mismatch check compares the value from steps.version.outputs.server_url (a step output set in the same workflow) against github.server_url. Since step outputs on GitHub Actions are not secret-masked and the server_url output was set directly from github.server_url just steps earlier, this check can never fail in practice and provides marginal security value. It adds code complexity; a comment explaining why this check is intentionally kept defensive would help future maintainers.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:30:15 +00:00
fix(action): detect VCS host type for version resolution and binary download

[NIT] Chinese comment fragment 防止 path traversal appears inline in English code comments. While technically harmless, mixing languages in inline comments reduces readability for non-Chinese readers. Consider replacing with # prevent path traversal for consistency.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:13:26 +00:00
fix(action): detect VCS host type for version resolution and binary download

[NIT] When version resolution fails (empty $VERSION after the Python one-liner), the error message includes the API URL which may contain a token-bearing URL in some edge configs. The current setup uses headers so this is fine, but the error message could note which VCS type was being tried for easier debugging.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:13:26 +00:00
fix(action): detect VCS host type for version resolution and binary download

[NIT] The newline injection check only validates VERSION but not ACTION_REPO, SERVER_URL, or VCS_TYPE which are also written to GITHUB_OUTPUT. For defense-in-depth consistency, all four outputs written to GITHUB_OUTPUT should be validated, especially ACTION_REPO which comes from user input.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:13:26 +00:00
fix(action): detect VCS host type for version resolution and binary download

[MINOR] The action_token is written to GITHUB_OUTPUT (line 170) as plaintext. While this is a composite action (not a reusable workflow) and the value is scoped to this run, tokens in step outputs can appear in debug logs when ACTIONS_STEP_DEBUG=true. A comment noting this limitation would be appropriate, or alternatively the token could be re-evaluated from inputs in the install step rather than passed through output.

sonnet-review-bot commented on pull request rodin/review-bot#121 2026-05-14 04:13:26 +00:00
fix(action): detect VCS host type for version resolution and binary download

[MINOR] The AUTH_ARGS variable is built (lines 229-235) but never actually used — curl calls in the install step explicitly expand the token inline instead. The dead variable is harmless but is misleading noise and should be removed.