Make telefuncs default safe?
See original GitHub issueReading https://telefunc.com/shield I am concerned that someone inevitably will forget to include a throw new Abort()
or a shield()
command, and thus expose functions that are dangerous.
How about making telefunc default safe / restrictive, and then only opening up based on an explicit whitelisting approach, instead of a blacklisting approach?
So instead of shield()
you could have unshield()
or expose()
, and similar for Abort.
All functions could throw new Abort()
abort by default, unless the context is set explicitly.
So instead of:
if( !context.user?.isAdmin ) {
throw new Abort()
}
const result = await database.runSQL(query)
return result
It could be something like:
if( context.user?.isAdmin ) {
const result = await database.runSQL(query)
return result
} else {
throw new Abort() // could be made default, so this else-condition would not be needed
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (10 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This means that our telefunctions are guaranteed to be secure (as long as our
permission()
function is correct).Thoughts?
I agree that’s a problem. It’s actually a problem with RPC in general.
Or something like this:
But the problem with that is that
allow()
cannot be called afterawait
:In JavaScript, async call stacks cannot be traced.