<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: stephen infanto</title>
    <description>The latest articles on Forem by stephen infanto (@stepheninfanto).</description>
    <link>https://forem.com/stepheninfanto</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F694879%2Ff471ba15-6443-45ef-938f-853dbf54c4cd.jpeg</url>
      <title>Forem: stephen infanto</title>
      <link>https://forem.com/stepheninfanto</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/stepheninfanto"/>
    <language>en</language>
    <item>
      <title># Oops: I Leaked Secrets — GitGuardian warned me ...</title>
      <dc:creator>stephen infanto</dc:creator>
      <pubDate>Sat, 11 Apr 2026 20:22:12 +0000</pubDate>
      <link>https://forem.com/stepheninfanto/-oops-i-leaked-secrets-gitguardian-warned-me--12fi</link>
      <guid>https://forem.com/stepheninfanto/-oops-i-leaked-secrets-gitguardian-warned-me--12fi</guid>
      <description>&lt;p&gt;I thought I was safe.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fywes84xt9i1nfqay24hc.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fywes84xt9i1nfqay24hc.gif" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My &lt;code&gt;.gitignore&lt;/code&gt; had all the usual rules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;.&lt;span class="n"&gt;env&lt;/span&gt;
.&lt;span class="n"&gt;env&lt;/span&gt;.*
*.&lt;span class="n"&gt;env&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But one day, I discovered that my &lt;code&gt;.env.dev&lt;/code&gt; and &lt;code&gt;.env.prod&lt;/code&gt; files were exposed in a side project.&lt;/p&gt;

&lt;p&gt;Here’s what I learned and what you should do if this ever happens to you.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. &lt;code&gt;.gitignore&lt;/code&gt; Doesn’t Undo History
&lt;/h2&gt;

&lt;p&gt;Adding files to &lt;code&gt;.gitignore&lt;/code&gt; only prevents &lt;em&gt;future&lt;/em&gt; commits.&lt;/p&gt;

&lt;p&gt;If a file was previously committed, Git will continue tracking it. That’s why changes to my &lt;code&gt;.env.prod&lt;/code&gt; were still showing up.&lt;/p&gt;

&lt;p&gt;👉 Lesson: &lt;code&gt;.gitignore&lt;/code&gt; is not retroactive.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Immediate Response Matters
&lt;/h2&gt;

&lt;p&gt;The moment you suspect a leak, act fast.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Revoke exposed keys — treat them as compromised&lt;/li&gt;
&lt;li&gt;Rotate API keys, database passwords, tokens&lt;/li&gt;
&lt;li&gt;Redeploy applications with fresh secrets&lt;/li&gt;
&lt;li&gt;Audit logs for suspicious activity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Assume the worst. Delay increases risk.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Cleaning Your Repository History
&lt;/h2&gt;

&lt;p&gt;Deleting the file is not enough.&lt;/p&gt;

&lt;p&gt;Sensitive data may still exist in past commits.&lt;/p&gt;

&lt;p&gt;To fully remove it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use tools like &lt;strong&gt;BFG Repo-Cleaner&lt;/strong&gt; or &lt;code&gt;git filter-repo&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Rewrite commit history&lt;/li&gt;
&lt;li&gt;Force push the cleaned repository&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 This is the only way to truly scrub secrets.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Preventing Future Leaks
&lt;/h2&gt;

&lt;p&gt;A few practices that help:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Double-check &lt;code&gt;.gitignore&lt;/code&gt; paths&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid storing critical secrets in &lt;code&gt;.env&lt;/code&gt; files&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use secret managers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Secrets Manager&lt;/li&gt;
&lt;li&gt;HashiCorp Vault&lt;/li&gt;
&lt;li&gt;GitHub Secrets&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Educate your team: once committed, secrets persist unless explicitly removed&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Stop Tracking Immediately
&lt;/h2&gt;

&lt;p&gt;If a file is already tracked:&lt;/p&gt;

&lt;p&gt;(after banging head multiple times)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;--cached&lt;/span&gt; .env 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This removes it from Git tracking without deleting it locally.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;.gitignore&lt;/code&gt; is not a safety net — it’s a guardrail.&lt;/p&gt;

