Skip to content

[FEATURE] Add Extra Args option to browser settings#4402

Open
DavidGBrett wants to merge 2 commits intoFlow-Launcher:devfrom
DavidGBrett:add-extra-args-to-browser-configuration
Open

[FEATURE] Add Extra Args option to browser settings#4402
DavidGBrett wants to merge 2 commits intoFlow-Launcher:devfrom
DavidGBrett:add-extra-args-to-browser-configuration

Conversation

@DavidGBrett
Copy link
Copy Markdown
Contributor

@DavidGBrett DavidGBrett commented Apr 9, 2026

Summary

  • added new prop ExtraArgs to CustomBrowserViewModel
  • add new row in SelectBrowserWindow to edit this
  • Update OpenInBrowserWindow and OpenInBrowserTab to pass along these extra arguments

Should close #2653
Doesn't explicitly handle profiles but this should allow users to set that up themselves.

UI Change

image

Summary by cubic

Adds an Extra Args field to custom browser settings so users can pass command-line flags when opening URLs. Works for both new window and new tab, and logs now indicate when Extra Args were provided without recording their contents.

  • Summary of changes
    • Changed: OpenInBrowserWindow/OpenInBrowserTab accept optional extraArgs and include them in ProcessStartInfo.Arguments; PublicAPIInstance.OpenUri forwards ExtraArgs; error logs now omit ExtraArgs values and add a notice when present; SelectBrowserWindow layout updated to fit the new field.
    • Added: ExtraArgs to CustomBrowserViewModel (and its Copy()), TextBox binding in SelectBrowserWindow.xaml, and locale key defaultBrowser_extraArgs.
    • Removed: None.
    • Memory: Negligible (one extra string per browser config; one locale string).
    • Security: Low risk; args are passed directly to the process. Logging no longer prints ExtraArgs, reducing risk of leaking sensitive flags.
    • Tests: No unit tests added.

Written for commit 246910c. Summary will update on new commits.

- added new prop ExtraArgs to CustomBrowserViewModel
- add new row in SelectBrowserWindow to edit this
- Update OpenInBrowserWindow and OpenInBrowserTab to pass along these extra arguments
@prlabeler prlabeler bot added the enhancement New feature or request label Apr 9, 2026
@github-actions github-actions bot added this to the 2.2.0 milestone Apr 9, 2026
@DavidGBrett DavidGBrett changed the title Add Extra Args option to browser settings [FEATURE] Add Extra Args option to browser settings Apr 9, 2026
@DavidGBrett DavidGBrett marked this pull request as ready for review April 9, 2026 19:34
@gitstream-cm
Copy link
Copy Markdown

gitstream-cm bot commented Apr 9, 2026

🥷 Code experts: Jack251970

Jack251970 has most 👩‍💻 activity in the files.
Jack251970 has most 🧠 knowledge in the files.

See details

Flow.Launcher.Infrastructure/UserSettings/CustomBrowserViewModel.cs

Activity based on git-commit:

Jack251970
APR
MAR
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Jack251970: 100%

Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs

Activity based on git-commit:

Jack251970
APR
MAR
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Jack251970: 100%

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

Jack251970
APR 0 additions & 1 deletions
MAR
FEB 7 additions & 4 deletions
JAN
DEC
NOV

Knowledge based on git-blame:
Jack251970: 99%

Flow.Launcher/PublicAPIInstance.cs

Activity based on git-commit:

Jack251970
APR
MAR 2 additions & 2 deletions
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Jack251970: 96%

Flow.Launcher/SelectBrowserWindow.xaml

Activity based on git-commit:

Jack251970
APR
MAR
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Jack251970: 100%

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

@gitstream-cm
Copy link
Copy Markdown

gitstream-cm bot commented Apr 9, 2026

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Flow.Launcher/PublicAPIInstance.cs">

<violation number="1" location="Flow.Launcher/PublicAPIInstance.cs:467">
P2: Raw browser `ExtraArgs` are logged in exception messages, potentially exposing sensitive command-line data in persistent logs.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

📝 Walkthrough

Walkthrough

Adds an ExtraArgs string to custom browser profiles, surfaces it in the UI/localization, ensures it copies with the profile, and forwards the value when launching browsers via OpenUri/OpenInBrowserTab/OpenInBrowserWindow.

Changes

