feat(mobile): add server cert field, similar to client cert#14335
feat(mobile): add server cert field, similar to client cert#14335crisoagf wants to merge 1 commit intoimmich-app:mainfrom
Conversation
678fd71 to
5e498ec
Compare
|
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 . |
|
Hello, can you add some information on how this PR has been tested? |
|
So far I tested with local build + 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. |
|
@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. |
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.
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.
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.
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>.
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>.
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>.
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>.
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>.
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>.
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>.
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>.
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>.
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>.
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>.
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>.
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>.
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>.
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>.
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>.
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>.
Initial code for server certificate field.