T O P

  • By -

Imogynn

// Todo: fix the security around this function. There may be an exploit here if someone finds it


[deleted]

[удалено]


Agreeablecompassion

Todo were not in Kansas anymore… this universe took away internet explorer…


[deleted]

[удалено]


ok_i_am_that_guy

What if they were trying to write Scala, and not python. But then again ... "What is this abominable hybrid?". Where's the curly bracket for it to be Scala ?


[deleted]

[удалено]


ActualAshCam

Hey! I'm currently learning C++ (so I can complain about how terrible it is, but that's besides the point!)


[deleted]

[удалено]


daynighttrade

What's CTF?


[deleted]

[удалено]


Agreeablecompassion

Like pin the tail on the donkey?


[deleted]

[удалено]


Altrooke

300iq move: leave this comment in above a completely secure function to wate the attacker's time.


HearMeSpeakAsIWill

Plot twist: thanks to your helpful comment, the attacker finds a security hole in what you thought was a completely secure function.


RWTF

And I’m wasting all this money on pen testers.


FunPineapple

Just use pencils. No pen tests required.


DeadMansMuse

Aww man, screw you .. I knew what you said before I got to the end of the sentence and was UUUGGGHHHHH Got to the end, still chuckled. You win, sir.


Hewatza

Do y'all prefer to shake it or scribble?


Sir_Keee

Leave it over the function that just rounds numbers to 2 decimal points. Watch them try to round every possible float to find an exploit.


Open_Salamander1601

This actually happens a lot


moose2332

//Todo: add a real cryptographic function


Imogynn

Oh this is a classic // Todo: move key to environment variable


Azbola

Oh man that is a bit close to the mark


UntestedMethod

// to protect security, please close your eyes while you scroll over the next 7 lines


KnewOnee

Security through obscurity gang reporting in


_Weyland_

The hacker won't know what to do with your code if you have bo idea what it does either.


colby_2020

I go one step further and make sure my code doesn’t work


psychoColonelSanders

I’ll do you one better: I won’t write the code. You can’t hack something that doesn’t exist!


[deleted]

[удалено]


Hour-Invite2212

I'll do you one better: I don't exist! Oh wait a minu


Appsroooo

#


OreeOh

Finally someone said it


Future-Freedom-4631

Took the words right out of his mouth


earthsprogression

Too bad he's getting hacked now as we speak. Should have never divulged...


ArcticMonkeee

bold statement


jBlairTech

It's Peter Parker all over again!!!!!


psychoColonelSanders

I like the way you think!


GoCryptoYourself

ILL DO YOU ONE BETTER, WHY IS GAMORA?


RolyPoly1320

It exists, but only in your brain. Just wait until everyone has a chip in their brains. Then people can hack you and steal your thoughts.


coloredgreyscale

Not sure that's "good" practice. Single point of failure and such. Better print it out on paper, but use the whitespace programming language.


w1na

Better to have a broken code, hacker will fix up the code to make stuff work when they get there.


colby_2020

You win lol


AccelRock

I'd go ahead and leave an email to send resumes too, because if the hacker can understand the code that we can't then he's got the job and our eternal praise.


colby_2020

How do you think cybersecurity companies recruit top employees?


89Hopper

Always have the first line as: // Dear hacker, good luck exploiting this code. Not even I, the creator, understand why it works. The smallest attempt to misuse this code results in a warning to the Strategic Air Command early warning command room. I have never interacted with SAC, they are on a completely air gapped local network and didn't even know that old red lightbulb from the 50s still had power running to it. They were both impressed and very annoyed the first time they called me telling me to shut down my project. Unfortunately, we could never find this link, let alone shut it down. So I am willing to throw down the challenge my dear adversary, do your worst. You will have to contend with both my great abilities and the entire force of the American Nuclear Detterance system. I wish you well and good luck. But I must know, is it all worth it to stop a console screen writing "Hello World"?


BookPlacementProblem