Cohort / File(s) Summary
Browser Settings Model
Flow.Launcher.Infrastructure/UserSettings/CustomBrowserViewModel.cs
Added public string ExtraArgs { get; set; } and updated Copy() to include ExtraArgs.
Browser Launch Logic
Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs, Flow.Launcher/PublicAPIInstance.cs
Extended OpenInBrowserWindow/OpenInBrowserTab signatures with extraArgs; updated command construction to append extra args; OpenUri now forwards browserInfo.ExtraArgs and updates failure logging.
UI & Localization
Flow.Launcher/SelectBrowserWindow.xaml, Flow.Launcher/Languages/en.xaml
Added UI row and TextBox bound to ExtraArgs in SelectBrowserWindow and defaultBrowser_extraArgs localization key.

Sequence Diagram

sequenceDiagram
    actor User
    participant UI as SelectBrowserWindow
    participant VM as CustomBrowserViewModel
    participant API as PublicAPIInstance
    participant SW as SearchWeb

    User->>UI: Enter ExtraArgs
    UI->>VM: Save ExtraArgs
    VM->>VM: Copy() includes ExtraArgs
    User->>API: Request OpenUri(url)
    API->>SW: OpenInBrowserTab/Window(url, browserPath, inPrivate, privateArg, extraArgs)
    SW->>SW: Build command: browserPath [privateArg] [extraArgs] url
    SW-->>API: Launch process
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • VictoriousRaptor
  • jjw24
  • onesounds
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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
Title check ✅ Passed The title '[FEATURE] Add Extra Args option to browser settings' clearly and concisely summarizes the main change: introducing a new Extra Args feature for browser configuration.
Description check ✅ Passed The description comprehensively explains the changes made, including new properties, UI updates, method signature updates, and logging behavior, all directly related to the changeset.
Linked Issues check ✅ Passed The PR successfully implements the requirements from #2653 by allowing users to pass browser CLI arguments (like --profile-directory) via the new ExtraArgs field, enabling profile-specific browser opens.
Out of Scope Changes check ✅ Passed All changes are directly related to the PR objective of adding an Extra Args option to browser settings. No unrelated modifications were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs (2)

55-55: Rename browserArguements to browserArguments.

