Skip to content

Conversation

@bparrishMines
Copy link
Contributor

@bparrishMines bparrishMines commented Apr 6, 2025

Adds support to the native wrapper to handle SecTrust and SecCertificate.

This is a part of landing #7893 by splitting of the native wrapper implementation.

Also fixes flutter/flutter#162938 and adds an integration test for loadFlutterAsset.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

@bparrishMines bparrishMines changed the title Sec methods [webview_flutter_wkwebview] Fixes loadFlutterAsset exception and updates native wrapper for SecTrust and SecCertificate Apr 6, 2025
Copy link
Contributor Author

@bparrishMines bparrishMines Apr 6, 2025

Choose a reason for hiding this comment

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

For future reference, I ran this in a terminal to generate this file

# Generate a private key
openssl genpkey -algorithm RSA -out test_key.pem -pkeyopt rsa_keygen_bits:2048

# Generate a Certificate Signing Request (CSR) - fill in dummy info
openssl req -new -key test_key.pem -out test_csr.pem

# Generate a self-signed certificate (e.g., valid for 5000 days) and export to DER format
openssl x509 -req -days 5000 -in test_csr.pem -signkey test_key.pem -out test_cert.der -outform DER

@bparrishMines bparrishMines marked this pull request as ready for review April 6, 2025 20:24
@bparrishMines bparrishMines requested a review from cbracken as a code owner April 6, 2025 20:24
Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM with small comments.


var url: URL? = bundle.url(
forResource: (assetFilePath! as NSString).deletingPathExtension,
withExtension: (assetFilePath! as NSString).pathExtension)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you use guard for the nil check on line 27, can't you avoid the force unwrap here and below?

Copy link
Contributor Author

@bparrishMines bparrishMines Apr 13, 2025

Choose a reason for hiding this comment

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

I tried changing line 27 to:

guard assetFilePath != nil else {
  return nil
}

and I still needed the force unwrap here. Is this what you were thinking?

Copy link

Choose a reason for hiding this comment

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

I'm not @stuartmorgan-g, but you could write it as

guard let assetFilePath else {
    return nil
}

and then you can use the variable assetFilePath without force unwrapping it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

For the versions of Swift we support it's still guard let assetFilePath = assetFilePath else.

