-
Notifications
You must be signed in to change notification settings - Fork 3
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
Proof of Concept Insights - lockdown() options #3
Comments
Can confirm we need this option ^ for general React Native debugging with stacktraces Following up latest RN PoCs
If we add custom error class class CustomError extends Error {
constructor(foo = 'bar', ...params) {
// Pass remaining arguments (including vendor specific ones) to parent constructor
super(...params);
// Maintains proper stack trace for where our error was thrown (only available on V8)
if (Error.captureStackTrace) {
Error.captureStackTrace(this, CustomError);
}
this.name = 'CustomError';
// Custom debugging information
this.foo = foo;
this.date = new Date();
}
} and create custom Button to trigger it <Button
title="Click to console.error class CustomError"
onPress={() => {
try {
throw new CustomError('baz', 'bazMessage');
} catch (e) {
console.error(e.name); // CustomError
console.error(e.foo); // baz
console.error(e.message); // bazMessage
console.error(e.stack); // stacktrace
}
}}
/> Giving below vanilla RN example
https://github.com/endojs/endo/blob/master/packages/ses/docs/reference.md#options-quick-reference
Our stacktace is now kaputt ❗ (above) as expected and all we see is Whereas We now have our full stacktrace back 🎉 traced to |
nb: While we're here, may be worth exploring our full suite of opts // node_modules/ses/types.d.ts
export interface LockdownOptions {
regExpTaming?: 'safe' | 'unsafe';
localeTaming?: 'safe' | 'unsafe';
consoleTaming?: 'safe' | 'unsafe';
errorTrapping?: 'platform' | 'exit' | 'abort' | 'report' | 'none';
unhandledRejectionTrapping?: 'report' | 'none';
errorTaming?: 'safe' | 'unsafe';
dateTaming?: 'safe' | 'unsafe'; // deprecated
mathTaming?: 'safe' | 'unsafe'; // deprecated
evalTaming?: 'safeEval' | 'unsafeEval' | 'noEval';
stackFiltering?: 'concise' | 'verbose';
overrideTaming?: 'moderate' | 'min' | 'severe';
overrideDebug?: Array<string>;
domainTaming?: 'safe' | 'unsafe';
} few mentioned once again in TBD from remaining metamask-mobile integration |
PoC
https://github.com/LavaMoat/docs/blob/main/react-native-and-ses-lockdown.md
Discussion
The SES function
lockdown()
is called with the following option:This option was added after the following report:
From Agoric the following advice
The text was updated successfully, but these errors were encountered: