<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Idan Mor (sidanmor) on Medium]]></title>
        <description><![CDATA[Stories by Idan Mor (sidanmor) on Medium]]></description>
        <link>https://medium.com/@sidanmor?source=rss-5e48b1ba3765------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*MPfOrgHDkFU6TSdG.jpg</url>
            <title>Stories by Idan Mor (sidanmor) on Medium</title>
            <link>https://medium.com/@sidanmor?source=rss-5e48b1ba3765------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 17:38:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sidanmor/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Power of Eight Hours: Why Sleep Is Your Strongest Coding Tool]]></title>
            <link>https://sidanmor.com/the-power-of-eight-hours-why-sleep-is-your-strongest-coding-tool-a5bbb3f9a76e?source=rss-5e48b1ba3765------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5bbb3f9a76e</guid>
            <category><![CDATA[work-life-balance]]></category>
            <category><![CDATA[time-management]]></category>
            <category><![CDATA[mindfulness]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Idan Mor (sidanmor)]]></dc:creator>
            <pubDate>Tue, 25 Nov 2025 21:42:30 GMT</pubDate>
            <atom:updated>2025-11-25T21:45:47.927Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-jllo421yxaeS_FK" /></figure><p>If you work in tech, you’ve probably had nights where time just disappears. You open your laptop to “fix one quick thing,” review a pull request, answer a couple of late messages — and suddenly it’s 2 a.m.</p><p>You tell yourself it’s part of the job. There’s always another sprint, another deployment, another client waiting in another time zone. Sleep becomes something you squeeze in between tasks, rather than something you prioritize.</p><p>But here’s the truth: <strong>sleep isn’t what slows you down — it’s what keeps you sharp.</strong></p><h4>The Science Behind It</h4><p>Your brain is your most valuable tool. It powers every idea, every line of code, every problem you solve. During deep sleep, your brain strengthens memory, connects complex patterns, and clears out the mental “clutter” that builds up during the day.</p><p>When you skip sleep, that system starts to lag. Your focus drops, you make more mistakes, and even simple bugs take longer to solve. Studies show that people who regularly sleep seven to eight hours perform better in problem-solving, creative reasoning, and decision-making — all things developers rely on every day.</p><p>You might think staying up late helps you get more done, but in reality, it just slows down your long-term performance.</p><h4>One Day Off Won’t Fix It</h4><p>Developers often try to make up for lost sleep over the weekend — sleeping in late or taking a long nap on Saturday. But that’s like patching over bad code instead of fixing the root cause.</p><p>One day of rest isn’t enough.</p><p>Your body and brain need consistency, not compensation. Just like maintaining a production system, you can’t expect stability without regular upkeep.</p><h4>Building a Sleep Routine That Works for You</h4><p>The tech world won’t suddenly slow down, but you can create your own system for better rest — one that fits your schedule and lifestyle.</p><p><strong><em>Here’s how to start:</em></strong></p><p>•	🕙 Set a digital sunset. Log off at least an hour before bed. The blue light and mental load from screens keep your brain in “active” mode.</p><p>•	🌙 Create a shutdown ritual. Something simple — a walk, a shower, a few minutes of journaling. It signals to your brain that work is done for the day.</p><p>•	☕ Respect the caffeine cutoff. Stop drinking coffee after 3 p.m. so your system can clear it out before bedtime.</p><p>•	🧘 Unwind your nervous system. Try breathing exercises or meditation to lower stress after long hours of deep focus.</p><p>•	🗓️ Protect your sleep like a meeting. Add it to your calendar, and don’t cancel it. Sleep is your daily reboot cycle.</p><h4>The Developer’s Mindset Shift</h4><p>In tech culture, working late is often worn like a badge of honor — “night owl coder,” “grind never stops.” But here’s the thing: true professionals don’t run on exhaustion; they run on energy.</p><p>Rest isn’t weakness.</p><p>It’s maintenance.</p><p>It’s how you keep your mind clean, your logic sharp, and your creativity alive.</p><p>So tonight, before you push one more commit, close the laptop. Turn off the lights. Let your mind defrag and recharge.</p><p>Because tomorrow’s code will be cleaner — and so will your thoughts.</p><h4>Final Thought: Your 7-Day Sleep Challenge</h4><p>For the next week, challenge yourself to get seven full hours of sleep each night. Track how you feel — your focus, your creativity, your patience with bugs.</p><p>You’ll notice the difference not just in your work, but in the way you think.</p><p><strong>“Sleep is the best debugging tool for your brain.”</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5bbb3f9a76e" width="1" height="1" alt=""><hr><p><a href="https://sidanmor.com/the-power-of-eight-hours-why-sleep-is-your-strongest-coding-tool-a5bbb3f9a76e">The Power of Eight Hours: Why Sleep Is Your Strongest Coding Tool</a> was originally published in <a href="https://sidanmor.com/">sidanmor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Art of Time Off: Finding Balance Beyond the Workweek]]></title>
            <link>https://sidanmor.com/the-art-of-time-off-finding-balance-beyond-the-workweek-bd320f40c906?source=rss-5e48b1ba3765------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd320f40c906</guid>
            <category><![CDATA[wellness]]></category>
            <category><![CDATA[work-life-balance]]></category>
            <category><![CDATA[time-off]]></category>
            <category><![CDATA[mindfulness]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Idan Mor (sidanmor)]]></dc:creator>
            <pubDate>Wed, 29 Oct 2025 23:19:56 GMT</pubDate>
            <atom:updated>2025-10-29T23:24:43.618Z</atom:updated>
            <content:encoded><![CDATA[<p>A thoughtful look at how much rest we really need — and why one day off isn’t enough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mjAHgNE1IrGFVIogj-nYkg.png" /></figure><p>We talk a lot about work-life balance, but most of the time, the focus is on our workdays — how to split the 24 hours of a day between work, rest, and personal time.</p><p>But there’s another kind of balance we often forget: the balance between working weeks and time off.</p><p>We live in a culture that praises productivity. Taking time off can even make us feel guilty, as if we’re falling behind. But real balance isn’t about working endlessly — it’s about giving yourself enough space to recharge, reflect, and live.</p><h4>Why One Day Off Isn’t Enough</h4><p>Most of us get weekends — two days to recover after five of working.</p><p>But if you’ve ever tried taking just one day off during a busy period, you probably noticed it doesn’t feel like a vacation. One day is usually spent catching up — doing laundry, running errands, or handling whatever piled up while you were working. That’s not rest. That’s maintenance.</p><p>To actually recharge, you need time for your mind to slow down and detach from the constant rhythm of work.</p><p>That’s why I believe in a simple rule:</p><p>Take at least three consecutive days off when you want a real break.</p><p>•	Day 1: Your brain is still in “work mode.” You’re unwinding.</p><p>•	Day 2: You start feeling relaxed and fully present.</p><p>•	Day 3: You finally start enjoying the feeling of freedom.</p><p>Anything less, and it’s just a pause — not a reset.</p><h4>The Big Vacations: Two Per Year</h4><p>Short breaks are great, but they’re not enough to maintain real balance over time.</p><p>I believe everyone should take at least two big vacations each year, each lasting five days or more (ideally a full week).</p><p>Those are the moments that reset your perspective completely.</p><p>You stop checking messages. You think bigger. You remember what you love outside of work.</p><p>And when you come back — you return with renewed creativity, motivation, and clarity.</p><h4>How Many Days Off Do We Really Need?</h4><p>Let’s do some quick math.</p><p>A year has 365 days.</p><p>If we work 5 days a week, that’s roughly 260 workdays and 105 weekends (days off).</p><p>Now, add:</p><p>•	Public holidays: about 10 — 15 days (depending on where you live).</p><p>•	Personal vacation days: ideally around 25 — 30 days a year.</p><p>That means you’d have about 135 — 145 non-working days — roughly 40% of the year dedicated to rest, personal time, and recovery.</p><p>But if we truly want a balanced life — a life where work and personal time share the year equally — we should aim for something closer to a 50/50 split.</p><p>That would mean around 180 days off per year — about half your time devoted to living, not just working.</p><p>That might sound unrealistic at first, but it’s a powerful mindset shift.</p><p>It reminds us that life isn’t just about productivity. It’s about presence.</p><h4>Making It Work in the Real World</h4><p>Of course, not everyone can instantly take 180 days off.</p><p>But here are some ways to bring that spirit into your life:</p><p>•	Plan your breaks early. Schedule vacations at the start of the year — before work fills your calendar.</p><p>•	Take mini-vacations. Long weekends and 3-day getaways can make a huge difference.</p><p>•	Use holidays smartly. Combine national holidays with vacation days to extend your time off.</p><p>•	Disconnect fully. A vacation isn’t truly a vacation if you’re still replying to work messages.</p><p>•	Honor rest as seriously as work. Block it, protect it, and treat it as essential, not optional.</p><h4>Final Thoughts</h4><p>Time off isn’t a luxury — it’s a necessity.</p><p>It’s what allows us to show up fully, both at work and in life.</p><p>We weren’t built to run nonstop.</p><p>We were built to create, to connect, to explore, and to rest.</p><p>So next time you plan a vacation, don’t settle for a single day or a rushed weekend. Take the time your mind and body truly need.</p><p>Because when you rest deeply, you live fully — and that’s the real meaning of work-life balance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd320f40c906" width="1" height="1" alt=""><hr><p><a href="https://sidanmor.com/the-art-of-time-off-finding-balance-beyond-the-workweek-bd320f40c906">The Art of Time Off: Finding Balance Beyond the Workweek</a> was originally published in <a href="https://sidanmor.com/">sidanmor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Power of 8–8–8: A Simple Formula for Work-Life Balance]]></title>
            <link>https://sidanmor.com/the-power-of-8-8-8-a-simple-formula-for-work-life-balance-6a5e5c0566bd?source=rss-5e48b1ba3765------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a5e5c0566bd</guid>
            <category><![CDATA[mindfulness]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[work-life-balance]]></category>
            <category><![CDATA[time-management]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Idan Mor (sidanmor)]]></dc:creator>
            <pubDate>Wed, 29 Oct 2025 22:33:32 GMT</pubDate>
            <atom:updated>2025-10-29T22:41:33.086Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TyuVwwej4xvgqu8S3kBo3Q.png" /></figure><p>We live in a time when work easily spills into every part of our lives. Emails arrive long after dinner. Notifications light up our phones during weekends. Many of us have forgotten what a real break feels like.</p><p>For years, I struggled to find balance between my professional life and my personal one. I used to think that if I just worked a little harder, answered a few more messages, or stayed online a bit longer, I’d be more productive. But all it really did was blur the line between work and life — and leave me feeling drained.</p><p>One day, I come across a simple idea that completely changed how I look at time:</p><p><strong>Divide your day into three equal parts — 8 hours for work, 8 hours for personal life, and 8 hours for sleep.</strong></p><h4>The 8–8–8 Philosophy</h4><p>The logic behind it is beautifully simple:</p><p>A day has 24 hours. We dedicate one third to our careers and responsibilities, one third to rest and recovery, and one third to living.</p><p>Those “personal” 8 hours aren’t just for errands or chores. They’re for the things that make life meaningful — time with family, hobbies, learning something new, or simply doing nothing at all. It’s the part of the day where we invest in ourselves, not our job.</p><h4>Why It Works</h4><p>This balance creates structure without rigidity.</p><p>When you give each part of your day its fair share, you start to notice something powerful:</p><p>•	You become more focused during your 8 hours of work, because you know when to stop.</p><p>•	You’re more present with your loved ones, because your mind isn’t still in “work mode.”</p><p>•	You sleep better, because your day feels complete — not rushed or chaotic.</p><p>•	And over time, your energy and creativity grow instead of fading.</p><p>In short, the 8–8–8 rule is not about working less — it’s about living more intentionally.</p><h4>The Real-World Challenges</h4><p>Of course, life doesn’t always fit neatly into 8-hour blocks.</p><p>Some days demand more from us — deadlines, meetings across time zones, or unexpected emergencies. And that’s okay. The goal isn’t to be perfect, it’s to be aware.</p><p>The danger is when imbalance becomes the default. When “just tonight” turns into “every night,” and work quietly takes over the space meant for living.</p><h4>Practical Ways to Apply It</h4><p>Here are a few habits that help bring the 8–8–8 mindset into real life:</p><p>•	Set clear boundaries. Decide when your workday ends — and actually respect that time.</p><p>•	Protect personal hours. Schedule time for yourself just as seriously as you schedule meetings.</p><p>•	Disconnect to recharge. Put the phone away during dinner or while spending time with family.</p><p>•	Reflect daily. At the end of the day, ask yourself: Did I give enough time to each part of my life today?</p><p>Even small adjustments — leaving work on time once or twice a week — can make a big difference over time.</p><h4>Final Thoughts</h4><p>Balance isn’t something we find once and keep forever. It’s something we create every day, with small, intentional choices.</p><p>The 8–8–8 rule reminds me that time is the most valuable resource we have.</p><p>We can’t control how fast it passes, but we can control how we spend it.</p><p>So tomorrow morning, when the day begins again — 24 new hours waiting to be divided — try giving each part the respect it deserves.</p><p>Work with focus, rest deeply, and live fully.</p><p>Because a balanced life isn’t about doing everything — it’s about giving the right things enough time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a5e5c0566bd" width="1" height="1" alt=""><hr><p><a href="https://sidanmor.com/the-power-of-8-8-8-a-simple-formula-for-work-life-balance-6a5e5c0566bd">The Power of 8–8–8: A Simple Formula for Work-Life Balance</a> was originally published in <a href="https://sidanmor.com/">sidanmor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Develop your code inside a Docker Container using your favorite IDE]]></title>
            <link>https://sidanmor.com/run-and-debug-code-inside-docker-container-locally-5b121cfc858a?source=rss-5e48b1ba3765------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b121cfc858a</guid>
            <category><![CDATA[visual-studio-code]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[webstorm]]></category>
            <dc:creator><![CDATA[Idan Mor (sidanmor)]]></dc:creator>
            <pubDate>Wed, 07 Oct 2020 20:42:43 GMT</pubDate>
            <atom:updated>2020-10-13T11:34:01.773Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*vmW2Gu0ElsVxq79gYRLTlw.png" /></figure><p>Docker lets you package your software into standardized units for Development, Shipment, and Deployment. Docker image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries, and settings. Docker images become containers at runtime when running on a Docker Engine, so the application runs quickly and reliably, and can transfer from one computing environment to another.</p><p>This blog talks about the development stage and the development environment. How can you be sure that what runs on your personal computer, will run and do the same thing inside the docker container? How can you be sure that you have all of the needed dependencies? How can you be sure that you have the same environment settings among your other team members? The answer to all of these questions is that you can never be sure.</p><p>What if you could run and even debug your code inside the docker container itself, on your personal computer? What if you didn’t need to spend half a day or more on installing all the needed packages and tools to have the ability to run your code on new employees’ personal computers?</p><p>You can do it easily with your favorite IDE (VSCode, WebStorm, or PyCharm). You simply need to have a Docker Engine installed on your personal computer.</p><h4>Visual Studio Code:</h4><p>You need to use the Microsoft “Remote Containers” extension (you will see an “open a remote window” button at the bottom left of your window). Press on it and select the “Reopen in Container” option. If you already have a Dockerfile, you can select the “From Dockerfile” option and you will have a new Container referring to the existing Dockerfile to run your code inside of it.</p><p>If you don’t have a Dockerfile, you can use a basic container configuration from the container definition registry. Select the “From a predefined container configuration definition” option, and then add the Development Container Configuration Files you want. A new window with the container will appear and you will be able to run your code inside of it. Additionally, you will have the Development Container Configuration Files in the .devcontainer folder for future runs.</p><h4>WebStorm/Pycharm:</h4><p>Javascript and Python are interpreter languages, so you can use Docker container inner-interpreter instead of using the local interpreter. With the Docker container, you can run and debug your code while developing it. Using three clicks or less, you can set the docker image that you already have in production, to be your development environment interpreter.</p><p>Go to Preferences | Build, Execution, Deployment | Docker, and set a new docker Execution engine. You can select your docker engine from a remote machine, or you can use your local docker engine.</p><ol><li>Go to Preferences | Project: backend | Project Interpreter and set a new docker Project interpreter. You can use any Docker image you want. (an image from DockerHub or one that you built from your Dockerfile)</li><li>Go to Run/Debug Edit Configurations and set the interpreter to be the interpreter you just set in the previous step. There, you can also edit the docker container settings.</li><li>Done.</li></ol><p>Having the ability to run and debug your code inside the docker container can save you a huge amount of time. For one, you do not need to install anything on your personal computer. Secondly, you can be sure that all of your team members have the same environment settings. Thus, if you manage to run it properly on your personal computer, it will run properly in production.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b121cfc858a" width="1" height="1" alt=""><hr><p><a href="https://sidanmor.com/run-and-debug-code-inside-docker-container-locally-5b121cfc858a">Develop your code inside a Docker Container using your favorite IDE</a> was originally published in <a href="https://sidanmor.com/">sidanmor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Browser Extensions Routinely Bypass a CSP (Content Security Policy)]]></title>
            <link>https://sidanmor.com/how-browser-extensions-routinely-bypass-a-csp-content-security-policy-2d482767a672?source=rss-5e48b1ba3765------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d482767a672</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[content-security-policy]]></category>
            <category><![CDATA[csp]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <dc:creator><![CDATA[Idan Mor (sidanmor)]]></dc:creator>
            <pubDate>Tue, 26 Mar 2019 21:07:28 GMT</pubDate>
            <atom:updated>2019-04-08T17:13:01.824Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*yLOuDxSruUR0sWm4mPoPDQ.png" /></figure><p>With so much of commerce taking place online nowadays, online businesses quite understandably have and will continue to commit substantial investment into every aspect of their digital storefronts as they strive to capture a greater share of the vast and growing eCommerce market.</p><p>They’re not the only ones trying to capitalize on these digital opportunities however: Entire economies have been built and continue to grow to profit off of online commerce by a myriad of methods, ranging from fraud and identity theft, collecting users’ private information, to injecting malicious content that redirects web traffic and revenue away from the intended destination to other sites.</p><p>With so much at stake then, online businesses have also invested in solutions aimed at protecting their users’ security and privacy. We recently covered how one of these solutions, a <a href="https://www.namogoo.com/online-journey-hijacking/5-reasons-why-content-security-policy-is-redundant/">Content Security Policy (CSP)</a>, works and explained the 5 main areas its capabilities fall short in preventing Online Journey Hijacking, which specifically targets <a href="https://www.namogoo.com/customer-hijacking-prevention/how-to-tell-if-a-browser-extension-may-be-up-to-no-good/">consumer browsers</a> in order to inject unauthorized ads that disrupt users when visiting online retail sites and divert them to competing offers.</p><p><strong>Ad injectors and other malicious actors have used </strong><a href="https://www.namogoo.com/online-journey-hijacking/why-fake-ad-blockers-are-just-the-tip-of-the-iceberg-for-online-consumers-businesses/"><strong>browser extensions</strong></a><strong> as one of the main routes to installing code injections and for very good reason: they exploit consumer side vulnerabilities that allow them to bypass server-side security solutions, including a CSP. </strong>Add the fact that browsers extensions are <a href="http://www.skipser.com/p/2/p/most-popular-chrome-extensions.html">so widely used</a>, and it’s little wonder why they have become a prime target for injectors.</p><p>To help online businesses understand how a malicious browser extension can still inject invasive impacting a website running a CSP, let’s first take a look at how CSPs and browser extensions work.</p><h3>WHAT IS A CSP?</h3><p>The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. Here’s how they <a href="https://w3c.github.io/webappsec-csp/">define a CSP</a>, and how it should and should not be used:</p><p><strong>“It is a tool which developers can use to lock down their applications in various ways, mitigating the risk of content injection vulnerabilities such as cross-site scripting, and reducing the privilege with which their applications execute.</strong></p><p><strong>CSP is not intended as a first line of defense against content injection vulnerabilities. Instead, CSP is best used as defense-in-depth. It reduces the harm that a malicious injection can cause, but it is not a replacement for careful input validation and output encoding.”</strong></p><h3>HOW DOES A BROWSER EXTENSION WORK?</h3><p>Browser extensions are event-based programs used to modify or enhance the browsing experience. An event is a browser trigger, such as navigating to a new page, removing a bookmark, or closing a tab. Browser extensions monitor these events in their background script and react with specified instructions. A background page is loaded when it is needed, and unloaded when it goes idle. Once it has been loaded, a background page will stay running as long as it is performing an action, such as calling the browser API or issuing a network request for example. A <a href="https://developer.chrome.com/extensions/background_pages">background page will not unload</a> until all visible views and all message ports are closed.</p><h3>SO… DOES A CSP ACTUALLY PREVENT BROWSER INJECTIONS?</h3><p>Still think that applying a CSP restriction on your website will keep your users and your business secure from browser injections that <a href="https://www.namogoo.com/customer-hijacking-prevention/">hijack your customers</a>? Think again. The same W3C Specification document clearly outlines these <a href="https://w3c.github.io/webappsec-csp/#implementation-considerations">Implementation Considerations</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f6pQzcwEFT0v5Dx_It8viQ.jpeg" /></figure><p>All web browsers align with this W3C specification. Indeed, <strong>when using the Browser webRequest API, extensions can edit the request before it gets to the webpage.</strong> Just like that… the extension can bypass the website CSP restriction. With no reach or capability on the client side, the CSP simply can’t prevent this.</p><h3>HOW DOES A BROWSER EXTENSION BYPASS A CSP?</h3><p>Browser extension APIs define a set of events that follow the life cycle of web requests, and can use these events to observe and analyze incoming and outgoing traffic. Specific synchronous events will allow the browser extension to <a href="https://developer.chrome.com/extensions/webRequest">intercept, block, or modify a request</a>.</p><p>For example, the Chrome Extension webRequest API has a function called <strong>onHeadersReceived,</strong> which fires each time an HTTP(S) response header is received. Due to redirects and authentication requests, this can happen multiple times per request. <strong>This event is intended to allow extensions to add, modify, and delete response headers, such as incoming Content-Type headers and CSP headers.</strong></p><p><strong>Malicious or not, Chrome extensions use the onHeadersReceived event to modify the CSP headers, ‘CONTENT-SECURITY-POLICY’, and ‘X-WEBKIT-CSP’ before the webpage rendered.</strong></p><p>The CSP Directives registry contains many types of directives enabling developers to control certain aspects of their sites’ behavior. There are directives govern resource fetching, the state of a document, aspects of navigation, and reporting.</p><p><strong>Chrome extensions can decide which directives to modify — or even set a new CSP header that bypasses all requests.</strong> For example, the extension can set the default source for a website to include every asset added to the page using the <a href="https://w3c.github.io/webappsec-csp/#directive-default-src">‘default-src’ directive</a><strong>.</strong></p><p>The example below shows how the default source is set to allow all assets on a webpage, consequently allowing for extensions to inject unauthorized content:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5dQpaOmjNhi10C9dBn4aw.jpeg" /></figure><h3>WANT TO SEE HOW THIS CODE LOOKS ON A SUPPOSEDLY CSP-PROTECTED WEB PAGE?</h3><p>Here’s how to install the Chrome extension locally:</p><ol><li>Download the crx file from <a href="https://github.com/sidanmor/csp-extension/blob/master/csp-extension.crx">GitHub</a></li><li>Open chrome://extensions/ on Chrome</li><li>Enable “developer mode” on the page (This is just to enable you to install the Extension locally)</li><li>Drag and drop the crx file onto the page</li><li>Done. You’ll now see the Extension in the Extensions list.</li><li>Now navigate to a website with CSP to see how this code appears.</li></ol><h3><strong>THE VERDICT: A CSP WILL NOT PREVENT BROWSER INJECTIONS FROM DISRUPTING YOUR SITE EXPERIENCE</strong></h3><p>As the example above shows, the writing is on the proverbial wall: CSPs do not have the client-side capabilities required to stop browser injections from injecting code into your website. As we previously covered, <strong>browser extensions and add-ons inject code and HTML elements directly into the end user’s browser, completely bypassing the CSP.</strong></p><p>Protecting the integrity of your website and how it’s experienced by your customers requires technology that monitors web browser activity taking place on the client-side and is capable of blocking unauthorized code from running.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d482767a672" width="1" height="1" alt=""><hr><p><a href="https://sidanmor.com/how-browser-extensions-routinely-bypass-a-csp-content-security-policy-2d482767a672">How Browser Extensions Routinely Bypass a CSP (Content Security Policy)</a> was originally published in <a href="https://sidanmor.com/">sidanmor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using JavaScript to Measure System Time]]></title>
            <link>https://sidanmor.com/how-to-measure-cpu-time-via-javascript-43ca49382abf?source=rss-5e48b1ba3765------2</link>
            <guid isPermaLink="false">https://medium.com/p/43ca49382abf</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Idan Mor (sidanmor)]]></dc:creator>
            <pubDate>Tue, 17 Oct 2017 11:56:47 GMT</pubDate>
            <atom:updated>2019-11-13T21:43:58.896Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*wMjh7HiIMEefUpMGDeSe-Q.png" /></figure><p>Technology companies often turn to third-party solutions in order to improve performance and user experience, but dealing with a diverse customer base and serving multiple platforms, browsers, and devices is challenging. It involves understanding the limitations and capabilities of the users’ systems and the impact of the executed code on usability.</p><p>As a third-party platform for online enterprises, Namogoo is responsible to ensure that its solutions do not interfere with the performance and customer journeys of our clients’ websites.</p><p>Achieving this requires being able to measure the capacity of the end user’s system to handle Namogoo’s code and then, to use this data to adapt the code so that the system’s resources can be better leveraged to optimize the user’s experience and minimize disruption. To do this, it is vital to understand how a system’s capabilities impact system time and how this is assessed by Namogoo’s platform.</p><h3>What is system time?</h3><p>Loosely defined as the time that a system spends processing data, system time as a measurement is also indicative of the speed of the system. It can be affected by a variety of factors such as browser, operating system, device, and network efficiencies.</p><p>Typical browsers do not have an API that can be used to extract a measurement of the system time. However, running a JavaScript code snippet could be used to produce an approximate system time measurement that lets you compare various environments in which the same script is executed.</p><p>Namogoo, in turn, could use this measured “weight” of the system to adapt its processes in implementing an efficient Customer Journey Hijacking prevention algorithm, customizing it to the efficiency of the user’s system.</p><h3>How can JavaScript be used for measuring system time?</h3><p>Here are three methods that measure system time using JavaScript:</p><h4>Method 1: Measuring System capacity — Open Ended Timeframe</h4><p>The simplest — or at least it would seem — and most intuitive way would be to execute a piece of code and measure the time taken to run it as in the example below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa28b4fa836314c68d3ae326d879065c/href">https://medium.com/media/aa28b4fa836314c68d3ae326d879065c/href</a></iframe><p>There is an inherent issue with this method. The weight of this function can greatly vary between environments, therefore it’s not possible to rely on the system time that this method will calculate. As seen above, the number of loops is predefined, while the time measurement is open ended and based on the execution time. For example, running this method on a high-performing environment will produce a lower execution time, while environments with slower execution times would result in system delays and hence, produce a bottleneck.</p><h4>Method 2: Measuring CPU/System Capacity Using Bound Timeframe</h4><p>In contrast to method 1, the code here measures the number of loops being run within a predefined time frame. This addresses the main flaw in method 1, where the timeframe is unknown. The number of loops the system can run in the given timeframe is indicative of the performance of the system. Here’s an example of this method below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/daa3be7dd40e75bee867d22d44c2c4ec/href">https://medium.com/media/daa3be7dd40e75bee867d22d44c2c4ec/href</a></iframe><p>Although this code looks promising and could satisfy most requirements, there’s a semantic error in its execution here. The <strong>Date().getTime()</strong> JavaScript method returns the number of milliseconds elapsed since January 1, 1970. However, this value may not exactly fall at the start of the millisecond timer. For example, this method could be executed in the middle of a millisecond and would skew the system time measurement.</p><p>To ensure that the start and end times are recorded at the very start of the millisecond, a <a href="https://en.wikipedia.org/wiki/While_loop">while loop</a> is introduced before the measurement loop, which assigns the time value right when it takes on the next millisecond value. This way, when the code enters the while loop for measurement, the time values are both at the start of the millisecond, making the calculation more accurate. Here’s an example of how this function is implemented:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/057f792e2b6382de5834a9029ea75498/href">https://medium.com/media/057f792e2b6382de5834a9029ea75498/href</a></iframe><h4>Method 3: Measuring the Execution Time of JavaScript Code</h4><p>In addition to method 2, the JavaScript execution time is better measured by using an event loop with the setTimeout method. This method evaluates a function after a specified number of milliseconds.</p><p>To measure system time, the function’s execution time is set to zero milliseconds so that the time interval between the start and end of the Event Loop (JavaScript execution queue) is measured. Setting up an asynchronous function to run immediately will still carry a delay due to pending execution functions in queue. The efficiency of the system is determined by setting the function’s execution time to zero milliseconds. The longer this takes to execute, the heavier the load is on the system. For example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9312481ba30167f62185cadb7708a7df/href">https://medium.com/media/9312481ba30167f62185cadb7708a7df/href</a></iframe><p>This method can be run in parallel with method 2 to help maximize the accuracy of the system time measurement.</p><h3>In conclusion</h3><p>Namogoo has developed these methods to measure the system time using JavaScript. This enables our platform to measure system-wide factors that can impact performance and user experience, and to continuously adapt our code in real time, thus enabling our solutions to work optimally in any environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43ca49382abf" width="1" height="1" alt=""><hr><p><a href="https://sidanmor.com/how-to-measure-cpu-time-via-javascript-43ca49382abf">Using JavaScript to Measure System Time</a> was originally published in <a href="https://sidanmor.com/">sidanmor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Javascript Performance Test]]></title>
            <link>https://sidanmor.com/javascript-performance-test-d09bde3c2976?source=rss-5e48b1ba3765------2</link>
            <guid isPermaLink="false">https://medium.com/p/d09bde3c2976</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Idan Mor (sidanmor)]]></dc:creator>
            <pubDate>Fri, 22 Sep 2017 21:43:05 GMT</pubDate>
            <atom:updated>2020-10-16T21:52:26.265Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*PJ-CTg_xt30pXLDeuwExeg.jpeg" /></figure><p>Have you ever wondered which “String to Integer conversion” is faster?</p><pre>Number(&#39;6&#39;); // ?<br><br>parseInt(&#39;6&#39;); // ?<br><br>+&#39;6&#39;; // ?</pre><p>Or, which comparison operator is faster? == or ===</p><pre>3 == &#39;3&#39;; // ?<br><br>3 === &#39;3&#39;; // ?</pre><p>Or maybe this is faster?</p><pre>!!(3 - &#39;3&#39;); // ?</pre><p>Now you can test it with the new Javascript-Performance-Test I have created.</p><p><a href="https://html-sample.com/Javascript-Performance-Test/index.html">Performance Testing Utility</a></p><p>The “Commons” section runs just one time, before the two tests, and the return object will be passed to the tested function as the first parameter. Each function will run many times, multiple by ten until one second is passed. The results will appear at the title, and the winner will be announced.</p><p>Here are more examples:</p><pre><strong>function</strong> <strong>nested</strong>(arg1, arg2) {<br>  <strong>function</strong> <strong>helper</strong>(arg) {<br>    <strong>return</strong> arg + 1;<br>  }<br><br>  <strong>return</strong> helper(arg1) + helper(arg2);<br>}</pre><p>Or:</p><pre><strong>var</strong> iife = (<strong>function</strong>() {<br>  <strong>function</strong> <strong>helper</strong>(arg) {<br>    <strong>return</strong> arg + 1;<br>  }<br><br>  <strong>return</strong> <strong>function</strong>(arg1, arg2) {<br>    <strong>return</strong> helper(arg1) + helper(arg2);<br>  }<br>})();</pre><pre><strong>function</strong> <strong>doArguments</strong>() {<br>  <strong>var</strong> k = 0;<br>  <strong>for</strong> (<strong>var</strong> i = 0, j = arguments.length; i &lt; j; i++){<br>    k += arguments[i];<br>  }<br>  <strong>return</strong> k;<br>}</pre><p>Or:</p><pre><strong>function</strong> <strong>doArray</strong>(array) {<br>  <strong>var</strong> k = 0;<br>  <strong>for</strong> (<strong>var</strong> i = 0, j = array.length; i &lt; j; i++){<br>    k += array[i];<br>  }<br>  <strong>return</strong> k;<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d09bde3c2976" width="1" height="1" alt=""><hr><p><a href="https://sidanmor.com/javascript-performance-test-d09bde3c2976">Javascript Performance Test</a> was originally published in <a href="https://sidanmor.com/">sidanmor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arrow function => No binding of this]]></title>
            <link>https://sidanmor.com/arrow-function-no-binding-of-this-7e41f75271d2?source=rss-5e48b1ba3765------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e41f75271d2</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ecmascript-6]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Idan Mor (sidanmor)]]></dc:creator>
            <pubDate>Thu, 20 Jul 2017 13:02:05 GMT</pubDate>
            <atom:updated>2017-08-19T22:31:41.673Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*u1je6uJKMLrNrlK7lyZtmg.jpeg" /></figure><p>Until arrow functions, every new function defined its own this value (a new object in the case of a constructor, undefined in strict mode function calls, the base object if the function is called as an “object method”, etc.)</p><p>Alternatively, a bound function could be created so that a preassigned this value would be passed to the bound target function.</p><p>An arrow function does not create its own this, the this value of the enclosing execution context is used. Thus, in the following code, the this within the function has the same value as this in the enclosing scope (window object in this case):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a74ad203e811bc3a8f5905d2b4f77aa/href">https://medium.com/media/7a74ad203e811bc3a8f5905d2b4f77aa/href</a></iframe><p><strong><em>References:</em></strong></p><p><a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions">https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e41f75271d2" width="1" height="1" alt=""><hr><p><a href="https://sidanmor.com/arrow-function-no-binding-of-this-7e41f75271d2">Arrow function =&gt; No binding of this</a> was originally published in <a href="https://sidanmor.com/">sidanmor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[process.nextTick(cb); Please use it]]></title>
            <link>https://sidanmor.com/process-nexttick-cb-please-use-it-8875c6aa41f9?source=rss-5e48b1ba3765------2</link>
            <guid isPermaLink="false">https://medium.com/p/8875c6aa41f9</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Idan Mor (sidanmor)]]></dc:creator>
            <pubDate>Tue, 18 Jul 2017 07:57:00 GMT</pubDate>
            <atom:updated>2017-12-31T11:57:06.264Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*IcXUmZEVBUYJ0yIlyPqiNA.jpeg" /></figure><p>It is very important for APIs to be either 100% synchronous or 100% asynchronous.</p><p>Consider this example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b68aabc558026ff6789a823940189472/href">https://medium.com/media/b68aabc558026ff6789a823940189472/href</a></iframe><p>This API is hazardous because in the following case:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb30d96eea326df0eade112c36cbac27/href">https://medium.com/media/bb30d96eea326df0eade112c36cbac27/href</a></iframe><p>It is not clear whether <strong>foo()</strong> or <strong>bar()</strong> will be called first.<br>The following approach is much better:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0eaea3445607e4c2d2282925a1c9d016/href">https://medium.com/media/0eaea3445607e4c2d2282925a1c9d016/href</a></iframe><p><strong><em>Note:</em></strong> The next tick queue is completely drained on each pass of the event loop before additional I/O is processed. As a result, recursively setting nextTick callbacks will block any I/O from happening, just like a while(true); loop.</p><p>If you want to use Promises, you can do it like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/526014830881f118b4ae734d94379803/href">https://medium.com/media/526014830881f118b4ae734d94379803/href</a></iframe><p><strong><em>References:</em></strong></p><p><a href="https://nodejs.org/dist/latest-v8.x/docs/api/process.html">https://nodejs.org/dist/latest-v8.x/docs/api/process.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8875c6aa41f9" width="1" height="1" alt=""><hr><p><a href="https://sidanmor.com/process-nexttick-cb-please-use-it-8875c6aa41f9">process.nextTick(cb); Please use it</a> was originally published in <a href="https://sidanmor.com/">sidanmor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nodemailer]]></title>
            <link>https://sidanmor.com/nodemailer-fcaa664b6f2b?source=rss-5e48b1ba3765------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcaa664b6f2b</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Idan Mor (sidanmor)]]></dc:creator>
            <pubDate>Tue, 21 Mar 2017 16:12:36 GMT</pubDate>
            <atom:updated>2017-08-19T22:33:10.058Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*yHcn-1CDmXgwScY-_8drag.png" /></figure><p>How to use the Nodemailer NPM module with AWS mail server:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc8fa19c9e2765e8650062425f783da3/href">https://medium.com/media/cc8fa19c9e2765e8650062425f783da3/href</a></iframe><p><strong><em>References:<br></em></strong><a href="https://nodemailer.com/about/">https://nodemailer.com/about/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcaa664b6f2b" width="1" height="1" alt=""><hr><p><a href="https://sidanmor.com/nodemailer-fcaa664b6f2b">Nodemailer</a> was originally published in <a href="https://sidanmor.com/">sidanmor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>