Skip to content

Add login actions and resilient trade monitoring - #10

Merged
AstroZer01 merged 3 commits into
mainfrom
feature/login-actions-and-trade-monitoring
Aug 5, 2026
Merged

AstroZer01 merged 3 commits into
mainfrom
feature/login-actions-and-trade-monitoring

Conversation

@AstroZer01

@AstroZer01 AstroZer01 commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add manual and automated Steam login approval management, IP whitelist rules, desktop notifications, and recent login attempt history
  • improve multi-account trade confirmations with queued polling, retry/backoff, 429 cooldown, account selection, and pending badges
  • add opt-in redacted local diagnostic logging and reliable single-instance activation
  • bump the application version to 1.1.0.0

Verification

  • dotnet build SteamDesktopAuthenticator.sln --no-restore
  • WebView application script parse check

Summary by CodeRabbit

  • New Features

    • Added a “Logins” area with pending requests, recent login details, and manual approve/deny controls.
    • Added automatic login approval or denial rules, IP allowlists, and desktop notifications.
    • Improved multi-account trade confirmation monitoring with filtering, counts, and retry handling.
    • Added optional redacted diagnostic logging.
  • Bug Fixes

    • Improved startup, authentication, trade confirmation, and time synchronization reliability.
  • Documentation

    • Updated feature highlights and version information for version 1.1.0.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 7a2ecc5f-ad18-4073-955a-a5109875988d

📥 Commits

Reviewing files that changed from the base of the PR and between f0b8e2b and 9b9450a.

📒 Files selected for processing (5)
  • Steam Desktop Authenticator/DiagnosticErrorLogger.cs
  • Steam Desktop Authenticator/LoginApprovalService.cs
  • Steam Desktop Authenticator/MainForm.cs
  • Steam Desktop Authenticator/wwwroot/index.html
  • lib/SteamAuth/SteamAuth/TimeAligner.cs
🚧 Files skipped from review as they are similar to previous changes (5)
  • lib/SteamAuth/SteamAuth/TimeAligner.cs
  • Steam Desktop Authenticator/DiagnosticErrorLogger.cs
  • Steam Desktop Authenticator/wwwroot/index.html
  • Steam Desktop Authenticator/LoginApprovalService.cs
  • Steam Desktop Authenticator/MainForm.cs

📝 Walkthrough

Walkthrough

The application adds Steam login approval monitoring, manual and automatic decisions, dashboard controls, diagnostic logging, serialized account operations, single-instance activation, and updated authentication library behavior.

Changes

Login and account operations

Layer / File(s) Summary
Authentication and configuration foundations
Steam Desktop Authenticator/Manifest.cs, lib/SteamAuth/..., Steam Desktop Authenticator/LoginForm.cs
Adds login-action settings, normalization, response headers, session error handling, serialized time alignment, and the AstroSDA device name.
Login approval service
Steam Desktop Authenticator/LoginApprovalService.cs
Fetches pending login sessions, refreshes access tokens, submits decisions, generates confirmation signatures, and maps API failures.
Desktop monitoring and account operations
Steam Desktop Authenticator/MainForm.cs
Adds serialized trade operations, login polling, automatic decisions, retries, rate limiting, notifications, and monitor lifecycle handling.
Tray, settings, and notification integration
Steam Desktop Authenticator/MainForm.cs, Steam Desktop Authenticator/LoginNotificationPopup.cs
Adds tray commands, WebView actions, persisted monitoring settings, keyed confirmations, and clickable login notifications.
Web dashboard and settings UI
Steam Desktop Authenticator/wwwroot/index.html
Adds Login Actions views, account filters, request controls, recent-attempt details, automatic-action settings, diagnostic logging settings, and enhanced trade views.
Runtime diagnostics and release metadata
Steam Desktop Authenticator/DiagnosticErrorLogger.cs, Steam Desktop Authenticator/Program.cs, Steam Desktop Authenticator/Properties/AssemblyInfo.cs, Steam Desktop Authenticator/Steam Desktop Authenticator.csproj, .gitignore, README.md
Adds redacted rotating exception logs, named-mutex single-instance handling, global exception logging, version 1.1.0.0 metadata, documentation updates, and expanded local-file ignore rules.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Dashboard
  participant MainForm
  participant LoginApprovalService
  participant SteamAuth
  User->>Dashboard: Open Login Actions
  Dashboard->>MainForm: Load login actions
  MainForm->>LoginApprovalService: Fetch pending requests
  LoginApprovalService->>SteamAuth: Query sessions and request details
  SteamAuth-->>LoginApprovalService: Return pending requests
  LoginApprovalService-->>MainForm: Return fetch result
  MainForm-->>Dashboard: Render requests
  User->>Dashboard: Approve or deny request
  Dashboard->>MainForm: Submit decision
  MainForm->>LoginApprovalService: RespondAsync
  LoginApprovalService->>SteamAuth: Update mobile confirmation
  SteamAuth-->>LoginApprovalService: Return action result
  LoginApprovalService-->>MainForm: Return success or typed error
  MainForm-->>Dashboard: Refresh request state
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.97% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary login-action and trade-monitoring changes in the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/login-actions-and-trade-monitoring

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 11