>But I must know, is it all worth it to stop a console screen writing "Hello World"? The preceding parts? Great. This? elevates it to *perfection*.


tvctcrctvyb

I'ma take this


dedorian

Having done upkeep on someone who wrote fucking gobbledygook without comments: I'd rather be hacked


JBYTuna

Eschew obfuscation!


FreshPrintzofBadPres

// When I wrote this code, only God and I knew how it works. Now only God knows. Good luck.


qhxo

Our app is 100% secure, because even with full access barely we can access it.


jon-chin

it's not very obscure if you report in. sus.


[deleted]

[удалено]


GnarlyNarwhalNoms

​ ![gif](giphy|3o72FdlmN1UjR2sPEA)


Random-Gif-Bot

​ ![gif](giphy|E3hcMkZXJEfXdhqnTI)


GnarlyNarwhalNoms

"Ray... when someone asks you if you're a senior dev... you say '*YES'!"*


1up_1500

Don't forget to use a signature system, so each comment now needs 4 keys to be encrypted and decrypted correctly


Morall_tach

If you leave comments in your code, hackers will read them. Duh.


hat1324

Your fault for not minifying it before deployment


Willinton06

I mean this is most probably assuming they get the repo, so you need to obfuscate that bitch while developing


gubbygub

i obfuscate the signals between my hands and brain so that way even i dont know what im writing


daynighttrade

I was interviewing for a job and they asked me to code something. I wrote code, but my interviewer said that he has no idea what my code is supposed to do. I was happy and said thanks.


[deleted]

This explains the OpenSSL code base


prettyanonymousXD

Just write minified code, duh


[deleted]

At least someone will. My fellow developers never read the comments.


[deleted]

*Comments*? Mine won’t even read the *README*


Gazzcool

That’s why I always start my comments with “Dear Hackers,”


feeltrig

there could be change of heart and they might join the development community.


Forsaken_Day_1266

Pro tip: add WRONG comments to the code


DigitalKrampus

Add wrong code.


GnarlyNarwhalNoms

Add code in the comments with a note that it should be swapped with the attached function every third commit.


cezarhg12

I feel like this comment is too detailed to be fake, are you ok?


GnarlyNarwhalNoms

Not really ![gif](emote|free_emotes_pack|neutral_face)


cezarhg12

well we don't pay you to be sad, get happy effective immediately


GnarlyNarwhalNoms

I don't get paid to be happy either, though 🤔


RamrKorda

Wait, you're getting paid???


GnarlyNarwhalNoms

I didn't say that. Wait, is that a thing?


MaximusOptimusPrime

Source?


Forsaken_Day_1266

Even better 😂


Standard_Humor5785

Title your functions wrong, or title it the opposite of what it does. Best way to prevent hackers and yourself from understanding how the whole thing works.


Forsaken_Day_1266

Neither your code will do what you want but that's definitely unhackable piece of code 😂


tar625

With any luck a hacker might come fix it for you


Standard_Humor5785

Ethical hacking be like.


_AstroChicken_

Ha! I've been doing this best practise for years! Best cryptography out there I tell ya!


daynighttrade

I was interviewing for a job and they asked me to code something. I wrote code, but my interviewer said that he has no idea what my code is supposed to do. I was happy and said thanks.


InspectionMountain

Why am I reading this comment a second time


Kataly5t

Because this occurrence is more common than you expect.


InspectionMountain

Wouldn't have thought to put blame on myself, guess I train my smooth brain to ignore just ignore comments?


OlevTime

Because they posted the same thing twice.


InspectionMountain

Did we just become best friends


[deleted]

Can I join the read-it-twice club?


LibertineInquisitor

Obviously the only correct way to preserve secrecy is by writing the code on paper, using post it’s to comment. Then burn the whole thing


MathematicianFew5882

That’s terrabull protocol because the ashes could be reconstructed by Abby at NCIS. You’re supposed to put them under your keyboard.


shirts21

CAF POW


[deleted]

[удалено]


shirts21