@bparrishMines bparrishMines added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 14, 2025
@auto-submit auto-submit bot merged commit 7bdffbe into flutter:main Apr 14, 2025
82 checks passed
@bparrishMines bparrishMines deleted the sec_methods branch April 14, 2025 17:59
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 15, 2025
…n and updates native wrapper for `SecTrust` and `SecCertificate` (flutter/packages#9016)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 15, 2025
…n and updates native wrapper for `SecTrust` and `SecCertificate` (flutter/packages#9016)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 15, 2025
…n and updates native wrapper for `SecTrust` and `SecCertificate` (flutter/packages#9016)
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Apr 15, 2025
flutter/packages@f26b681...2fcc403

2025-04-15 10687576+bparrishMines@users.noreply.github.com
[camera_android_camerax] Updates internal API wrapper to use ProxyApis
(flutter/packages#8618)
2025-04-14 stuartmorgan@google.com [tool] Run a config-only build before
Xcode analyze (flutter/packages#9075)
2025-04-14 10687576+bparrishMines@users.noreply.github.com
[webview_flutter_android] Adds internal wrapper methods for native
`WebViewClient`. (flutter/packages#8964)
2025-04-14 10687576+bparrishMines@users.noreply.github.com
[webview_flutter_wkwebview] Fixes `loadFlutterAsset` exception and
updates native wrapper for `SecTrust` and `SecCertificate`
(flutter/packages#9016)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Apr 15, 2025
flutter/packages@f26b681...2fcc403

2025-04-15 10687576+bparrishMines@users.noreply.github.com
[camera_android_camerax] Updates internal API wrapper to use ProxyApis
(flutter/packages#8618)
2025-04-14 stuartmorgan@google.com [tool] Run a config-only build before
Xcode analyze (flutter/packages#9075)
2025-04-14 10687576+bparrishMines@users.noreply.github.com
[webview_flutter_android] Adds internal wrapper methods for native
`WebViewClient`. (flutter/packages#8964)
2025-04-14 10687576+bparrishMines@users.noreply.github.com
[webview_flutter_wkwebview] Fixes `loadFlutterAsset` exception and
updates native wrapper for `SecTrust` and `SecCertificate`
(flutter/packages#9016)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
mboetger pushed a commit to mboetger/flutter that referenced this pull request Apr 16, 2025
flutter/packages@f26b681...2fcc403

2025-04-15 10687576+bparrishMines@users.noreply.github.com
[camera_android_camerax] Updates internal API wrapper to use ProxyApis
(flutter/packages#8618)
2025-04-14 stuartmorgan@google.com [tool] Run a config-only build before
Xcode analyze (flutter/packages#9075)
2025-04-14 10687576+bparrishMines@users.noreply.github.com
[webview_flutter_android] Adds internal wrapper methods for native
`WebViewClient`. (flutter/packages#8964)
2025-04-14 10687576+bparrishMines@users.noreply.github.com
[webview_flutter_wkwebview] Fixes `loadFlutterAsset` exception and
updates native wrapper for `SecTrust` and `SecCertificate`
(flutter/packages#9016)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
ash2moon pushed a commit to ash2moon/flutter that referenced this pull request Apr 21, 2025
flutter/packages@f26b681...2fcc403

2025-04-15 10687576+bparrishMines@users.noreply.github.com
[camera_android_camerax] Updates internal API wrapper to use ProxyApis
(flutter/packages#8618)
2025-04-14 stuartmorgan@google.com [tool] Run a config-only build before
Xcode analyze (flutter/packages#9075)
2025-04-14 10687576+bparrishMines@users.noreply.github.com
[webview_flutter_android] Adds internal wrapper methods for native
`WebViewClient`. (flutter/packages#8964)
2025-04-14 10687576+bparrishMines@users.noreply.github.com
[webview_flutter_wkwebview] Fixes `loadFlutterAsset` exception and
updates native wrapper for `SecTrust` and `SecCertificate`
(flutter/packages#9016)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
nick-llewellyn pushed a commit to labrystechnology/flutter_packages that referenced this pull request Apr 23, 2025
…dates native wrapper for `SecTrust` and `SecCertificate` (flutter#9016)

Adds support to the native wrapper to handle `SecTrust` and `SecCertificate`. 

This is a part of landing flutter#7893 by splitting of the native wrapper implementation. 

Also fixes flutter/flutter#162938 and adds an integration test for `loadFlutterAsset`.

## Pre-Review Checklist

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
androidseb pushed a commit to androidseb/packages that referenced this pull request Jun 8, 2025
…dates native wrapper for `SecTrust` and `SecCertificate` (flutter#9016)

Adds support to the native wrapper to handle `SecTrust` and `SecCertificate`. 

This is a part of landing flutter#7893 by splitting of the native wrapper implementation. 

Also fixes flutter/flutter#162938 and adds an integration test for `loadFlutterAsset`.

## Pre-Review Checklist

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
FMorschel pushed a commit to FMorschel/packages that referenced this pull request Jun 9, 2025
…dates native wrapper for `SecTrust` and `SecCertificate` (flutter#9016)

Adds support to the native wrapper to handle `SecTrust` and `SecCertificate`. 

This is a part of landing flutter#7893 by splitting of the native wrapper implementation. 

Also fixes flutter/flutter#162938 and adds an integration test for `loadFlutterAsset`.

## Pre-Review Checklist

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
Ortes pushed a commit to Ortes/packages that referenced this pull request Jun 25, 2025
…dates native wrapper for `SecTrust` and `SecCertificate` (flutter#9016)

Adds support to the native wrapper to handle `SecTrust` and `SecCertificate`. 

This is a part of landing flutter#7893 by splitting of the native wrapper implementation. 

Also fixes flutter/flutter#162938 and adds an integration test for `loadFlutterAsset`.

## Pre-Review Checklist

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
flutter/packages@f26b681...2fcc403

2025-04-15 10687576+bparrishMines@users.noreply.github.com
[camera_android_camerax] Updates internal API wrapper to use ProxyApis
(flutter/packages#8618)
2025-04-14 stuartmorgan@google.com [tool] Run a config-only build before
Xcode analyze (flutter/packages#9075)
2025-04-14 10687576+bparrishMines@users.noreply.github.com
[webview_flutter_android] Adds internal wrapper methods for native
`WebViewClient`. (flutter/packages#8964)
2025-04-14 10687576+bparrishMines@users.noreply.github.com
[webview_flutter_wkwebview] Fixes `loadFlutterAsset` exception and
updates native wrapper for `SecTrust` and `SecCertificate`
(flutter/packages#9016)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: webview_flutter platform-ios platform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[webview_flutter] loadFlutterAsset throws PlatformException on macOS

3 participants