-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add symbols.unredact config variable #144
Conversation
`true` by default, it allows to retrieve the symbol name from the debug symbols (CoreSymbolication) when it’s “redacted” in apple’s dyld cache.
src/agent/config.js
Outdated
if (typeof (val) === 'boolean') { | ||
return true; | ||
} | ||
return ['true', 'false'].indexOf(val) !== -1; |
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 about return (/(true|false)/i).test(val);
so its case insensitive. Also, we have the isTrue() helper below
src/agent/index.js
Outdated
}) | ||
.join('\n'); | ||
} | ||
|
||
function sanitizeString (str) { | ||
const result = []; |
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 about using map/filter for this?
return str.split().map(_ => insaneSet.has(x)? c:'_').join('')
if (config.getBoolean('symbols.unredact') && sym.name.indexOf('redacted') !== -1) { | ||
const dbgSym = DebugSymbol.fromAddress(sym.address); | ||
if (dbgSym !== null) { | ||
sym.name = dbgSym.name; |
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.
uhm, when we find the symbol we dont need to continue searching , right? maybe good to use a for loop to break it here
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're not searching here, it's just iterating over all the results of enumerateSymbols
src/agent/index.js
Outdated
@@ -34,6 +34,7 @@ const allocPool = {}; | |||
const pendingCmds = {}; | |||
const pendingCmdSends = []; | |||
let sendingCommand = false; | |||
const insaneSet = new Set(['`', '$', '{', '}', '~', '|', ';', '#', '@', '&', '<', '>', ' ', '(', ')']); |
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.
a single string is probably faster imho. const specialChars = "`${}~|;#...".
and then use sspecialChars.indexOf(ch) !== -1
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.
.
src/agent/config.js
Outdated
@@ -8,7 +8,8 @@ const config = { | |||
'stalker.timeout': 5 * 60, | |||
'stalker.in': 'raw', | |||
'hook.backtrace': true, | |||
'hook.verbose': true | |||
'hook.verbose': true, | |||
'symbols.unredact': true |
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.
should be set to false outside iOS (and maybe macOS) too
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.
ohh ok
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.
.
true
by default, it allows to retrieve the symbol name from the debug symbols (CoreSymbolication) when it’s “redacted” in apple’s dyld cache.Also, while at it, added some sanitisation on flag names, to avoid accidental creation of garbage files and such.
Example: