-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[flutter_tools] wire up complete support for Dart obfuscation #50509
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
[flutter_tools] wire up complete support for Dart obfuscation #50509
Conversation
|
How would deobfuscating work? Also |
|
Discussed offline a bit: the obfuscation does not apply to the debug symbols, so the workflow is the same for |
dnfield
left a comment
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.
LGTM
| argParser.addFlag(FlutterOptions.kDartObfuscationOption, | ||
| help: 'In a release build, this flag removes identifiers and replaces them ' | ||
| 'with randomized values for the purposes of source code obfuscation. The ' | ||
| 'mapping between the values and the original identifiers is stored the ' |
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.
is stored the -> is stored in the
| help: 'In a release build, this flag removes identifiers and replaces them ' | ||
| 'with randomized values for the purposes of source code obfuscation. The ' | ||
| 'mapping between the values and the original identifiers is stored the ' | ||
| 'symbol map created with the "--split-debug-info" option. For an app built ' |
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.
What happens when someone passes --obfuscate but not --split-debug-info?
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.
We don't output the obfuscation map. I think this is okay for now, since we don't actually have a tool to de-obfuscate a stack trace, only flutter symbols. I can document that this should always be combined with split-debug-info
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.
If it should always be paired with --split-debug-info then it would be good to give an error otherwise, or fill in a default value for it, I think.
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.
Updated so that obfuscate requires split-debug-info
|
@zanderso did you have any more comments on this? |
…utter into add_obfuscation_support
zanderso
left a comment
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.
lgtm
|
How can I use this feature? I think I'm not getting it correctly. |
|
@jonahwilliams Can you please share steps to execute this feature? No updated has been posted on guide. |
|
I've filled an issue to update the documentation: flutter/website#3827 I also tried to make the
|
Description
Previously Dart obfuscation was supported in a somewhat ad-hoc fashion via extra-gen-snapshot-args for Android and tool source code modification for iOS (see https://github.com/flutter/flutter/wiki/Obfuscating-Dart-Code )
This PR adds "complete" support by wiring it up through the existing build flags and infrastructure in a similar manner to the split-debug-info flag.
#50043
My understanding of the obfuscation map is that it would only be necessary if the
--obfuscateflag is not combined with the--split-debug-infooption. In that case, we might be able to simplify this a bit by constraining obfuscate to require split-debug-info. The user still only has to track one auxiliary file and we in turn simplify the supported configuration. @zanderso for thoughts on command line usability.