&lt;p&gt;If secrets leak:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rotate → Clean → Monitor&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Security isn’t about never making mistakes.&lt;br&gt;
It’s about responding correctly when they happen.&lt;/p&gt;




&lt;p&gt;If you’ve faced something similar, I’d love to hear how you handled it.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>security</category>
      <category>react</category>
    </item>
    <item>
      <title>The CSS Style Dilemma -When to Use `rem`, `em`, `px`, and `%`</title>
      <dc:creator>stephen infanto</dc:creator>
      <pubDate>Mon, 13 Oct 2025 07:10:53 +0000</pubDate>
      <link>https://forem.com/stepheninfanto/the-css-style-dilemma-when-to-use-rem-em-px-and--3d23</link>
      <guid>https://forem.com/stepheninfanto/the-css-style-dilemma-when-to-use-rem-em-px-and--3d23</guid>
      <description>&lt;h2&gt;
  
  
  Mastering the CSS Toolkit: When to Use &lt;code&gt;rem&lt;/code&gt;, &lt;code&gt;em&lt;/code&gt;, &lt;code&gt;px&lt;/code&gt;, and &lt;code&gt;%&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The smallest details often define the scalability and maintainability of a project. In CSS, the choice of unit—be it &lt;code&gt;rem&lt;/code&gt;, &lt;code&gt;px&lt;/code&gt;, &lt;code&gt;em&lt;/code&gt;, or &lt;code&gt;%&lt;/code&gt;—is a foundational architectural decision that impacts everything from accessibility to responsive design.&lt;/p&gt;

&lt;p&gt;As frontend development becomes more component-driven, understanding the context of each unit is essential to avoid common scaling pitfalls and build truly resilient UIs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkp45gqbdxxuipbgeporv.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkp45gqbdxxuipbgeporv.webp" alt=" " width="451" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if you are reading this ,chances are you might already know what these are, so, i am gonna be focusing on the when to use --aspect of things&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Scalable Standards: &lt;code&gt;rem&lt;/code&gt; and &lt;code&gt;em&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;These are your primary tools for creating UIs that adapt to user preferences and context.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The Root Master: &lt;code&gt;rem&lt;/code&gt; (Root Em)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition:&lt;/strong&gt; &lt;code&gt;rem&lt;/code&gt; is defined &lt;strong&gt;only&lt;/strong&gt; by the font size of the &lt;strong&gt;root element&lt;/strong&gt; (the &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; tag). If the root font size is 16px, then 1rem equals 16px, regardless of where it's used in the document.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Practice Use Cases:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Typography:&lt;/strong&gt; The cornerstone of accessibility. Using &lt;code&gt;rem&lt;/code&gt; ensures that all text scales uniformly when a user adjusts their browser's default font size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spacing and Layout:&lt;/strong&gt; Use &lt;code&gt;rem&lt;/code&gt; for margins, padding, and standardised component sizes. This links your design system's spacing scale directly to your typography scale, creating a harmonious and scalable interface.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The Contextual Relative: &lt;code&gt;em&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Definition:&lt;/strong&gt; The &lt;code&gt;em&lt;/code&gt; unit is relative to its &lt;strong&gt;direct parent's &lt;code&gt;font-size&lt;/code&gt;&lt;/strong&gt;. If the parent does not have an explicit font size defined, it inherits until it finds the closest ancestor that does.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The "Compounding" Gotcha:&lt;/strong&gt; Using nested elements styled with em can lead to unpredictable scaling because the value compounds: a child element with 1.2em inside a parent with 1.2em results in 1.44em (1.2×1.2) relative to the root.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Why not remove &lt;code&gt;em&lt;/code&gt; and only use &lt;code&gt;rem&lt;/code&gt;?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;While &lt;code&gt;rem&lt;/code&gt; is preferred for global consistency, &lt;code&gt;em&lt;/code&gt; remains vital for &lt;strong&gt;local, component-specific scaling&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Local Contextual Scaling (The Tooltip Example):&lt;/strong&gt; Use &lt;code&gt;em&lt;/code&gt; for padding or margins within an element whose sizing should directly adapt to its &lt;em&gt;own&lt;/em&gt; font size. For example, a button's padding or a tooltip's offset should increase proportionally if you adjust the button's font size—regardless of the root font size.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. The Absolute and Fixed: &lt;code&gt;px&lt;/code&gt; (Pixels)
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;px&lt;/code&gt; unit represents a fixed, absolute screen pixel. It is the unit of stability and precision.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Best Practice Use Cases (When Absolute Consistency is Required):&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Borders and Separators:&lt;/strong&gt; A $1\text{px}$ line should always be $1\text{px}$. Using &lt;code&gt;rem&lt;/code&gt; for a border would make it scale with the user's font preferences, which is almost never desired.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shadows and Blurs:&lt;/strong&gt; Shadows (&lt;code&gt;box-shadow&lt;/code&gt;) and filters are visual effects that rely on absolute values for crispness and consistency across zoom levels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fixed Size Assets and Icons:&lt;/strong&gt; When integrating external assets or standardized iconography where the size must be non-negotiable (e.g., a $24\text{px}$ icon within a $48\text{px}$ box).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. The Flexible Fluid: &lt;code&gt;%&lt;/code&gt; (Percentage)
&lt;/h2&gt;