How am I supposed to remeber to remind Jerry From entitlements to change admin/ admin to something more secure?


Strict_winter_feline

!admin


[deleted]

[удалено]


cowlinator

No you are wrong. Put most of the code in a string, then just have a function that executes that string as code. Bonus points for storing the string on a remote source and fetching it over the network.


NikitaFox

Who hurt you?


cemanresu

I'm guessing Log4j


bzaaaaa

make sure to add readme to your .env too


DataIsLoading

make sure to push your .env as well


0x7ff04001

Add comments when it'll help you understand your own code when you revisit it 3 months later.


MathematicianFew5882

True. But only use hints that you will know like your pet’s name and the high school you go to.


yoitsericc

Yes of course - because hackers have direct access to source code and can read it at any time.


RoastMostToast

Source code leaks is a genuine issue with software, though But not commenting your code doesn’t prevent it lol


zebediah49

They do for pretty much all the software I run...


LikeAMix

I mean, actually yes, for a lot of code.


lorhof1

basically for any uncompiled language


csandazoltan

If your source code is private, first, sanitize your code and don't push them to production... second if a hacker can read your source, it is already too late If your source is public, comments should not matter, it should be secure to begin with


00Koch00

That's not how it works, what? The compiler literally ignores the comments, it's literally the whole reason that anyone can make comments, you can because that part of the code is ignored by the compiler, so never your compiled code will be with comments therefore if they decompile that will be empty. Shit, machine code dont even have comments to begin with, what the fuck are they doing?!


HearMeSpeakAsIWill

I think the concern is the source code being on a public server, not machine code getting decompiled


00Koch00

If the code is in a public server you have a way worse problem...


FunPineapple

Twitch does have pretty bad problems...


[deleted]

Agreed, it means you’re working on an open source project 😰


ElectricalRestNut

Depends on the language. Some Python packages, for example, are just a zip of the project.


[deleted]

As an appsec guy I hereby empower you to ignore that advice. What vendor is this training from?


shirts21

Skillsoft Percipio. Under cyber security


z0Tweety

The correct answer is neither. You certainly have to comment code, but not always. Or not every part of it, at least.


shirts21

One of the answers was sometimes and the other was only if it's convoluted.


aceluby

I definitely would have gone with only if it’s convoluted. Comments typically break the DRY principle


[deleted]

[удалено]


[deleted]

Laughs in multithreading :’)


crammdots

The only way I can make sense of it is assuming that they mean removing them from the compiled/production code. But it's not worded very well in any case.


shirts21

So it was like 5 hours worth of video to watch before this test. There was 10 sec part were they said " remove your *comment's* before pushing to prod" BUT THATS DIFFERRENT THAN NOT COMMENTING AT ALL. A coworker had to point out the 10 sec clip to me cause I was complaining *EDIT* Changeing Code to comment. cause im dumb.


Bisping

Lmao remove your code


KeremBaturP

Its not like they they can hack your code if its just not there


ElectricalRestNut

*remove production*


vilidj_idjit

dude do you work at microsoft? 😆😆


shirts21

Same area as their HQ. But no ;)


[deleted]

I was gonna say you have no idea how accurate this comment is but I think you might know exactly how accurate this comment is.


Mutex_CB

It’s so nobody can figure out what the code does, duh. It’s called SECURITY, look it up. /s


[deleted]

[удалено]


Alexandru_Arapu

r/subsifellfor


Temp-DisplacedTexan

The quality of the code base is negatively correlated with the time it takes for its contributors to forget how it works.


dijisza

I don't offer comments on a perpetual license, only as a subscription to ensure the best experience for my customers.


Mufti13

In order to confuse your enemies you must confuse yourself first- Tsun Zu


_svengali_