Minor naming typo; worth cleaning up to satisfy lint/spell checks and improve readability.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs` at line 55, The local
variable browserArguements has a spelling typo; rename it to browserArguments
everywhere it's declared and referenced (e.g., the declaration in SearchWeb.cs
and any usages in methods that build the browser command string) to fix
lint/spelling checks and improve readability, ensuring you update all
occurrences and preserve the existing logic (including the iexplore.exe
conditional).

55-58: Consider centralizing browser-argument composition.

The same privateArg + extraArgs + url concatenation now exists in two methods. A small shared helper would keep ordering/spacing behavior consistent over time.

Also applies to: 105-107

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs` around lines 55 - 58, The
browser argument string construction for the SearchWeb class is duplicated (see
the browserArguements concatenation that uses browserExecutableName,
inPrivate/privateArg, extraArgs and url); extract this logic into a single
helper method (e.g., BuildBrowserArguments or ComposeBrowserArguments) that
accepts browserExecutableName, inPrivate, privateArg, extraArgs and url and
returns the correctly ordered/spaced argument string, then replace both
duplicate concatenations (lines around browserArguements and the similar block
at 105-107) with calls to that helper to ensure consistent ordering and spacing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Flow.Launcher/PublicAPIInstance.cs`:
- Line 467: The LogException call is logging raw browserInfo.PrivateArg and
browserInfo.ExtraArgs which can leak sensitive user-provided arguments; update
the LogException invocation in PublicAPIInstance.cs (the line that calls
LogException(ClassName, $"Failed to open URL in browser {tabOrWindow}: {path},
{inPrivate ?? browserInfo.EnablePrivate}, {browserInfo.PrivateArg},
{browserInfo.ExtraArgs}", e)) to redact those values—replace them with either
booleans indicating presence (e.g., PrivateArg != null, ExtraArgs != null) or a
fixed redacted string like "[REDACTED]" while keeping tabOrWindow, path,
inPrivate (or browserInfo.EnablePrivate) and the exception variable e unchanged.

---

Nitpick comments:
In `@Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs`:
- Line 55: The local variable browserArguements has a spelling typo; rename it
to browserArguments everywhere it's declared and referenced (e.g., the
declaration in SearchWeb.cs and any usages in methods that build the browser
command string) to fix lint/spelling checks and improve readability, ensuring
you update all occurrences and preserve the existing logic (including the
iexplore.exe conditional).
- Around line 55-58: The browser argument string construction for the SearchWeb
class is duplicated (see the browserArguements concatenation that uses
browserExecutableName, inPrivate/privateArg, extraArgs and url); extract this
logic into a single helper method (e.g., BuildBrowserArguments or
ComposeBrowserArguments) that accepts browserExecutableName, inPrivate,
privateArg, extraArgs and url and returns the correctly ordered/spaced argument
string, then replace both duplicate concatenations (lines around
browserArguements and the similar block at 105-107) with calls to that helper to
ensure consistent ordering and spacing.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5b126954-3b24-495f-9420-a5d7d5794693

📥 Commits

Reviewing files that changed from the base of the PR and between 3e320d5 and a2cd48f.

📒 Files selected for processing (5)
  • Flow.Launcher.Infrastructure/UserSettings/CustomBrowserViewModel.cs
  • Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs
  • Flow.Launcher/Languages/en.xaml
  • Flow.Launcher/PublicAPIInstance.cs
  • Flow.Launcher/SelectBrowserWindow.xaml

@DavidGBrett DavidGBrett marked this pull request as draft April 9, 2026 20:43
@DavidGBrett DavidGBrett marked this pull request as ready for review April 10, 2026 12:01
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

@coderabbitai coderabbitai bot removed the enhancement New feature or request label Apr 10, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
Flow.Launcher/PublicAPIInstance.cs (1)

467-471: ⚠️ Potential issue | 🟠 Major

Redact PrivateArg in logs too (raw arg still exposed).

Line 471 still logs browserInfo.PrivateArg verbatim. That can leak sensitive user-provided flags/paths in logs.

🔒 Suggested fix
-                    string includesExtraArgs = string.IsNullOrWhiteSpace(browserInfo.ExtraArgs) 
-                        ? "" 
-                        : ", [including omitted Extra Args]";
-                        
-                    LogException(ClassName, $"Failed to open URL in browser {tabOrWindow}: {path}, {inPrivate ?? browserInfo.EnablePrivate}, {browserInfo.PrivateArg}{includesExtraArgs}", e);
+                    var hasPrivateArg = !string.IsNullOrWhiteSpace(browserInfo.PrivateArg);
+                    var hasExtraArgs = !string.IsNullOrWhiteSpace(browserInfo.ExtraArgs);
+                    LogException(
+                        ClassName,
+                        $"Failed to open URL in browser {tabOrWindow}: path={path}, inPrivate={inPrivate ?? browserInfo.EnablePrivate}, hasPrivateArg={hasPrivateArg}, hasExtraArgs={hasExtraArgs}",
+                        e
+                    );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Flow.Launcher/PublicAPIInstance.cs` around lines 467 - 471, The log call
inside the failed-open-browser block is leaking browserInfo.PrivateArg; update
the LogException invocation in the same method (the block that builds
includesExtraArgs) to avoid logging the raw PrivateArg value—replace
browserInfo.PrivateArg with a redacted indicator (e.g., "[REDACTED_PRIVATE_ARG]"
or a boolean/presence marker) or omit it entirely, keeping the rest of the
message format and symbols (ClassName, tabOrWindow, path,
inPrivate/browserInfo.EnablePrivate, includesExtraArgs) unchanged so
LogException still provides context without exposing sensitive flags.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@Flow.Launcher/PublicAPIInstance.cs`:
- Around line 467-471: The log call inside the failed-open-browser block is
leaking browserInfo.PrivateArg; update the LogException invocation in the same
method (the block that builds includesExtraArgs) to avoid logging the raw
PrivateArg value—replace browserInfo.PrivateArg with a redacted indicator (e.g.,
"[REDACTED_PRIVATE_ARG]" or a boolean/presence marker) or omit it entirely,
keeping the rest of the message format and symbols (ClassName, tabOrWindow,
path, inPrivate/browserInfo.EnablePrivate, includesExtraArgs) unchanged so
LogException still provides context without exposing sensitive flags.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 24b14ce7-2a3e-4b34-8052-3727083a7e0e

📥 Commits

Reviewing files that changed from the base of the PR and between a2cd48f and 246910c.

📒 Files selected for processing (1)
  • Flow.Launcher/PublicAPIInstance.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web searches to use specific profiles

1 participant