Skip to content

fix: reject failed LF1 polling before login finalization - #261

Merged
highesttt merged 2 commits into
mainfrom
fix/lf1-polling-guards
Oct 8, 2026
Merged

highesttt merged 2 commits into
mainfrom
fix/lf1-polling-guards

Conversation

@highesttt

Copy link
Copy Markdown
Collaborator

No description provided.

@indent

indent Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Issues

1 potential issue found:

  • The new LF1 failure paths, the loginPollingFailure/safeLoginPollingReason sanitization and the "LINE response without a valid code" branch have no tests, so redaction or downstream error classification could regress silently.
    Found by Indent Review Agent

↑ Select any checkbox above to have Indent auto-fix the issue

1 issue already resolved
  • Non-JSON or code-less error bodies (e.g. gateway 502 HTML, empty body) are reported as "LINE response code 0", which looks like LINE's success code and misleads log triage. Use a neutral message when no code is present. (fixed by commit 9809ab2)
    Found by Indent Review Agent

CI Checks

All CI checks passed on 9809ab2.

Review agents

Select any unchecked box below to run or rerun that agent.

Found issues (1)
  • Indent Review Agent · Code-0 nit is fixed and the format change breaks nothing; only the missing-tests nit remains.
Full results

Indent Review Agent

  • Summary: Code-0 nit is fixed and the format change breaks nothing; only the missing-tests nit remains.
  • Last ran on commit: 9809ab20
  • Latest result
    {
      "summary": "Code-0 nit is fixed and the format change breaks nothing; only the missing-tests nit remains.",
      "findings": [
        {
          "fix": "Add table tests for `loginPollingFailure` covering: a 10051/TalkException body with a whitelisted reason, the same body with an unlisted reason (redacted), a non-JSON body, a JSON body without `code`, and a non-200 status. Then assert that `wrapLineLoginError` classifies the resulting error as expected.",
          "line": 260,
          "path": "pkg/line/errors.go",
          "issue": "This PR adds three new rejection paths in `waitForLoginLF1`: non-200, missing `code`, and nonzero `code`. It also adds the `loginPollingFailure`/`safeLoginPollingReason` sanitization, but there are no tests. The sanitization is the security-relevant part: it must not echo unlisted reasons, and its output has to stay parseable by `parseLoginErrorDetails` so that whitelisted reasons like \"blocked user\" still map to `ErrLoginTooManyAttempts` in `wrapLineLoginError`. A future change to either side could break that silently. The new no-code branch (\"LINE response without a valid code\") is also untested.",
          "title": "New LF1 failure handling has no tests",
          "severity": "nit"
        }
      ]
    }

Comment thread pkg/line/errors.go Outdated
Comment thread pkg/line/client.go
if err != nil {
return nil, fmt.Errorf("failed to read LF1 polling response: %w", err)
}
if resp.StatusCode != http.StatusOK {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪️ Nit · New LF1 polling failure handling has no tests

Three new rejection paths (non-200, missing code, nonzero code) plus the reason whitelist have no tests. The whitelist is security-relevant, and its output must stay parseable by parseLoginErrorDetails so wrapLineLoginError keeps classifying errors correctly.

Found by Indent Review Agent

@highesttt
highesttt merged commit 23cd1f7 into main Oct 8, 2026
9 checks passed
@highesttt
highesttt deleted the fix/lf1-polling-guards branch October 8, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant