0

coding newbie here. I’ve been coding Python for the most part of the last year, and recently just began learning Java. I understand that Python does not grant access protection like Java does. However, a friend of mine told me:

Since everything in Python is public, you can access the internal state of something and change it easily. For instance, you can access the price of an item in an online shopping basket and modify the class directly.

I understand that there’s more to that analogy (like security and stuff) but to what extent is this issue with lack of protected access true?

user107224
  • 205
  • 2
  • 12
  • Possible duplicate of [Does Python have “private” variables in classes?](https://stackoverflow.com/questions/1641219/does-python-have-private-variables-in-classes) – UnholySheep Jul 09 '18 at 08:17
  • @UnholySheep yeah I read that post; but I’m also curious about this potential security breach with lack of protected access! – user107224 Jul 09 '18 at 08:20
  • 2
    What kind of security breaches? If someone has access to the source code then "protected access" is the least of your worries (they can just rewrite whatever they want anyway) – UnholySheep Jul 09 '18 at 08:21
  • @UnholySheep how about via sending requests? – user107224 Jul 09 '18 at 08:28
  • When you say "protected access", do you mean `protected`, or simply referring to visibility in general? – Andy Turner Jul 09 '18 at 08:28
  • 3
    If you allow requests to execute arbitrary code on your server then "protected access" doesn't matter either, your application is insecure by nature. This has nothing to do with the programming language used on the server (which the user won't be aware of anyway) – UnholySheep Jul 09 '18 at 08:30

0 Answers0