Rust Wont Save Us

Поділитися
Вставка
  • Опубліковано 17 лют 2024
  • Recorded live on twitch, GET IN
    / theprimeagen
    Become a backend engineer. Its my favorite site
    boot.dev/?promo=PRIMEYT
    This is also the best way to support me is to support yourself becoming a better backend engineer.
    Article link: glitchbyte.io/posts/rust-wont...
    By: x.com/0xglitchbyte?s=21&t=-sv...
    MY MAIN YT CHANNEL: Has well edited engineering videos
    / theprimeagen
    Discord
    / discord
    Have something for me to read or react to?: / theprimeagenreact
    Kinesis Advantage 360: bit.ly/Prime-Kinesis
    Hey I am sponsored by Turso, an edge database. I think they are pretty neet. Give them a try for free and if you want you can get a decent amount off (the free tier is the best (better than planetscale or any other))
    turso.tech/deeznuts
  • Наука та технологія

КОМЕНТАРІ • 283

  • @joshuachan6317
    @joshuachan6317 4 місяці тому +233

    TL;DR: If you are stupid, no tool in the world can save you.

    • @disguysn
      @disguysn 4 місяці тому +4

      The only fix for stupid is gatekeeping by smart.

    • @segueoyuri
      @segueoyuri 4 місяці тому +8

      exactly. Rust is not intended to fence stupid people away from their mistakes, it's intended to give C programmers a tool that helps them avoid one of the mistakes they can do accidentally.

    • @segueoyuri
      @segueoyuri 4 місяці тому +1

      @@disguysn not really

    • @werren894
      @werren894 4 місяці тому

      @@segueoyurimistake is accidental ret**ard maybe you mean it helps us to avoid the same boring mistake, rust is exist to replace cpp not C, C would not die because it never hype since the very beginning, ppl write C because they have no choice.

  • @thunder____
    @thunder____ 4 місяці тому +123

    On the topic of immutability by default, one reason why I think it's great is that it inherently gives you a heads up when something is immutable when it should be mutable because it will throw an error when you try to mutate that variable. On the contrary, when something is mutable when it should be immutable, it's much more difficult to detect. I haven't actually written any Rust myself yet, but immutability by default is one of the several language features that greatly interest me about the language.

    • @voidwalker7774
      @voidwalker7774 4 місяці тому +7

      Dude. The package manager. Think of the package manager.

    • @thewhitefalcon8539
      @thewhitefalcon8539 4 місяці тому +17

      Until you make everything mutable by default to make the compiler shut up. Alarm fatigue is real. If everything is a warning, nothing is a warning.

    • @Murukku47
      @Murukku47 4 місяці тому +1

      the automatic underlining for mutable variables and methods is a natural readability improvement for sure

    • @paladynee
      @paladynee 4 місяці тому +20

      rust warns you for making stuff mutable when you dont mutate them later.

    • @CaptainOachkatzl
      @CaptainOachkatzl 4 місяці тому +16

      @@thewhitefalcon8539 i've not seen a SINGLE rust code base where this is the case. that is literally a YOU issue.

  • @TheDoomerBlox
    @TheDoomerBlox 4 місяці тому +38

    26:29 - "C is best async lang. You just open new thread" GIGACHAD chat moment

    • @retropaganda8442
      @retropaganda8442 4 місяці тому +3

      setjmp/longjmp

    • @tapwater424
      @tapwater424 4 місяці тому +4

      ​@@khhnator Some problems are just asynchronous. If a network request takes 100 milliseconds it would be a colossal waste to have a thread do nothing while waiting. And using multi-threading here is analogous to hiring one restaurant waiter per customer.

    • @tapwater424
      @tapwater424 4 місяці тому +3

      ​@@khhnator Asynchronous-style code implements _concurrency._ Multi-threading is best suited for _parallelism._ Concurrency is not parallelism so you're comparing the number of bugs in two different domains of computing.

    • @segueoyuri
      @segueoyuri 4 місяці тому +2

      @@khhnator it must be fun to design software with you. In a single comment you managed to use both sentences "the difference between parallel and concurrent are not relevant to this discussion" and a few lines afterwards "it can get nasty when lots of threads might need to share memory" and "fearless concurrency baby".
      You have no idea what the concept of logical consistency means lmao

    • @segueoyuri
      @segueoyuri 4 місяці тому

      @@khhnator I'm not personally attacked at all. Don't know how you'd get to that conclusion. I'm just saying what you said has no internal coherence. Illogicality bugs me.
      Maybe you feel personally attacked because of what I say? Idk. Idc either. Try some coherence next time :)

  • @TheArgentan
    @TheArgentan 4 місяці тому +36

    > you can on average bring more developers from "javascript is the only thing that should ever exist" into "oh ok, I understand why we have static typed languages" using something like Go, than using something like Rust... if that makes sense.
    Yes. It does make sense. Lots of sense.

    • @segueoyuri
      @segueoyuri 4 місяці тому +9

      sorry pal. To me if programmers think javascript is the only thing that should ever exist, they are automatically dismissed by default. They are telling me already everything I need to know about them.

  • @huge_letters
    @huge_letters 4 місяці тому +13

    The OCaml feature you mention at 19:20 is "local mode" - it's not in the official compiler yet tho :)
    It's only in the Jane Street branch of the compiler, they're still working on it. But it's a cool idea regardless, yeah

  • @RWAKitty
    @RWAKitty 4 місяці тому +5

    I gotta say, when I started programming Rust I didn't like having to opt in to mutability. Now that I'm used to it though, I love it. And the REASON I love it is because every time my code doesn't work and it says I need to make some variable mut, I stop and ask myself WHY I'm mutating this variable. Do I NEED to do that? What ramifications will this have up the chain?
    99% of the time it's fine and I just mark it mut, but just having the compiler force me to ask myself these questions is great imo.

  • @colinmaharaj
    @colinmaharaj 4 місяці тому +11

    Before hearing about rust, I was using a Borland C++ compiler, when I updated my tool chain, I got an LLVM/CLANG compiler instead, and this was with embarcadero.
    It was like chalk and cheese, the LLVM implementation was amazingly better at picking up tiny/subtle errors in your code that will compile.
    I always thought that if those people behind the LLVM, or clang tool chain, continue doing their thing, then C++ would eventually turn out to be a safe language.
    Even so, I have some very good lint tools, and run time tools, that makes it very difficult for bugs to pass by me.
    I am not sure if moving to rust makes you no longer necessary to test code but I can't see myself not testing my code both static and runtime

    • @Spartan322
      @Spartan322 4 місяці тому +3

      Honestly with C++20 and C++23, even going back to C++17, its already immensely safe, if you don't use stick to the C way of doing things, it pretty much solves the same problems as Rust without forcing you into a paradigm that has you wrestling with the borrow checker or the language in general.

    • @b1ueocean
      @b1ueocean 4 місяці тому +5

      Borland died as a company decades ago I thought. I learnt C/C++ in Borland Turbo C back in 1993.
      As for Rust lol good luck with that passing fad folks. My new startup is C/C++ first and that's after doing Java in industry for 20 years straight.
      These developers pushing Cloud and Microservices first have hopped onto the Rust train.
      Again - good luck.
      My type safe and memory safe C/C++ with no exceptions or ego-driven metaprogramming templates in sight is doing over 100k requests and response per CPU core 😂
      We don't need critical codebases polluted with Rust - we just need better programmers that understand the fundamentals.
      Looking forward to providing a home at my startup for C/C++ devs needing to avoid managers and companies pushing Rust 😊
      It'll be Google's Carbon next and then the next thing. By the time developers get around to actually delivering commercial products and notable commercial value - AI will be replacing them 😂

    • @FlanPoirot
      @FlanPoirot 4 місяці тому +4

      ​@@b1ueoceanare u ok, lil bro?

    • @b1ueocean
      @b1ueocean 4 місяці тому

      @@FlanPoirot no one in this industry is “ok” until we reverse the litany of missteps destroying it from within.
      Maybe the accelerated pace of layoffs due this year and the prominent companies that begin abandoning the cloud will help folks begin to get the message 🤷‍♂️
      Other than being forced to witness the madness - I’m good 👍

    • @khhnator
      @khhnator 4 місяці тому +1

      ​@@b1ueocean wtf? it is a programming language bro. not... whatever you think it is

  • @axelfoley133
    @axelfoley133 4 місяці тому +18

    Primeagen: "[Not having null] is something I wish we had more of."
    Me: "So what you're saying is we need more less nothing?"
    Ron Burgunudy: "That doesn't make sense."

  • @retropaganda8442
    @retropaganda8442 4 місяці тому +12

    The private/public language-level accessor argument is pointless on two levels:
    1) Anyone can call a function as long as it's in the symbol table: you can bypass the language restrictions.
    2) The presence of a function in a library isn't a security threat per se, it's the fault of an application if it adds ways to make it callable via another process or network connection, which doesn't happen magically.

    • @ea_naseer
      @ea_naseer 4 місяці тому +1

      aren't symbol tables for the compiler only? does it exist during run time

    • @ruroruro
      @ruroruro 4 місяці тому +10

      @@ea_naseer even if the symbol table doesn't exist, you can still just jmp to the address of the function or modify the "private" struct fields yourself by just writing to a known offset. Function visibility is only a security concern if someone on your team is stupid enough to automatically expose all public functions as external endpoints. The moment when the attacker can execute arbitrary public functions in your codebase, you've already lost.

  • @freeideas
    @freeideas 4 місяці тому +15

    If you think declaring a method public makes it available for hackers to call, or that declaring a method private prevents hackers from calling it, you are badly mistaken. Those keywords are for the design of your code, they do not have any special powers. I call private methods from libraries all the time.

    • @XxZeldaxXXxLinkxX
      @XxZeldaxXXxLinkxX 4 місяці тому +1

      What's your background in development and security?
      Because yeah, it changes the design of your code, which is what's running.
      The point of setting it to private is to reduce the attack surface. If you gain access to an object, you can't access the children's private functions or whatever.
      Also I don't know what you mean by calling private languages from libraries. Are you using python? Typical true private functions can't be invoked anywhere except from within the object or struct method definitions itself

    • @RogerValor
      @RogerValor 4 місяці тому +9

      @@XxZeldaxXXxLinkxX this always sounded very theoretical to me as well, to be honest. it seems quite strange to think of public and private as security measures, and it has nothing to do with python to think so, it has everything to do with the fact, that if i access your code at compile time, i could do anything anyway, and if i access your code at runtime from memory, your public/private declarations wont help you.
      It might make sense in plugins in dynamic dlls that get access to objects, or some dynamic api solutions, where you can define calls with strings, java network objects or similar, but then it becomes an architectural question again.
      Not saying that making things public in any layer could not lead to problems, so probably that is what you mean with reducing attack surface, but I think securing functions means more than just the keywords overall. Except maybe in a full SOAP world.

    • @ITSecNEO
      @ITSecNEO 4 місяці тому

      ​@@XxZeldaxXXxLinkxXPrivate and Public has nothing to do with Security. Its just a nice way to Not expose every functionality to the user. In C f.ex you can also hide functions, like openssl does, but the users can modify the lib to expose the function again. So no security

    • @freeideas
      @freeideas 4 місяці тому

      @@XxZeldaxXXxLinkxX I have called private methods in java .class files many times. Sometimes you have to use reflection to make the method accessible, and there are ways to make this more difficult, but there are ways to defeat that also. And with C/C++/and Rust in unsafe mode, you can jump into any section of any code you want. And, right, @RogerValor, with python and javascript, the idea of "private" is just a suggestion. Seems to me that making methods private is not really about security.

    • @ruroruro
      @ruroruro 4 місяці тому +12

      @@XxZeldaxXXxLinkxX no private function visibility doesn't reduce the attack surface (or at least I don't know of any language in which it does). In high level languages you can call private functions via reflection, in low level languages you can call private functions via even lower level trickery such as hand written assembly, invoking undefined behaviour etc.
      Function visibility CAN'T be about the attack surface, because if the attacker is capable of invoking arbitrary functions in your code (public or private) then you are royally f***ed anyway.

  • @MadaraUchihaSecondRikudo
    @MadaraUchihaSecondRikudo 4 місяці тому +25

    But.... but.... function visibility has very little to do with actual security... it's about logic encapsulation and minimizing the API surface more for readability... There's no actual safety in declaring something as private (and in fact, an attacker with JAR/DLL access can just call it anyway using reflection). That function visibility example is utterly useless...

    • @retropaganda8442
      @retropaganda8442 4 місяці тому +7

      Exactly, I stopped watching at that point. The author's FIRST argument: FAILED.

    • @doc8527
      @doc8527 4 місяці тому +4

      I was so so so confusing while reading the article. From a package level, the function visibility for me is to let users not call the wrong functions from my libs by not exposing them, but they can still modify that package code to make it public.
      And that's it. it has nothing to do with the real security by any means. The real security is done via API level access, a service level where they can't modify my code. If you expose your function code as the service and people can eval the function from the same code level as you directly. I think the author has some huge misunderstanding on security....

    • @Someone-uo8jc
      @Someone-uo8jc 4 місяці тому

      The whole article is pure crap. Honestly

  • @orterves
    @orterves 4 місяці тому +14

    7:30 Java has reflection right? What does public/private have to do with it?

    • @Spartan322
      @Spartan322 4 місяці тому +3

      I guess you can restrict access to the reflection system, but that requires more work and almost nobody actually does it.

  • @Ryan-in3ot
    @Ryan-in3ot 4 місяці тому +56

    Rust cant save you from skill issue syndrome

    • @b1ueocean
      @b1ueocean 4 місяці тому

      Thanks for speaking on the real issue - SKILLS 👍

  • @SimGunther
    @SimGunther 4 місяці тому +36

    Only society can save itself not just with better tools, but with better wisdom. Yet it chooses not to do so because it doesn't see an immediate ROI with better wisdom, but there's an immediate stonk feedback for laying off wisdom that made the product.

    • @ea_naseer
      @ea_naseer 4 місяці тому

      We should have had ALGOL 60 instead of Fortran.

    • @SimGunther
      @SimGunther 4 місяці тому +1

      ​@@ea_naseer Original source for this industry-wide mistake or some famous engineer that wanted us to use ALGOL60 instead of Fortran-like languages?

    • @thapr0digy
      @thapr0digy 4 місяці тому

      Society can't save itself because we have all been born into sin. We're all morally bad. You can test yourself using God's moral law, the Ten Commandments. We've all broken the law, but Jesus paid the fine. That's why on the cross his last words were "It is finished."

  • @blackhole1376
    @blackhole1376 4 місяці тому +14

    He's so proud of almost shutting down netflix 💀💀💀

    • @CoolestPossibleName
      @CoolestPossibleName 4 місяці тому +1

      I can only wish to have such power

    • @Michallote
      @Michallote 4 місяці тому +1

      I think it's great to see people acknowledging things and also focusing on learning of it rather than ego

  • @user-wx6vs2xl1g
    @user-wx6vs2xl1g 4 місяці тому +39

    Rust won’t save us, but HolyC will

  • @kahnfatman
    @kahnfatman 4 місяці тому +3

    I like your take on skill-issues across the board -- regardless of which framework, language, methodology -- if the team is mid, the product is mid.

  • @lcarsos
    @lcarsos 4 місяці тому +12

    private by default won't save anyone ever. If someone thinks it needs to be public, they'll just make it public. That's why people type `public void foo` instead of `private void foo` from muscle memory.
    immutable by default won't save anyone ever. If someone comes across a case where a thing needs to be mutated, they'll make a new object with the thing set to the new state.
    OOPs encapsulation techniques are not security features. They're encapsulation techniques. Don't let security "experts" tell you otherwise.
    Having setters is not a security vulnerability. Don't let security "experts" tell you otherwise.
    Having a DB object that has a dropDatabase function that you can call isn't a security vulnerability. Even if it was private, there was someway to get that function to be called.
    That Confluence bug was because any-bloody-one could set an admin flag through the URL. Not because you can instantiate a class that inherits from somewhere that has a field that can be set.
    That ASPX bug was because someone custom wrote their own header parsing, not because they had a header.
    I'm so sick of "security experts" coming in from literally nowhere acting big brain and holier than thou with these shit programming takes. No offense to this ghostbyte person. All of the "vulnerabilities" showcased didn't need to not exist, they needed to be behind another layer of defense. I bet that's how Atlassian fixed the confluence bug, instead of changing their inheritance hierarchy.

    • @chris-pee
      @chris-pee 4 місяці тому +4

      I like how the author noted that (s)he worked in cybersecurity for almost 10 years. Makes you think.

    • @simm0l
      @simm0l 4 місяці тому +2

      Well said. The moment I heard that discussion around the public/private thing I was like: "Wait what, which sane developer allows API calls to execute arbitrary code on his system(so you can exploit private vs public). This is so much API design/security and not language issue:"
      And i had same argument with people hating on Python not having private methods and not being compiled (like compoling something had ever stop any hacker :D ) as not being secure enough...
      Secure what need to be secured: Access points.

  • @OREYG
    @OREYG 4 місяці тому +5

    class visibility is not a security feature...

  • @DylanMatthewTurner
    @DylanMatthewTurner 4 місяці тому +8

    I'm not on the Rust hype train bc of what problems Rust solves the best but bc it's the nicest language and environment to program in.
    Most of the other languages suck one way or another. Rust has the beautiful type system of Haskell, the power of C, the modern features of Python or C# or whatnot, and the best build system on planet Earth. It just does everything well.
    So what if it won't magically fix all problems? It's still the most enjoyable problem solving experience.

    • @retropaganda8442
      @retropaganda8442 4 місяці тому +2

      best build system, not. it's unoptimised.

    • @DylanMatthewTurner
      @DylanMatthewTurner 4 місяці тому

      @@retropaganda8442 I'm not familiar with any better ones

    • @ea_naseer
      @ea_naseer 4 місяці тому

      ​@@retropaganda8442best as used here is ambiguous and relative. best for me would mean easy to set up relative to something like ghcup for Haskell.

    • @Spartan322
      @Spartan322 4 місяці тому +1

      I still don't see Rust's borrow checker solving any problems that RAII in C++ didn't solve better. Could've overhauled the concept of RAII instead, the borrow check is simply the worst choice, especially in claiming to be simple, its only "simple" when you don't come against something that makes you have to think about it, systematically RAII is a lot simpler and easier to wrap your head around, and if you want to violate it, you can do so without breaking the language.

    • @ITSecNEO
      @ITSecNEO 4 місяці тому +2

      ​@@Spartan322If you are not able to understand the borrow Checker dont blame the language lol, its YOU not the language. The borrow checker is only hard in the first days with Rust, after that you do everything automatically correct. Its really easy. The Rust Compiler gives the best help anyone can wish for. And If you are not able to learn a new paradigm quite easily, you should not be a programmer in the first place.

  • @bobanmilisavljevic7857
    @bobanmilisavljevic7857 4 місяці тому +21

    Im learning rust and c at the same time. Trying to get old school new school yin yang interaction going

    • @knolljo
      @knolljo 4 місяці тому +1

      How has it been so far?

    • @bobanmilisavljevic7857
      @bobanmilisavljevic7857 4 місяці тому +4

      @@knolljo well I started programming through python so there is some little things I have to get used to adding in and wrapping my head around some new concepts, but so far I enjoy it. Definitely a lot more curly brackets in my life

    • @bobanmilisavljevic7857
      @bobanmilisavljevic7857 4 місяці тому

      @@knolljo also, it's been so nice being able to write python, rust and c code with termux on Android and see how it compares to using the Linux command line. So far all three work really good right on a smart phone

    • @nitroflap
      @nitroflap 4 місяці тому

      ​@@bobanmilisavljevic7857I'd personally recommend leaning into C first, if you're *just* starting out. Gives you a more solid understanding of program "internals", since you have very little to no abstractions and get to work with raw memory.

    • @segueoyuri
      @segueoyuri 4 місяці тому +4

      If I may I'd suggest you to see C first, properly. Just C. Learn it properly. It can do functional, it can do pointers, it can do pretty much everything. Build a C compiler in C, knowing the concepts involved thoroughly. Then you learn Rust.
      Programming gets easier if you look at everything through the eyes of a C programmer. Pretty much every language "inventor" knew C and made it's language features in relation to something C programmers have seen before or deal with. Python is to programming what Javascript is to web-programming - something that was never intended to do what it's currently doing so it's monstrously distorted. Just leave those alone.
      You may think "oh but I'm fine learning both at the same time, I'm so smart! I'm saving time actually!" no you're not. You're hindering yourself. You learn both better if you learn them one at the time (C first then Rust). It's better if you focus in C and learn it properly and then you'll see how the concepts you've seen are implemented in Rust and which C shortcomings Rust has fixed. If you are smart, great! You'll need less time to absorb all the concepts thoroughly :)

  • @connormc711
    @connormc711 4 місяці тому +4

    Are you gonna write drop database in your Turso project

  • @mmmhorsesteaks
    @mmmhorsesteaks 4 місяці тому +4

    We're in the horrizone!

  • @wwklnd
    @wwklnd 4 місяці тому +1

    2:45 lol a few years ago (2020 I believe) a representative of one of Sweden's largest political parties was talking about cybersecurity on TV ahead of the election, and on the wall behind him was a sheet of paper with the SSID and password for the wi-fi at their HQ. Swedish public service TV ended up taking down the clip and reposting it with the info blurred after people made fun of it a ton online, lol.

  • @rawallon
    @rawallon 4 місяці тому

    Article: 9 min read. Prime: Hold my bear

  • @ArgieSombro
    @ArgieSombro 4 місяці тому

    In java you can use reflection to at runtime change a private function public and call it

  • @korvmakak7727
    @korvmakak7727 4 місяці тому +2

    I like c++. (But yeah, const default would be nice)

  • @doomguy6296
    @doomguy6296 4 місяці тому

    You don't use unwrap or expect in production, unless during initialization. And unlike nulls, unwrap/expect do not surprise you. It's an explicit crash. Meaning it has to be put on purpose and could be looked for during text search in your code

  • @segueoyuri
    @segueoyuri 4 місяці тому +1

    the beautiful thing about computing is that most computing problems (and solutions) relate to life in general. The problem about language safety has nothing to do with the language itself - it has to do with the programmer. Isn't the industry dominated by Javascript, that tool forged in Hell by S4tan himself? You just cannot put enough fences around stupid people. They'll always find a way to be stupid and abuse/misuse tools. And there always be predators looking to prey upon the weaker amongst the flock.
    Rust is not intended to be "stupid-proof". You can abuse it still. It's intended to make it harder for you to *accidentally* make a mistake and make something stupid *in C*. And it does that well.

  • @somcho
    @somcho 4 місяці тому

    25:31 where can I find the "New Rust Async" book?

  • @cat-.-
    @cat-.- 4 місяці тому

    “For security to work it has to be baked in from the start”
    Is what exactly rust does

  • @TheLummen.
    @TheLummen. 4 місяці тому +1

    Repulsive Grizzly !
    Amazing !

  • @monad_tcp
    @monad_tcp 4 місяці тому

    19:22 yeah OCaml !!!

  • @foji-video
    @foji-video 4 місяці тому +3

    All true until you write unsafe somewhere. Then everything goes out of the window.
    Even if you dont use unsafe, there are decent chances some of your dependencies do

    • @ITSecNEO
      @ITSecNEO 4 місяці тому

      Unsafe doesnt mean unsafe lol. This is the most common misunderstanding lol. Its nothing wrong with using unsafe

    • @foji-video
      @foji-video 4 місяці тому

      @@ITSecNEO nothing wrong per se, yes, but that piece of code have basically the same memory unsafe-ties that writing C o C++.
      Which is the whole point

    • @ITSecNEO
      @ITSecNEO 4 місяці тому

      @@foji-video Again, nope, Please look that section Up in the Rust Book. Not everything is allowed in a unsafe Block :)

  • @RandomGeometryDashStuff
    @RandomGeometryDashStuff 4 місяці тому

    23:08 what kind of device you need to touch sawblade to turn it off!?

  • @tears_falling
    @tears_falling 4 місяці тому +1

    i think elixir is the best for async

  • @RandomGeometryDashStuff
    @RandomGeometryDashStuff 4 місяці тому

    24:45 it's hard for me to parse rust and c++ code to ast inside head so I don't know what kind to thing I don't know

  • @laifsyn5347
    @laifsyn5347 4 місяці тому

    8:49 is the risk still relevant even if you do `pub(crate)`?

  • @AllanSavolainen
    @AllanSavolainen 4 місяці тому +5

    I like static typed languages for just about all but web development. Once we pass JSON and user form data around, I really prefer to manupulate it with PHP. I just assume that all data is strings and tainted and cast it when it needs to interact with internal things.

    • @Luxalpa
      @Luxalpa 4 місяці тому

      Meanwhile in Rust I just parse it into a real object that doesn't have strings and can just use it wherever without any of those extras.

    • @AllanSavolainen
      @AllanSavolainen 4 місяці тому

      @@Luxalpa can you? But any record you use can be of any type, isn't that a problem?

    • @ascascsacsdvdsvasd
      @ascascsacsdvdsvasd 4 місяці тому

      ​@@AllanSavolainenyou just add #[derive(Deserialize) and boom you can turn json to that struct with serde json

    • @AllanSavolainen
      @AllanSavolainen 4 місяці тому +1

      @@Luxalpa Also, with PHP I can just parse JSON into an object or array (hashmap) without any external libs. Rust probably needs some dependancy.
      But my major reason liking PHP here is the fact that I don't have to care if the JSON has 3 or "3" in the field, it just works. And yes yes, there are API definitions that say the field should be number or string, but oh so very often clients or servers send/return random types.

  • @crissdell
    @crissdell 4 місяці тому

    IEF can be fixed with rust, with public and private functions?

    • @Spartan322
      @Spartan322 4 місяці тому +3

      public and private functions have nothing to do with security, that's purely about API encapsulation, even if they're private you can still call them

  • @rosehogenson1398
    @rosehogenson1398 4 місяці тому +7

    Am i missing something, or do public/private modifiers have nothing to do with an insecure exposed function vulnerability?
    For IEF you have to expose the function to the outside world, like through an HTTP API. Just marking something as public only exposes it within the current code base, which is not the "outside world"

    • @101Mant
      @101Mant 4 місяці тому +4

      I think you are right, it's a compile time protection code that calls private functions doesn't compile is all. There are still ways to call it at runtime.

    • @rosehogenson1398
      @rosehogenson1398 4 місяці тому

      @@alirigol6707 Java moment

    • @ascascsacsdvdsvasd
      @ascascsacsdvdsvasd 4 місяці тому

      ​@@alirigol6707can you explain to me how you can call a method with a string in a statically typed language?

    • @DobesVandermeer
      @DobesVandermeer 4 місяці тому +5

      The real problem in the example was an HTTP API that uses reflection to expose all public getters and setters. Maybe it's impossible to do that in Rust so that could be a benefit of Rust. But reflection does come in handy in many other cases.

    • @XxZeldaxXXxLinkxX
      @XxZeldaxXXxLinkxX 4 місяці тому

      Exposes it in the codebase, but it also means should an attacker gain access to to some sort of scope, they will be blocked from expanding that scope to private functions. Security is all about baby steps in escalating.

  • @ClaudioBrogliato
    @ClaudioBrogliato 4 місяці тому

    16:54 someone had to say it. I guess the problem is that in the years many gave null a meaning, so in order to get rid of null you have to manage what null has been used for (aka nullable boolean fields? evil).

    • @somnolence5339
      @somnolence5339 4 місяці тому +1

      > aka nullable boolean fields
      Well tri-state checkbox is a thing :D

  • @ColinTimmins
    @ColinTimmins 4 місяці тому

    Why would I want a crab to shave me?

  • @SandraWantsCoke
    @SandraWantsCoke 3 місяці тому

    Who else thinks there will be another language that will eventually replace rust? It will have many of the benefits, like immutability, Options, Error handling, Enums, but will be simpler to read, compile and run like Go.

  • @mrsparky4961
    @mrsparky4961 4 місяці тому

    Imma feed you to the sigma

  • @SamualN
    @SamualN 4 місяці тому +1

    27:01 why does prime give people like that so much attention?

  • @doomguy6296
    @doomguy6296 4 місяці тому

    I dare the author to write a role based system in Rust, using type-state or witness design patterns and then make that claim. The Rust type system can be used to save us, so the bold statement "can't" is false.
    Of course that not utilizing the language intelligently when using it's features, would not save you. But compare to other language, you have a lot more to utilize for the safety parts

  • @nyahhbinghi
    @nyahhbinghi 4 місяці тому

    G L E A M L A N G

  • @fuseblower8128
    @fuseblower8128 4 місяці тому +2

    Weak encryption? Don't tell me they cracked ROT13 already!

  • @15xv
    @15xv 4 місяці тому

    22:25 true

  • @SuliXbr
    @SuliXbr 4 місяці тому

    I was taught to pronounce IOCTLs as Eye-octals

  • @user-hp6gf7lu8c
    @user-hp6gf7lu8c 4 місяці тому +10

    In 2040, people are still coding in Java and still it's a mainstream language.
    Though many fast languages evolved in last 20 years, like go/rust/mojo/mojo++/Microsoft's copy lang C##/etc.
    But they are too fast to handle for human. That's why people left them and again started using Java.
    Also, the trending of superfast language has been banned, because many developers have become TikToker, due to short and superfast productivity mindset.

    • @voidwalker7774
      @voidwalker7774 4 місяці тому +5

      As an AI Prompt Engenier i call skill issues. Wit the right key words my mojo++ code is flawless.

  • @K9Megahertz
    @K9Megahertz 4 місяці тому

    I personally would never write a function/method to drop a database. That is something you would want to manually login and do. Just as I have decided to never write a pipeline that would call terraform destroy. You just don't do it.

  • @thingsiplay
    @thingsiplay 4 місяці тому +1

    I don't understand article when they do a full paragraph for every single sentence.

  • @asdfqwerty14587
    @asdfqwerty14587 4 місяці тому

    I don't really like the DropDatabase example - if someone is actually writing code using that package and running it, then it means they already have access to the database credentials in some form or another.. if they want to drop the database, then making the function private will not stop them at all. It might be a good idea to make it private to try to reduce user error, but that's not really a security issue - if it being public is a security issue, then you always have bigger security issues.

  • @0xCAFEF00D
    @0xCAFEF00D 4 місяці тому +11

    0:10
    I think Rust has got to have the most aggressive programming language community. I can't think of any language with such a frequent hostile appearance. And quantity of drama is also a measure I'm sure. Individuals have been awful in other languages. But the amount of shit anyone who suggests flaws with Rust get is incredible.
    I'm not sure I understand why, maybe it's that Rust is a very significant time investment to learn well and critics are seen to threaten that investment. I don't agree with that perspective. Good critics are very important for the improvement of anything. C++ programmers should be in that same position. But at the same time who could be a passionate defender of a language like C++? 😂
    If I'm right with the investment argument this blogpost is really a massive sore point.
    I browsed HN. So much hate. But in fairness to them a lot of it picked on one particular example that was apparently fixed. I think the accusation that the article is deceptive/dishonest is just silly.

    • @deistormmods
      @deistormmods 4 місяці тому +8

      The people that use Rust tend to be anti social. They don't really know how to communicate or speak to other people. I would know I write Rust.

    • @perc-ai
      @perc-ai 4 місяці тому +3

      Rust developers have higher IQ prob on the spectrum

    • @deistormmods
      @deistormmods 4 місяці тому

      Yeah that too 100%. @@perc-ai

    • @pluto8404
      @pluto8404 4 місяці тому +2

      ​@deistormmods or is that those people dont know how to communicate with us crab people 🦀clickity clack 🦀clicky clack clack 🦀🦀🦀

    • @sirhenrystalwart8303
      @sirhenrystalwart8303 4 місяці тому

      I mostly agree. Julia devs give the rust zealots a run for their money though.

  • @chris.dillon
    @chris.dillon 4 місяці тому

    Yeah, I agree on that last bit about bringing TS (or whatever) devs over. I spent about 4 years having Go be my main language. I've been on a 2 year journey at Rust and although it has gone quicker, I think: "are other people really going to do this too?". I'm not an island. :\

    • @123mrfarid
      @123mrfarid 4 місяці тому

      Why did you move from Go to Rust?

  • @Expox
    @Expox 4 місяці тому

    It's been 6 months since I started studying Java, it's been 6 months since I started watching this channel, and every time I watch a video from this channel, it makes me think I made a bad decision

    • @NibbleMeTwice
      @NibbleMeTwice 4 місяці тому +3

      Don't think that way. Prime himself has used Java. Java is a very popular language, and it's simple enough to learn that you can go into depth with it and safely take those skills into a new language. A lot of fundamentals teach themselves to you and you can feel comfortable writing it. Lotta frameworks for different platforms. Java is a good time. It does suffer from certain characteristics, like verbosity and extremist OOP. But you won't go wrong with using Java, and since you've been using it for 6 months, you're already likely advanced enough to move on to another language without losing those idioms. Was Java your first language?

    • @Expox
      @Expox Місяць тому

      ​@@NibbleMeTwice Sorry for the delay, for some reason I didn't receive the notification. Regarding Java being my first language, kind of. It wasn't the language in which I learned the basics of programming (booleans, double, if/else, etc.), but it was the first one I committed to understanding more deeply at a professional level.
      Additionally, thank you for the encouragement

  • @shavais33
    @shavais33 3 місяці тому

    re: "why opt into mutating?" (as opposed to opting into const-ing.) If you write modern C++, and follow "best practices," you're typing const for practically every variable, every parameter, lots of functions, it's silly. And you're probably doing it twice because of the freaking headers, unless you're writing header-only stuff or using C++20 modules. So Rust just makes everything immutable by default. Good plan. Saves typing.

  • @solitary200
    @solitary200 4 місяці тому +1

    Rust has its space, but I don’t think it’s the best language for MOST software.

  • @tokiomutex4148
    @tokiomutex4148 4 місяці тому

    You won
    escape mutexes

  • @d3stinYwOw
    @d3stinYwOw 4 місяці тому

    Sounds like Nim lang to me, with borrow checker added :D
    Eventually everybody switch to OCaml. :v

  • @joseoncrack
    @joseoncrack 3 місяці тому

    How much do we get per 1000 occurences of the word "Rust"? Asking for a friend who's looking for a side hustle.

  • @kwaleyelamusilizoikafa6197
    @kwaleyelamusilizoikafa6197 4 місяці тому

    Great now I'll never pronounce SQL the same

  • @shavais33
    @shavais33 3 місяці тому

    I'm trying to imagine the context in which a public function would be available to a hacker while a private one wouldn't. Your program would have to somehow be running in some kind of permissions context that the hacker wouldn't otherwise have. What did you do, sticky-bit your program and auto-generate a web service from your public interface or something? And you never, like, glanced over the manifest and noticed the "DropDatabase" function? Yeah, I dunno. I think the right answer there isn't to force all devs to never make public functions that shouldn't be accessible to hackers. That's just not really tenable. I think maybe a better plan might be to have super clear delineations around things like *what programs are going behind auto-gen'd web services.*

  • @RandomGeometryDashStuff
    @RandomGeometryDashStuff 4 місяці тому +2

    10:04 why can you call arbitrary public method by http(s) request!?

  • @The1RandomFool
    @The1RandomFool 4 місяці тому +4

    I'm curious why Zig has null instead of none, as null can only be used on an option anyway. My guess is for C library compatibility.

    • @thewhitefalcon8539
      @thewhitefalcon8539 4 місяці тому +1

      Why change things that aren't broken? You might as well ask why rust has curly braces instead of begin/end.

    • @arnontzori
      @arnontzori 4 місяці тому +1

      There's no issue with null itself, it's how the language handles it that matters. Zig forces you to handle nulls and catch errors at compile time, I don't think rust's approach is inherently better

    • @erickhoward5699
      @erickhoward5699 4 місяці тому +2

      ​@@arnontzoriIMO "Rust's" solution is better, as it allows for the use of "monadic operations", as C++ 23 proposals put them. Essentially, although I see that zig has some sort of version of `Option::map`, it doesn't have anything like `Option::and_then`, etc, which are really useful in highly functional code.

    • @The1RandomFool
      @The1RandomFool 4 місяці тому +2

      @@thewhitefalcon8539Using that logic, the majority of languages wouldn't exist.

    • @thewhitefalcon8539
      @thewhitefalcon8539 4 місяці тому

      @@The1RandomFool using my logic, the majority of languages would have curly braces. Oh wait, they do.

  • @XiremaXesirin
    @XiremaXesirin 4 місяці тому +2

    I will say, on the topic of Immutability by Default: I think Herb Sutter has it right with his CppFront project, where the programmer gets the choice of whether to have immutability by default or not on a scope level rather than it being declared from on high by the language designers. He did make Immutability the absolute default, but the programmer has the ability to say "for this part of code, I want mutability by default instead", which I think is really neat.
    I think if, as a language designer, you're *forced* to choose one, it makes sense to choose Immutability by Default rather than the opposite, but I also have a lot of experience working contexts where being forced to explicitly declare every single variable as non-const would degrade productivity really badly.

    • @Spartan322
      @Spartan322 4 місяці тому

      Its just generally better to give choice to developers then to restrict their choice so long as it does not come at the cost of something else, and the developer should be able to build choices into their systems without restriction instead. Taking choices away is not a good enough and its the paradigm obsession of modern languages that actually frustrates the hell out of me.

  • @ovalteen4404
    @ovalteen4404 4 місяці тому

    Wait... I thought the definition of "variable" was something that can "vary" or "mutate".... If you want a placeholder constant, call it that instead.

  • @soniablanche5672
    @soniablanche5672 4 місяці тому

    pretty sure "drop database" doesn't exist in sqlite, a database in sqlite is a file.

  • @retropaganda8442
    @retropaganda8442 4 місяці тому +1

    19:54 It's perfect to pronounce horizon like you and the majority of european languages do. English is the black duck, segregated away from the rest of us, alone on its island.

  • @doomguy6296
    @doomguy6296 4 місяці тому

    Either way, I get the vibe the author knows only some Rust. 'Cause how can you be Rust proficient and not know about 'pub(crate)'?

  • @Daniel_Zhu_a6f
    @Daniel_Zhu_a6f 4 місяці тому +1

    why are private methods safer by default? this doesn't sound right...

  • @shellderp
    @shellderp 4 місяці тому

    "Extracting nulls" is not much of a tradeoff imo, because in a language with non-nullable types, 99% of the time a value simply can't be null and there's no need to check. You're only checking in the cases where explicitly a value can be null. In a language that doesn't support non-nullable types, you never know if the value you received from a method call can be null and either have to always check or keep it in your head, adding to mental load.

  • @SuliXbr
    @SuliXbr 4 місяці тому

    SQL is sequel no squill ....

  • @Ic3q4
    @Ic3q4 4 місяці тому

    bro forgot that windows just announced many things will be redone in rust :3

  • @thekwoka4707
    @thekwoka4707 4 місяці тому +2

    Typescript is both statically typed and dynamically typed.

    • @linkernick5379
      @linkernick5379 4 місяці тому +1

      Wat?

    • @XxZeldaxXXxLinkxX
      @XxZeldaxXXxLinkxX 4 місяці тому +3

      No, it's statically typed. What you're looking for is that it's weakly typed

  •  4 місяці тому

    Insecure Exposed Function? Nowadays that just means API.

  • @ruroruro
    @ruroruro 4 місяці тому +3

    Wtf is this article talking about. Default function visibility doesn't have anything to do with security. It doesn't matter if your function is marked public or private. If a malicious actor can arbitrarily choose to execute any public function they want, then you are f***ed either way. The only case where function visibility matters is if you are automatically generating external endpoints based on the function visibility, which is extremely rare in static languages and should be only done on classes/objects/modules that are specifically designated as external API surfaces.

  • @BExploit
    @BExploit 4 місяці тому +346

    Rust won’t, but Jesus does

    • @defeqel6537
      @defeqel6537 4 місяці тому +45

      What are the semantics of Jesus?

    • @manacht2727
      @manacht2727 4 місяці тому +101

      Is Jesus a garbage collector language?

    • @pierreollivier1
      @pierreollivier1 4 місяці тому +15

      @@manacht2727 obviously not or I wouldn't have to read your comment (joking you gave me the stick I had to)

    • @gabereiser
      @gabereiser 4 місяці тому +27

      Jesus still panics…

    • @johnwu5908
      @johnwu5908 4 місяці тому +38

      Collects after three days

  • @crimiusXIII
    @crimiusXIII 4 місяці тому +1

    ...Are you serious?

  • @canadianblitz3468
    @canadianblitz3468 4 місяці тому

    I've heard Jesus didn't make mistakes.

  • @richardvonlehe4581
    @richardvonlehe4581 4 місяці тому

    IOCTL is pronounced eye-AWK-tul where I come from

  • @_____case
    @_____case 4 місяці тому

    We don't need to be saved.

  • @guliverjham8148
    @guliverjham8148 4 місяці тому

    I don't like rust because it's a low level type thing with high level looking syntax.
    It rocks my brain to no end.

  • @spicynoodle7419
    @spicynoodle7419 4 місяці тому +3

    Don't you drop a SQEALite databases with `rm -f user.sqlite`?

  • @soundpalette2438
    @soundpalette2438 4 місяці тому

    Java functions eh?

  • @beofonemind
    @beofonemind 4 місяці тому +2

    Dude, you have to tell us, how is it possible a loop could destroy netflix permanently? wth how is that a thing?

  • @mintx1720
    @mintx1720 4 місяці тому

    Rust 2,0 will fix Rust and finally defeat Dreamberd as the perfect language,

    • @knolljo
      @knolljo 4 місяці тому +1

      dude, is that a comma?!

  • @Tattersail
    @Tattersail 4 місяці тому

    21:02- "writing their frontend and backend in the same language"
    And that language being JavaScript doesn't help

  • @yapdog
    @yapdog 4 місяці тому +2

    DO. NOT. WRITE. THAT. removeDatabase. FUNCTION! Not with embedded SQL. In fact, I wrote my own database system that has 2 languages with isolated processors: 1 client-side, 1 server-side. So, there are certain things that you just can't (directly) do client-side. Deleting a database is one of them.

    • @asdfqwerty14587
      @asdfqwerty14587 4 місяці тому +1

      I mean.. the drop database function is kind of scary, but if it's treated as any kind of security issue instead of a design issue then the far scarier thing is that they have the database credentials already. That function can't possibly work unless they have the database credentials in some form or another, so it would only be a matter of finding it, and if they have the database credentials then they can obviously do whatever they want with it regardless of what functions you have.

  • @Z3rgatul
    @Z3rgatul 4 місяці тому +1

    I understood nothing from 2 vulnerabilities this guy presented as examples. And Rust magically should have fixed them. Ok, that was interesting (it wasn't)

  • @emjizone
    @emjizone 4 місяці тому

    Developers' whims go too far! If we satisfy them on security issues today, tomorrow they'll be demanding that language syntaxes make sense.

    • @ea_naseer
      @ea_naseer 4 місяці тому

      the swing in the Lang design world seems to be security in the syntax.

  • @kshitizkumar403
    @kshitizkumar403 4 місяці тому

    Why prime is opposing rust, the point he's made, 6 months back he was praising the same points.. lol.

  • @sagarchilivery6112
    @sagarchilivery6112 4 місяці тому

    Love from India❤

  • @Spartan322
    @Spartan322 4 місяці тому +6

    Honestly I despise a lot of the Rust community, it doesn't serve an original purpose, it co-opts the purposes of other languages, sometimes without good justification compared to the alternatives, and then it gets injected everywhere like "replace everything with Rust" no matter how unsuitable it would be for that. Aside from despising the language for numerous reasons (its ideas are nice, but its implementation is the worst way you could've done it) the community is absolutely horrible for Rust, I've been in regular non-rust programming places, but as soon as you criticize Rust for anything, they absolutely lose their crap and call you names. I can't stand Rust, and even more I can't stand its community, its no wonder its representatives are so crap.

  • @jonnyso1
    @jonnyso1 4 місяці тому

    As the post shows, once again someone assumes Rust only exists help with memmory safety and completely misses the point.

    • @retropaganda8442
      @retropaganda8442 4 місяці тому

      what point?

    • @jonnyso1
      @jonnyso1 4 місяці тому

      @@retropaganda8442 That memory safety is only a consequence of the overall philosofy of how Rust is developed. One can dislike Rust for any number of reasons, but I lost count of how many times someone will downplay the language saying something along the lines of "memory safety isn't such a big deal, the language isn't worth learning just for that", which is just an ignorant take in my opinion because memory safety isn't the end be all nor the only or main benefit of using Rust, as the post in the video shows.

  • @duckydude20
    @duckydude20 4 місяці тому

    people don't care. don't care a sh8t.
    they just want to show something on screen.
    but i don't feel that.
    i get joy by seeing the code and not the output.
    why? cause i already wrote what output i want.
    my test already have that.
    my code has to produce that.
    i get joy writting that. designing.
    that's why sometimes i feel low. people don't care.

  • @thegittubaba
    @thegittubaba 4 місяці тому +1

    Lots of big talk the article but the two "example" of vulnerability provided is pure skill issue. Who's in their sane mind is allowing user to edit application config in runtime via this long dot namespaced parameters? wut. Then header parsing, seems like reinvented the wheel there and put shitty string manipulation code. No need to use rust or similar fancy tech to prevent this. Just use common sense. For example even in symfony (php) these wouldn't happen as framework has standard sane ways of both dealing with app config and http headers.

  • @danielsharp2402
    @danielsharp2402 4 місяці тому +1

    Absolutely not true for the JS thing after typescript go just feels miserable.