Skip to content

fix(subscription): include the MASQUE login in Xray JSON - #1290

Open
derundevu wants to merge 1 commit into
PasarGuard:devfrom
derundevu:fix/masque-subscription-user
Open

derundevu wants to merge 1 commit into
PasarGuard:devfrom
derundevu:fix/masque-subscription-user

Conversation

@derundevu

@derundevu derundevu commented Dec 1, 2026 •

Copy link
Copy Markdown

Summary

Xray JSON subscriptions included the MASQUE password but omitted the login, so the server rejected authentication even with the correct password.

Use the panel user's ID as streamSettings.masqueSettings.user when no login is supplied. This matches the account email sent to the node. An explicit login is preserved.

Type of change

  • Bug fix

Checklist

  • tested the change locally.
  • added a regression test.
  • did not include secrets or unrelated changes.

Testing

  • python -m pytest -q tests/test_subscription_*.py — 318 passed, 1 skipped.
  • The regression test failed before the fix and passed after it.
  • For two users, the generated login matched the serialized node account email. No live node was used.

Screenshots

Not applicable.

Notes for reviewers

No database migrations, API changes, or UI changes.

Summary by CodeRabbit

  • Bug Fixes
    • MASQUE subscriptions now use the configured account ID when no username is provided, while preserving an explicitly configured username and password.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

MASQUE outbound construction now uses the nested masque settings when available. If the configured user is empty, it uses _user_id as the login. A parameterized test checks fallback and explicit usernames, and verifies password serialization.

Changes

MASQUE Login Fallback

Layer / File(s) Summary
Credential selection and serialization tests
app/subscription/xray.py, tests/test_subscription_masque.py
_build_masque falls back to the string form of _user_id when the configured user is empty. The test checks the fallback, an explicit username, and the rendered password.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested labels: Backend

Suggested reviewers: immohammad20000

Merge Risk: Minimal · up to d5fae

This fixes MASQUE Xray JSON subscriptions that omitted the login, which made authentication fail. The change is small and tested, and no actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the fix and its scope: the MASQUE login is now included in the Xray JSON subscription output. The raw summary confirms _build_masque now derives the user from the nested masque map…
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.
Full details: Title check

Explanation

The title names the fix and its scope: the MASQUE login is now included in the Xray JSON subscription output. The raw summary confirms _build_masque now derives the user from the nested masque mapping or from _user_id when no user is set, and the test module checks the serialized user value. The title matches the main change, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the login string,
And sees the panel ID spring.
The password stays in place,
Both usernames pass the test with grace.
Hop, the outbound takes its wing.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f3134428-740a-443b-a000-f7126671292e
Commits

Reviewing files that changed from the base of the PR and between aa8d84d and d5faebf.

Files selected for processing: 2

  • app/subscription/xray.py
  • tests/test_subscription_masque.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@ImMohammad20000

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot added the Backend label Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants