Skip to content

feat(mobile): add server cert field, similar to client cert#14335

Closed
crisoagf wants to merge 1 commit intoimmich-app:mainfrom
crisoagf:add-personal-root-cert
Closed

feat(mobile): add server cert field, similar to client cert#14335
crisoagf wants to merge 1 commit intoimmich-app:mainfrom
crisoagf:add-personal-root-cert

Conversation

@crisoagf
Copy link

Initial code for server certificate field.

@crisoagf crisoagf force-pushed the add-personal-root-cert branch from 678fd71 to 5e498ec Compare November 25, 2024 10:27
@zackpollard
Copy link
Member

Hey, could you please provide more information on what this is supposed to achieve?

@crisoagf
Copy link
Author

Hey, could you please provide more information on what this is supposed to achieve?

Sure thing!

This is an attempt to implement certificate selection for self-signed/enterprise-signed servers without simply disabling SSL certificate checking. It creates another settings field, similar to the client certificate selection, to import a root or self-signed certificate and use that for connection validation. AFAICT, this is only needed for Android, for iPhones already respect user imported certificates.

Currently, the only option for custom root certs or self-signed certs in Android is "Allow self-signed SSL certificates" that accepts any certificate that matches the hostname, which is at least a bit scary from an MITM attack perspective.

Context is #13555 .

@alextran1502 alextran1502 changed the title Feat #13555 add server cert field, similar to client cert feat(mobile): add server cert field, similar to client cert Dec 2, 2024
@alextran1502
Copy link
Member

Hello, can you add some information on how this PR has been tested?

@crisoagf
Copy link
Author

crisoagf commented Dec 7, 2024

So far I tested with local build + flutter run. Try to use without given code doesn't work, with given code works.

I'll try to add some info in some file in the repo and I'd really like to write a couple of tests. I may take a while (haven't been having a lot of free time lately), but I'll do it.

@shenlong-tanwen
Copy link
Member

@crisoagf Using the cronet_http package for the HTTPClient will make flutter respect the CAs installed system-wide. That'd be the proper way to fix this. Can you please open a new PR with the cronet implementation instead? Thanks a lot for the contribution.

jfly added a commit to jfly/immich that referenced this pull request Jul 9, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

This depends on my fork of
`johnstef99/flutter_user_certificates_android`, which I've sent a PR for
here
<johnstef99/flutter_user_certificates_android#2>.
If y'all don't like the supply chain implications of that, I'm happy to
inline the implementation here instead.
jfly added a commit to jfly/immich that referenced this pull request Jul 9, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

This depends on my fork of
`johnstef99/flutter_user_certificates_android`, which I've sent a PR for
here
<johnstef99/flutter_user_certificates_android#2>.
If y'all don't like the supply chain implications of that, I'm happy to
inline the implementation here instead.
jfly added a commit to jfly/immich that referenced this pull request Jul 9, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

This depends on my fork of
`johnstef99/flutter_user_certificates_android`, which I've sent a PR for
here
<johnstef99/flutter_user_certificates_android#2>.
If y'all don't like the supply chain implications of that, I'm happy to
inline the implementation here instead.
jfly added a commit to jfly/immich that referenced this pull request Jul 24, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jul 24, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jul 25, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jul 25, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jul 25, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jul 25, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jul 25, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jul 28, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jul 28, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jul 29, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jul 29, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Aug 20, 2025
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jan 13, 2026
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jan 17, 2026
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jan 17, 2026
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jan 17, 2026
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
jfly added a commit to jfly/immich that referenced this pull request Jan 19, 2026
This is part of immich-app#15230.

Frustratingly, Dart/Flutter ignores user-installed certificates. Working
around this requires rooting your Android device to install certificates
as "system" certs, which isn't an option for everyone.

This is a known issue with Dart, see
dart-lang/sdk#50435 and
flutter/flutter#56607 for details.

I have read through
<immich-app#15230> and
<immich-app#13555>, and I
understand that switching to
[`cronnet_http`](immich-app#14335 (comment))
would also resolve this. While that may be the correct long-term
approach, it looks like there are [a lot of network
codepaths](immich-app#15230 (comment))
in Immich, and as I know basically nothing about Dart, nor Flutter, nor
Immich's codebase, I thought this would be a better short term approach.

For the record: the important code here is copied from my fork of
`johnstef99/flutter_user_certificates_android`. See this PR for more
context: <johnstef99/flutter_user_certificates_android#2>.
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.

4 participants