fix(android): auto-resume pairing approval#63199
Conversation
🔒 Aisle Security AnalysisWe found 2 potential security issue(s) in this PR:
1. 🟠 Operator session can authenticate using gateway bootstrap token when no operator device token exists
Description
This is risky because bootstrap/setup tokens are typically intended only for initial provisioning / seeding a device token, and may be:
With this change:
If the gateway server accepts bootstrap tokens for Vulnerable code (new behavior): val explicitBootstrapToken = auth.bootstrapToken?.trim()?.takeIf { it.isNotEmpty() }
if (explicitBootstrapToken != null) {
return NodeRuntime.GatewayConnectAuth(
token = null,
bootstrapToken = explicitBootstrapToken,
password = null,
)
}RecommendationDo not allow bootstrap/setup tokens to be used to authenticate an operator session unless they are explicitly designed/scoped for operator access. Client-side hardening:
For example: // Only allow explicit token/password for operator connect.
val storedToken = storedOperatorToken?.trim()?.takeIf { it.isNotEmpty() }
if (storedToken != null) {
return NodeRuntime.GatewayConnectAuth(token = null, bootstrapToken = null, password = null)
}
// Do NOT fall back to bootstrap for operator.
return nullServer-side defense-in-depth (recommended even if client is fixed):
2. 🟡 Unbounded auto-retry loop triggered by untrusted status text causes repeated reconnect/auth attempts (client-side DoS)
Description
The Security impact:
Vulnerable code: internal fun gatewayStatusLooksLikePairing(statusText: String): Boolean {
val lower = gatewayStatusForDisplay(statusText).lowercase()
return lower.contains("pair") || lower.contains("approve")
}
LaunchedEffect(enabled, lifecycleStarted) {
if (!enabled || !lifecycleStarted) {
return@LaunchedEffect
}
while (true) {
delay(PAIRING_AUTO_RETRY_MS)
onRetry()
}
}RecommendationAvoid driving retry behavior from free-form/untrusted Suggested fixes (combine as appropriate):
Example (bounded + backoff): LaunchedEffect(enabled, lifecycleStarted) {
if (!enabled || !lifecycleStarted) return@LaunchedEffect
var attempt = 0
while (enabled && lifecycleStarted && attempt < 10) {
val backoffMs = (6_000L shl attempt.coerceAtMost(4)) // up to 96s
delay(backoffMs)
onRetry()
attempt++
}
}
Analyzed PR: #63199 at commit Last updated on: 2026-04-08T16:28:40Z |
Greptile SummaryThis PR adds automatic pairing approval retry to the Android app: a Confidence Score: 5/5Safe to merge — auto-retry logic is correctly scoped and all findings are P2 or lower. No P0 or P1 issues found. The LaunchedEffect keying is correct, cancellation via delay() is handled idiomatically, reconnectPausedForAuthFailure is properly cleared on retry, and the clearGatewaySetupAuth() implementation is consistent with loadGatewayToken()'s lazy-load pattern. The only prior concern (duplicate constant) was already addressed in an earlier review thread. No files require special attention.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a28b8e660c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@greptile-apps re-review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 936c6ac5e8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 767ff879da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
24e23b9 to
184debd
Compare
Summary
Testing