Skip to content

Fix PIA enrollment URLs in deep links and container sync - #536

Open
frankii91 wants to merge 2 commits into
privacyidea:masterfrom
frankii91:fix/container-sync-pia-enrollment
Open

Fix PIA enrollment URLs in deep links and container sync#536
frankii91 wants to merge 2 commits into
privacyidea:masterfrom
frankii91:fix/container-sync-pia-enrollment

Conversation

@frankii91

@frankii91 frankii91 commented Jul 27, 2026

Copy link
Copy Markdown

Problem

When the push_use_pia_scheme enrollment policy is enabled, privacyIDEA
returns Push enrollment URLs with the pia://pipush/... scheme.

Two supported enrollment paths could mishandle these URLs:

  1. Smartphone-container synchronization passed every server-provided
    enrollment URL directly to OtpAuthProcessor, which only accepts
    otpauth://. Synchronization could therefore complete while silently
    omitting the Push token, leaving the server-side token in clientwait.
  2. On Android, external enrollment links were claimed by Flutter's built-in
    deep-link handler even though the app uses the app_links plugin. Flutter
    interpreted the enrollment URI as a Navigator route and raised a
    Could not find a generator for route error instead of delivering it to
    the existing token-import flow.

QR enrollment already routed pia:// URLs through PiaSchemeProcessor.

Change

  • Route enrollment URLs returned by container synchronization through
    TokenImportSchemeProcessor.processUriByAny. This selects
    PiaSchemeProcessor for pia:// and preserves the existing
    OtpAuthProcessor path for otpauth://.
  • Opt out of Flutter's built-in Android deep-link handler so the existing
    app_links integration receives external enrollment links. This follows
    Flutter's documented configuration for applications using a third-party
    deep-link plugin.

No URL schemes or Android intent filters are changed.

Test coverage

The container synchronization regression test builds an encrypted response
containing a pia://pipush/... enrollment URL and verifies that it produces a
container-associated PushToken with the expected rollout URL and enrollment
credential.

Validation after both changes:

  • deep-link notifier and container API focused suites: 17 tests pass;
  • complete Flutter test suite passes;
  • Android manifest XML validation passes;
  • git diff --check passes.

flutter analyze --no-pub reports only the existing upstream diagnostics:
57 info messages and one pre-existing warning in token_folder.dart. The
changed files introduce no new warning or error.

@frankii91 frankii91 changed the title Fix PIA push enrollment URLs during container sync Fix PIA enrollment URLs in deep links and container sync Jul 27, 2026
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