🧹 Nitpick comments (1)
Steam Desktop Authenticator/MainForm.cs (1)

1022-1032: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Bound the login bookkeeping collections.

completedAutomatedLoginActions, notifiedLoginRequests, recordedRecentLoginAttempts, notifiedTradeConfirmations, and automatedLoginActionNotifications only ever grow. Astro SDA runs continuously in the tray, so these sets accumulate one entry per observed request for the lifetime of the process.

Add pruning. automatedLoginActionNotifications already carries timestamps, so entries older than the 5-minute suppression window can be dropped. The key sets can be trimmed when a request is reconciled as no longer pending.

Also move the completedAutomatedLoginActions field declaration up with the other fields near line 46. A field between method bodies is easy to miss.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Steam` Desktop Authenticator/MainForm.cs around lines 1022 - 1032, Bound all
login bookkeeping collections: move the completedAutomatedLoginActions field
declaration to the main field-declaration section near the other fields, prune
completedAutomatedLoginActions, notifiedLoginRequests,
recordedRecentLoginAttempts, and notifiedTradeConfirmations when their requests
are reconciled as no longer pending, and remove
automatedLoginActionNotifications entries older than the five-minute suppression
window before or during notification handling in NotifyAutomatedLoginActionOnce.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/SteamAuth/SteamAuth/TimeAligner.cs`:
- Around line 66-79: Guard the deserialized result in GetSteamTimeAsync before
accessing query.Response.ServerTime, treating a null query or response as an
unsuccessful time lookup and returning without updating _timeDifference or
_aligned. Preserve the existing successful alignment behavior and WebException
handling.

In `@Steam` Desktop Authenticator/DiagnosticErrorLogger.cs:
- Around line 94-95: Update the filename-selection logic around the current
File.Exists/FileInfo check to calculate the pending log entry’s UTF-8 byte size
before selecting a file. Accept an existing file only when its current length
plus the entry size remains within MaximumLogFileSizeBytes, and truncate or skip
entries whose own size exceeds the limit so appending cannot exceed the bound.

In `@Steam` Desktop Authenticator/LoginApprovalService.cs:
- Around line 242-252: Update the exception handling around
account.Session.RefreshAccessToken and persistAccount so a failed secure save is
not caught and converted to LoginApprovalErrorKind.SessionExpired. Preserve the
session-expired conversion for refresh failures, while allowing the existing
LoginApprovalException from persistAccount to propagate with its original
message and error kind.
- Around line 315-320: Update FetchPendingRequestsCoreAsync to validate the
sessions response body after ThrowIfSteamFailed and before ParseClientIds by
checking that GetResponseObject(sessionsResponse.Body) returns a non-null
object, matching the existing validation pattern used in
FetchRequestDetailsAsync. Keep ThrowIfSteamFailed as-is, and ensure malformed or
missing response bodies now surface an error instead of falling through to an
empty request list.

In `@Steam` Desktop Authenticator/MainForm.cs:
- Around line 936-946: Update the login monitoring flow around the
LoginApprovalErrorKind.RateLimited handling to apply and honor a cooldown, using
the existing TryGetTradeRateLimitMessage and ApplyTradeRateLimit pattern as
guidance. Skip login monitoring passes while the cooldown is active, apply it
when rate limiting is detected, and record the event through
DiagnosticErrorLogger without changing SessionExpired or other error handling.
- Around line 1990-2014: Update RespondToTradeConfirmationAsync to execute the
AcceptConfirmation or DenyConfirmation call through the existing per-account
serialization mechanism, including confirmationsSemaphore as used by other Steam
confirmation operations. Preserve the existing error handling and
LoadTradesAsync cleanup while ensuring manual responses cannot overlap
confirmation fetching or monitor auto-accept operations for the same account.
- Around line 1906-1914: Update the settings parsing in
CoreWebView2_WebMessageReceived to use nullable boolean casts with false
fallbacks for loginActionMonitoringEnabled and the adjacent boolean payload
fields, including the pre-existing direct casts for checkConfirmations,
checkAllAccounts, autoConfirmMarket, autoConfirmTrades, and minimizeToTray.
Preserve the existing automatic-mode override for LoginActionMonitoringEnabled.
- Around line 906-919: Update loginActionsTimer_Tick and the fire-and-forget
MonitorLoginActionsAsync call in ConfigureLoginActionsMonitor to contain
exceptions from the login monitoring task. Wrap the awaited and discarded
monitor invocations with appropriate exception handling and route failures
through the existing application logging or error-reporting mechanism, ensuring
async-void event execution cannot terminate the application and fire-and-forget
failures are not lost.

In `@Steam` Desktop Authenticator/Manifest.cs:
- Around line 60-61: Change the default initializer of
Manifest.LoginActionMonitoringEnabled to false so existing manifests without the
property remain disabled after deserialization. Preserve GenerateNewManifest’s
explicit true value for fresh installations if that is the intended new-user
behavior.

In `@Steam` Desktop Authenticator/wwwroot/index.html:
- Around line 341-354: Update the recent login attempt modal flow around
showRecentLoginAttempt, closeRecentLoginAttempt, and renderRecentLoginAttempts
to track the button that opened the modal, pass it when showing the modal, and
restore focus to it after closing. Add Escape-key handling for the active dialog
so pressing Escape invokes closeRecentLoginAttempt while preserving the existing
close-button focus behavior.
- Around line 545-555: Update the trade-account change handler that synchronizes
login-account-select to call renderLoginActions() after updating the selector,
matching the existing login selector handler behavior so the Login Actions list
and count reflect the newly selected account.

---

Nitpick comments:
In `@Steam` Desktop Authenticator/MainForm.cs:
- Around line 1022-1032: Bound all login bookkeeping collections: move the
completedAutomatedLoginActions field declaration to the main field-declaration
section near the other fields, prune completedAutomatedLoginActions,
notifiedLoginRequests, recordedRecentLoginAttempts, and
notifiedTradeConfirmations when their requests are reconciled as no longer
pending, and remove automatedLoginActionNotifications entries older than the
five-minute suppression window before or during notification handling in
NotifyAutomatedLoginActionOnce.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 851488bf-f7e2-48cd-8b23-1a30cfb34509

📥 Commits

Reviewing files that changed from the base of the PR and between 18f630d and 92fad55.

📒 Files selected for processing (14)
  • .gitignore
  • Steam Desktop Authenticator/DiagnosticErrorLogger.cs
  • Steam Desktop Authenticator/LoginApprovalService.cs
  • Steam Desktop Authenticator/LoginForm.cs
  • Steam Desktop Authenticator/LoginNotificationPopup.cs
  • Steam Desktop Authenticator/MainForm.cs
  • Steam Desktop Authenticator/Manifest.cs
  • Steam Desktop Authenticator/Program.cs
  • Steam Desktop Authenticator/Properties/AssemblyInfo.cs
  • Steam Desktop Authenticator/Steam Desktop Authenticator.csproj
  • Steam Desktop Authenticator/wwwroot/index.html
  • lib/SteamAuth/SteamAuth/SteamGuardAccount.cs
  • lib/SteamAuth/SteamAuth/SteamWeb.cs
  • lib/SteamAuth/SteamAuth/TimeAligner.cs

Comment thread lib/SteamAuth/SteamAuth/TimeAligner.cs
Comment thread Steam Desktop Authenticator/DiagnosticErrorLogger.cs Outdated
Comment thread Steam Desktop Authenticator/LoginApprovalService.cs
Comment thread Steam Desktop Authenticator/LoginApprovalService.cs
Comment thread Steam Desktop Authenticator/MainForm.cs
Comment thread Steam Desktop Authenticator/MainForm.cs Outdated
Comment thread Steam Desktop Authenticator/MainForm.cs
Comment on lines +60 to +61
[JsonProperty("login_action_monitoring_enabled")]
public bool LoginActionMonitoringEnabled { get; set; } = true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Default login monitoring to disabled for existing manifests.

LoginActionMonitoringEnabled defaults to true. Existing manifests do not contain login_action_monitoring_enabled, so every current installation starts polling Steam every 5 seconds for all accounts after the upgrade, without an explicit opt-in. The UI text in wwwroot/index.html also presents monitoring as a user choice.

Set the default to false, or gate the enable-on-upgrade behavior behind a first-run prompt.

🔧 Proposed change
         [JsonProperty("login_action_monitoring_enabled")]
-        public bool LoginActionMonitoringEnabled { get; set; } = true;
+        public bool LoginActionMonitoringEnabled { get; set; } = false;

GenerateNewManifest at line 158 can keep setting true for fresh installations if that is the intended new-user default.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[JsonProperty("login_action_monitoring_enabled")]
public bool LoginActionMonitoringEnabled { get; set; } = true;
[JsonProperty("login_action_monitoring_enabled")]
public bool LoginActionMonitoringEnabled { get; set; } = false;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Steam` Desktop Authenticator/Manifest.cs around lines 60 - 61, Change the
default initializer of Manifest.LoginActionMonitoringEnabled to false so
existing manifests without the property remain disabled after deserialization.
Preserve GenerateNewManifest’s explicit true value for fresh installations if
that is the intended new-user behavior.

Comment thread Steam Desktop Authenticator/wwwroot/index.html
Comment thread Steam Desktop Authenticator/wwwroot/index.html
@AstroZer01
AstroZer01 merged commit a6f5db8 into main Aug 5, 2026
6 of 7 checks passed
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.

1 participant