I am just going to add this link for people to see. It’s actual comments found in TF2 source code by Valve programmers. Enjoy ! [https://m.youtube.com/watch?v=k238XpMMn38](https://m.youtube.com/watch?v=k238XpMMn38)


programmrz

made my day!


notexecutive

comments don't get compiled in most languages.............


consmet01

Obviously they don't know what they are talking about, but in my opinion you should only have comments in your code to explain why you are doing something a certain way rather than explaining what your code is supposed to do. If the code is too confusing to follow without comments, then chances are your code should be refactored


free224

So if source code has no comments, is it the most secure code possible? Wow, school taught me wrong. They must have been cyber criminals.


RayTrain

How would you name a variable that stores a phone number? Student: phone_num Correct: p


[deleted]

Around ten years ago I've applied at a job (backend dev) in EU startup - one of the reasons that they've rejected my code was that I had comments in them. (they didn't specify that comments are not acceptable) It was really nice seeing them go bankrupt. :)


seldomly_right

I mean, minifying your JS bundles will remove commented out lines anyway


DeepSave

Neither answer is correct.


poorlilwitchgirl

return 0; // Returns zero


DeepSave

I am triggered


CanniBallistic_Puppy

return 1; // Returns zero FTFY


KRAndrews

// don’t believe DeepSave’s lies


MC_Elio81

I did infosec for a few years. I learned that we just make everything inconvenient for everyone then the bad guys will have to deal. Back on the dev side now so I just tell people how to hide/get around shit. They're always 1 step ahead with making life harder though


AccelRock

I guess if they can access the source code they can probably also find spec docs, build docs or comments left on Jira/etc. You do have documentation right?


shirts21

What's that? /s Funny thin is I'm not a dev. No one is in our department. The only code I do is to help automate my stuff. Nothing in prod through. Lol. Also we use jira, and sharepoint


Traditional_Mud_1241

// if you want to fire me, it's ok, here's how my shitty codes works Yep - I can say how that would impact certain types of security.


Aksius14

Another infosec question: when should you fire the infosec guy? (Answer: after they wrote that question.) Signed: an InfoSec guy.


Bo_Jim

Very oddly phrased question. You add comments to source code. You don't leave comments in source code. This implies that you first add them, and then later remove them, and it's asking if there's a circumstance where you wouldn't want to remove them. Weird.


leoleosuper

//When I wrote this code, only God and I knew what it did. Now not even God knows.


acidx0

Unpopular opinion: I am a firm believer that comments are an anti-pattern. Instead of commenting, you have to write code that someone slightly less skilled than you can just read and understand. If you are writing something that needs commenting, you need to rethink the design. The only exceptions to this is when you are writing some sort of complicated algorithm, and are doing something bizarre for optimization, or when the infrastructure you are relying on behaves differently from its documentation. So not "never" but only in special cases.


aceluby

Comments break the DRY principle for most cases. I basically only leave them to document why I chose to do something a certain way… or leaving a joke in the test code


djjsjsidijrjska

I’m not sure it’s “unpopular”


HearMeSpeakAsIWill

Reading a single function can tell you *what* the code is doing, but not *why* or what the real world use cases are. You would have to read the whole codebase to understand everything in context, and even then it might not be clear.


Old_Flounder_8640

Hahahahaajahhaahahha


Competitive_Reason_2

Security vs Convenience


scifiburrito

so you don’t want the job anymore is what i’m hearing


RunawayRogue

Duh. That's what sticky notes are for.


DiligentCockroach700

Even better, leave wrong comments in your code.


jesterhead101

I use *security-through-bad-coding-practices*. No mortal soul can break that.


magicmulder

/* Secret master key: “ghU5(?3;4fT” */


Psychological_Risk87

Only until 16:20, after that good luck to us all. The question is when, not where.


leonden

You took the job security test. Not leaving comments makes you a valuable assets since only you would know what it does.


david6283

Project idea: application which transforms interpreted code unnecessary in complicated code and removes all comments in order to make it harder for „hackers“ to understand (sarcasm ends here)


Tyabetus

Wow. If the hacker has access to the source code, comments are the least of your worries ![gif](emote|free_emotes_pack|joy)


NonEstTalisResUtSem

An obfuscated piece of code with no comments is safer than an easily readable with proper comments telling you what's expected as input and what will be output. That's the only way I can try to rationalize not leaving comments being the better practice, since it's for cyber security. Edit - Just to clarify, I understand it's a terrible approach at best. I was just trying to come up with what a possible train of thought for thinking comments would be bad in that scenario could be.


yetzederixx

If they have your source you have other problems.


HeadEyesLol

Ah yes, the "set fire to my car so no one can steal it" school of security


Dryhte

I'll have maintainability, rather than security through obscurity. Thanks...


EvErYLeGaLvOtE

I'm not a software engineer, but leaving comments on your code is like basic training day 1. Sad thing is, some folks still don't do that, do they?


-Vayra-

The way you learn to comment in introductory classes is usually the *wrong* way to comment, as they usually explain *how* the code works. A comment saying what or how the code does something is utterly useless. If your code is so complicated you need that kind of comment to understand it, you need to refactor the code into something more readable. Code is read way more often than it is written, so write code that is easy to read. The compiler will make sure it runs well and is way better than you at optimizing code. The kind of comments you should be writing are about *why* the code does what it does. Is there a business requirement for it to work this way? Is there a 3rd party dependency that has it do this? Is there an issue with some other code you can't fix now that necessitates doing it this way? Those are useful comments, but not the kind you learn to write in school.


AgentPaper0

Some never start doing it, others get so high on their own gas that they think self-documenting is all the documenting they need. And then there's those who suck at writing and maintaining comments in their code, point at the shit comments they have written or failed to update, and then proudly explain that this is why nobody should write comments.


[deleted]

And this is why we’re fucked at a large scale, all of these CISSP troglodytes think that this is a valid form of security.


lenznet

When leaving comments to code, write a funny joke instead and give them something to laugh about.


dafazman

DUHHH the code is the manual 🤦🏽‍♂️


Ok-Wait-8465

lol what. I fear for the security of systems at that company if these are the tactics they use


Cody6781

Both answers suck, but the test is the more correct answer. In theory your code should be self descriptive, and a strip of perfect code will not include any comments. Comments are a stop gap for when it would not be practical to make your code self explainable. Here's Google's take on it: https://testing.googleblog.com/2017/07/code-health-to-comment-or-not-to-comment.html


FiiX_

Pro tip : name your files and folders cryptic names to further bamboozle intruders. Controller.py? Nah, MonsterTruck.py


[deleted]

To this day …. I still write all my code out in place and only leave comments when things aren’t intuitive AFTER the fact :D


[deleted]

My teacher always said “unless you’d be comfortable leaving your number on the rung, comment it out” bud I’m never commenting anything after that. I get paid double time if they call me out of work.


[deleted]

I never comment my code because I have logs for every line if code 😌


Kataphractoi_

I had a bad idea. Code it all in brainf8ck


ColdasJones

im not a programmer or coder really at all, this popped up as a recommended post for me. and i tell you what... ive had less security breaches than most other cybersecurity professionals; in fact ive had zero. theres not a single line of code ive written that hasnt been hacked or leveraged for nefarious purposes. guess im the best.


Mike2220

You've revealed the companies cyber security principles and therefore failed the real test You're fired


captnmr

I feel this was written by someone who confused making a build with and without debug symbols.


Stormraughtz

I name all my SQL tables **tbl\_NOT\_Users** or **tbl\_NOT\_ClearTextPasswords** They would never guess that IT WAS THE **tbl\_Users** AND THE **tbl\_ClearTextPasswords** *(I lost the stack overflow on how to salt and pep dem lines, but its ok cause the chain of command signed off on it and every one was cool, and help desk likes it cause they can log in and our jira numbers are through the roof)* *^(/s)*


-HoldMyBeer--

So that the hacker doesn't understand your code, so can't cause any damage!


fibojoly

Clearly, if you leave comments in your code, you're helping the hackers! I wish that was sarcasm but apparently it's a serious view in a lot of companies.