PHP Security: What you shouldn't store in cookies

Sdílet
Vložit
  • čas přidán 5. 09. 2024

Komentáře • 16

  • @THEunderscoreJOKE
    @THEunderscoreJOKE Před 9 lety

    This is the best series on your channel (dw, I think they're all great). The short, useful lessons have really helped. Thanks.

  • @1603stanley
    @1603stanley Před 9 lety +1

    thanks, this is a serious issue. i learnt something serious just now

  • @JohannGambolputty86
    @JohannGambolputty86 Před 8 lety

    This is just brilliant. Although I already knew a lot of these things , always is good to see the video like this.
    Best of luck,

  • @theminer3746
    @theminer3746 Před 9 lety

    This is very helpful.
    Please do more of this series.
    :)

  • @krazymusicguy
    @krazymusicguy Před 9 lety +1

    No, you're reaching. Just because someone may store a user_id in plain text, doesn't lead to the person being auto-logged in if the value is changed. The aspect you're reaching on would be how not to handle cookies, and/or cookie-based logins (and the alternative that is tokens). Something not to be stored in a cookie would've be login credentials (username/email, and password).

    • @krazymusicguy
      @krazymusicguy Před 9 lety

      Manolis Agkopian Yes, I'm not saying he's wrong, I'm saying why he says storing it as plaintext is wrong. He's reaching for a bad scenario which is an implementation issue, not anything strictly wrong with the value itself.

  • @clintonufere8534
    @clintonufere8534 Před 3 lety

    I'm currently having this problem and I'm looking for a way to store my cookie securely without having anyone understand it

  • @NoahNobody
    @NoahNobody Před 9 lety

    I don't understand. Are you saying this particular app wouldn't have a user login? A user id is useless unless the user has saved his credentials on that particular pc and account login.

  • @jasworld9672
    @jasworld9672 Před 5 lety

    That how will I recognize which is on my website ?

  • @_yonas
    @_yonas Před 9 lety

    gist.github.com/sweetcode/137a70417d72f2fee09e - You can use this class to encrypt and decrypt data. It's maybe a security plus when you stored encrypted data in your cookies.

  • @LowselingTech
    @LowselingTech Před 9 lety

    What about storing access tokens in a cookie? I think that randomly generated access tokens can be safely stored into a cookie instead of a session, right?

    • @codecourse
      @codecourse  Před 9 lety +1

      +LowselingTech Access tokens can be stored in a cookie but it's best to store two separate values (identifier and hash) in a table and have them both within the cookie. That way, it's harder to attempt to guess one value. You could also then implement throttling, so if a token is incorrect for a particular identifier x amount of times, the access token is invalidated in the database.

    • @LowselingTech
      @LowselingTech Před 9 lety

      ***** Ok, thank you very much! :)

  • @LeroyCochlovius
    @LeroyCochlovius Před 9 lety

    but a user_id in a session is safe right? I use a session to login a user and track that id in a $_session

    • @GeneralBowden
      @GeneralBowden Před 9 lety

      +Leroy Cochlovius Yes! correct sessions are server side files, so the user is unable to modified their session vars.

    • @jasworld9672
      @jasworld9672 Před 5 lety +1

      But every single time the user will have to sign into your website , that's annoying