&lt;p&gt;Percentage units are the workhorse of fluid, responsive layout, providing dynamism relative to a parent context.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Best Practice Use Cases:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fluid Layouts:&lt;/strong&gt; Setting widths of columns, containers, and grid items relative to the parent container.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Responsive Media:&lt;/strong&gt; Ensuring images and video elements scale correctly within their containers (e.g., &lt;code&gt;max-width: 100%&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The Fascinating Percentage Quirks (The Padding Paradox)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;You’ve likely encountered this "gotcha" when attempting to maintain an aspect ratio:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The Paradox:&lt;/strong&gt; When you apply &lt;code&gt;padding-top&lt;/code&gt; or &lt;code&gt;padding-bottom&lt;/code&gt; using a percentage, that percentage is calculated &lt;strong&gt;relative to the element’s WIDTH&lt;/strong&gt;, not its height.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The Height Ambiguity&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Width vs. Height Context:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Width&lt;/strong&gt; is almost always calculated relative to the parent’s content box, which nearly always has a defined width.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Height&lt;/strong&gt; often defaults to &lt;code&gt;auto&lt;/code&gt;. If the parent’s height is &lt;code&gt;auto&lt;/code&gt;, then setting &lt;code&gt;height: 100\%&lt;/code&gt; on the child has no fixed base to calculate from, often resulting in $0$ or just the height of the content.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  💡 The Modern Toolkit Summary
&lt;/h2&gt;

&lt;p&gt;For maximum control, maintainability, and accessibility, your unit usage should adhere to context:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Unit&lt;/th&gt;
&lt;th&gt;Context&lt;/th&gt;
&lt;th&gt;Example Use Cases&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;rem&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Global Scalability &amp;amp; Accessibility&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Typography, standardized margins/padding, component baseline sizes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;em&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Local, Self-Contained Context&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Padding/radius &lt;em&gt;within&lt;/em&gt; an element that needs to scale with its &lt;em&gt;own&lt;/em&gt; font size (e.g., button padding, tooltip).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;%&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Fluid Layout &amp;amp; Responsiveness&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Element widths, grid columns, media scaling (&lt;code&gt;max-width: 100\%&lt;/code&gt;).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;px&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Fixed, Unchanging Precision&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Borders, box shadows, subtle dividers, fixed-size icons.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note: Design Tokens are Your Backbone&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Before exposing these units directly, ensure you are leveraging **Design Tokens&lt;/em&gt;&lt;em&gt;. Good design systems (like Chakra UI) have already encapsulated these best practices, providing you with tokens like &lt;code&gt;spacing-md&lt;/code&gt; or &lt;code&gt;font-size-lg&lt;/code&gt; that resolve to the correct &lt;code&gt;rem&lt;/code&gt;, &lt;code&gt;px&lt;/code&gt;, or &lt;code&gt;em&lt;/code&gt; values, guaranteeing consistency across your entire codebase.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>css</category>
    </item>
  </channel>
</rss>
