Fork me on GitHub
#off-topic
<
2023-01-24
>
Benjamin12:01:18

I once read something about how passing args to shell/sh or equivalent should not be done as string. For security reasons? But it seems like way less error prone also to not build a striing

Rupert (All Street)18:01:00

I guess the security angle of not generating a string is similar to SQL injection against string vs parameterised query. e.g. (shell/sh (str "bash -c \"" user-input " && ls \"") This code might be a problem if user-input is && rm -rf * (warning: don't try to run this!) You can always start off with a string and then edit it into args before production.

Benjamin18:01:12

ah yea totally stuff like this. In my example we ended up having a bug when you pass a string with ' then it counted as the next arg

đź‘Ť 2
pez16:01:40

Anyone knows if, in the browser, I can assume (js/Blob. chunks #js {:type "audio/mp3"}) will work in most browsers? Phones being the most important. And only browsers supporting recording via MediaDevices, which is what i am using.

delaguardo16:01:33

https://caniuse.com/blobbuilder ~98% of tracked mobile, I think it is alright

pez17:01:58

Thanks! I wonder also about the encoding. Like is audio/mp3 going to be supported broadly, or is there some safer ground I should take.

delaguardo17:01:05

I don't think Blob is doing any encoding at all. Maybe adds "audio/mp3" as a header? but idk

delaguardo17:01:58

yeah, https://w3c.github.io/FileAPI/#blob-section from here it is just immutable reference to byte sequence

pez17:01:01

That's interesting. I've been wondering when the encoding is determined. Here is seems stuff is happening based on that param: • https://w3c.github.io/FileAPI/#attributes-blob which references: • https://w3c.github.io/FileAPI/#blob-package-data I'm not very good at parsing formal descriptions like this...

moe23:01:09

I'm reading through "Types and Programming Languages" by Pierce, and plan to translate all of the OCaml implementations into Clojure, to make sure I understand them and can explain their behaviour. Here's the first https://github.com/moea/tapl-clojure/blob/main/src/tapl_clojure/arith.clj — if anyone wants to do a read-along (with like a weekly call to sync up, and a channel to gripe in, send me a PM).

moe23:01:51

I'm on a mission to gain a thorough knowledge of type systems / type theory, so this won't be the last time I spam about implementing stuff from a textbook