Skip to content

Instantly share code, notes, and snippets.

@Supinic
Last active June 6, 2020 16:35
Show Gist options
  • Save Supinic/ad50d6643ebc27872f9ba3fbbf1826c6 to your computer and use it in GitHub Desktop.
Save Supinic/ad50d6643ebc27872f9ba3fbbf1826c6 to your computer and use it in GitHub Desktop.
Online storage of supibot commands: JSON vs JS
JSON
(+) respected format
(+) safe, no issues with evaluation
(+) easy to port around
(-) awkward to edit overall
(-) terrible to edit code
JS
(+) easy to understand
(+) easy to edit, intuitive
(-) looks sketchy at first glance
(-) possible to launch attacks by using malicious definition
ideas:
1) use both? - terrible for upkeep, edit 2 files every time
2) use JSON but split the function definition into an array of strings? sounds mega dank
3) try some magic with JSON storing/reviving functions
4) use JS but enforce some rules for the overall command code and the function code?
5) use esprima, and instead of command functions, share the ASTs
({
Name: "pipozdola",
Aliases: null,
Flags: [
"ping",
"pipe",
"skip-banphrase",
"system"
],
Description: "PIP OMEGALUL ZD OMEGALUL LA",
Cooldown: 10000,
Whitelist_Response: null,
Static_Data: null,
Code: async () => ({
reply: "https://pastebin.com/PzSHPzH0"
}),
Dynamic_Description: null,
Source: "supinic/supibot-sql"
})
{
"Name": "pipozdola",
"Aliases": null,
"Flags": [
"ping",
"pipe",
"skip-banphrase",
"system"
],
"Description": "PIP OMEGALUL ZD OMEGALUL LA",
"Cooldown": 10000,
"Whitelist_Response": null,
"Static_Data": null,
"Code": "async () => ({\n\treply: \"https://pastebin.com/PzSHPzH0\"\n})",
"Dynamic_Description": null,
"Source": "supinic/supibot-sql"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment