-
Notifications
You must be signed in to change notification settings - Fork 10
0.9.3 #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
0.9.3 #292
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ca36538
use runtime fetch libs
ca333 7527caf
update checksum
ca333 61a4170
rm src update checksums
ca333 0d12950
Merge pull request #280 from KomodoPlatform/main
CharlVS 630b244
fix(config): add ssl-only transform for native platforms
takenagain 04ec2b7
chore(config): add logging for visibility if any configs are empty
takenagain 8e2a52b
fix(config): loosen types for needs transform check and fix lightwall…
takenagain 7c86d24
feat(activation): integrate ActivatedAssetsCache to optimize asset ac…
DeckerSU a64c98a
Merge pull request #281 from KomodoPlatform/fix/native-ssl-only-elect…
ca333 79216f0
feat(activation): integrate ActivatedAssetsCache to optimize asset ac…
ca333 0576989
use kdf dev branch ci build
smk762 1272a71
update build config to use kdf_1874d43
DeckerSU 5f7e46e
Merge pull request #286 from KomodoPlatform/patch-update-kdf-in-sdk-p…
ca333 5a80fac
normalize localhost to 127.0.0.1
ca333 5a7050f
Merge pull request #285 from KomodoPlatform/kdf-pk-hotfix
ca333 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||||||||||||||||
| import 'package:flutter/foundation.dart' show kIsWeb, kIsWasm; | ||||||||||||||||||||
| import 'package:komodo_defi_types/komodo_defi_type_utils.dart'; | ||||||||||||||||||||
| import 'package:logging/logging.dart'; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /// Defines a transform that can be applied to a single coin configuration. | ||||||||||||||||||||
| /// | ||||||||||||||||||||
|
|
@@ -29,6 +30,7 @@ class CoinConfigTransformer { | |||||||||||||||||||
| transforms ?? | ||||||||||||||||||||
| const [ | ||||||||||||||||||||
| WssWebsocketTransform(), | ||||||||||||||||||||
| SslElectrumTransform(), | ||||||||||||||||||||
| ZhtlcLightWalletTransform(), | ||||||||||||||||||||
| ParentCoinTransform(), | ||||||||||||||||||||
| ]; | ||||||||||||||||||||
|
|
@@ -205,6 +207,121 @@ class WssWebsocketTransform implements CoinConfigTransform { | |||||||||||||||||||
| /// Specifies which type of Electrum servers to retain | ||||||||||||||||||||
| enum ElectrumServerType { wssOnly, nonWssOnly } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /// Filters out insecure connections on non-web platforms, emulating the | ||||||||||||||||||||
| /// filtering applied to the coins_config_ssl.json file in KomodoPlatform/coins | ||||||||||||||||||||
| /// On non-web platforms, only SSL electrum servers and HTTPS URLs are | ||||||||||||||||||||
| /// supported for security. | ||||||||||||||||||||
| // TODO: move this to a build-time step via the coins config and/or the | ||||||||||||||||||||
| // komodo_wallet_build_transformer package | ||||||||||||||||||||
| class SslElectrumTransform implements CoinConfigTransform { | ||||||||||||||||||||
| const SslElectrumTransform(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| static final _log = Logger('SslElectrumTransform'); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| @override | ||||||||||||||||||||
| /// Determines if the transform should run by checking if this is a non-web | ||||||||||||||||||||
| /// platform with any of the filterable fields in the configuration. | ||||||||||||||||||||
| bool needsTransform(JsonMap config) { | ||||||||||||||||||||
| // Only run on non-web platforms | ||||||||||||||||||||
| if (kIsWeb || kIsWasm) return false; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| final electrum = config.valueOrNull<List>('electrum'); | ||||||||||||||||||||
| final rpcNodes = config.valueOrNull<List>('nodes'); | ||||||||||||||||||||
| final lightWalletServers = config.valueOrNull<List>( | ||||||||||||||||||||
| 'light_wallet_d_servers', | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| return electrum != null || rpcNodes != null || lightWalletServers != null; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| @override | ||||||||||||||||||||
| /// Filters entries to keep only secure connections on non-web platforms. | ||||||||||||||||||||
| JsonMap transform(JsonMap config) { | ||||||||||||||||||||
| final result = JsonMap.of(config); | ||||||||||||||||||||
| final coin = config.valueOrNull<String>('coin') ?? 'unknown'; | ||||||||||||||||||||
| // Filter electrum servers - keep only SSL protocol | ||||||||||||||||||||
| final electrum = config.valueOrNull<JsonList>('electrum'); | ||||||||||||||||||||
| if (electrum != null) { | ||||||||||||||||||||
| final originalCount = electrum.length; | ||||||||||||||||||||
| final filteredElectrums = electrum.where((JsonMap e) { | ||||||||||||||||||||
| final protocol = e.valueOrNull<String>('protocol'); | ||||||||||||||||||||
| return protocol == 'SSL'; | ||||||||||||||||||||
| }).toList(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if (filteredElectrums.isEmpty && originalCount > 0) { | ||||||||||||||||||||
| _log.warning( | ||||||||||||||||||||
| 'SslElectrumTransform: All $originalCount electrum servers filtered ' | ||||||||||||||||||||
| 'out for $coin (no SSL servers available)', | ||||||||||||||||||||
| ); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| result['electrum'] = filteredElectrums; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Filter RPC nodes - keep only HTTPS URLs | ||||||||||||||||||||
| final rpcNodes = config.valueOrNull<JsonList>('nodes'); | ||||||||||||||||||||
| if (rpcNodes != null) { | ||||||||||||||||||||
| final originalCount = rpcNodes.length; | ||||||||||||||||||||
| final filteredRpcNodes = rpcNodes.where((JsonMap node) { | ||||||||||||||||||||
| final url = node.valueOrNull<String>('url'); | ||||||||||||||||||||
| return url != null && url.startsWith('https://'); | ||||||||||||||||||||
| }).toList(); | ||||||||||||||||||||
|
Comment on lines
+265
to
+268
|
||||||||||||||||||||
| final filteredRpcNodes = rpcNodes.where((JsonMap node) { | |
| final url = node.valueOrNull<String>('url'); | |
| return url != null && url.startsWith('https://'); | |
| }).toList(); | |
| final filteredRpcNodes = rpcNodes.where((node) { | |
| if (node is! Map<String, dynamic>) return false; | |
| final url = (node as JsonMap).valueOrNull<String>('url'); | |
| return url != null && url.startsWith('https://'); | |
| }).cast<JsonMap>().toList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
whereclause explicitly casts list elements toJsonMapwithout validation. If theelectrumlist contains non-map elements, this will cause a runtime type error. Consider using safer type checking:The same issue exists on line 265 for
rpcNodes.