Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      The Ultimate Guide to Node.js Development Pricing for Enterprises

      July 29, 2025

      Stack Overflow: Developers’ trust in AI outputs is worsening year over year

      July 29, 2025

      Web Components: Working With Shadow DOM

      July 28, 2025

      Google’s new Opal tool allows users to create mini AI apps with no coding required

      July 28, 2025

      I replaced my Samsung OLED TV with this Sony Mini LED model for a week – and didn’t regret it

      July 29, 2025

      I tested the most popular robot mower on the market – and it was a $5,000 crash out

      July 29, 2025

      5 gadgets and accessories that leveled up my gaming setup (including a surprise console)

      July 29, 2025

      Why I’m patiently waiting for the Samsung Z Fold 8 next year (even though the foldable is already great)

      July 29, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Performance Analysis with Laravel’s Measurement Tools

      July 29, 2025
      Recent

      Performance Analysis with Laravel’s Measurement Tools

      July 29, 2025

      Memoization and Function Caching with this PHP Package

      July 29, 2025

      Laracon US 2025 Livestream

      July 29, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft mysteriously offered a Windows 11 upgrade to this unsupported Windows 10 PC — despite it failing to meet the “non-negotiable” TPM 2.0 requirement

      July 29, 2025
      Recent

      Microsoft mysteriously offered a Windows 11 upgrade to this unsupported Windows 10 PC — despite it failing to meet the “non-negotiable” TPM 2.0 requirement

      July 29, 2025

      With Windows 10’s fast-approaching demise, this Linux migration tool could let you ditch Microsoft’s ecosystem with your data and apps intact — but it’s limited to one distro

      July 29, 2025

      Windows 10 is 10 years old today — let’s look back at 10 controversial and defining moments in its history

      July 29, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: IsValidToken

    CodeSOD: IsValidToken

    July 29, 2025

    To ensure that several services could only be invoked by trusted parties, someone at Ricardo P‘s employer had the brilliant idea of requiring a token along with each request. Before servicing a request, they added this check:

    private bool IsValidToken(string? token)
    {
        if (string.Equals("xxxxxxxx-xxxxxx+xxxxxxx+xxxxxx-xxxxxx-xxxxxx+xxxxx", token)) return true;
        return false;
    }
    

    The token is anonymized here, but it’s hard-coded into the code, because checking security tokens into source control, and having tokens that never expire has never caused anyone any trouble.

    Which, in the company’s defense, they did want the token to expire. The problem there is that they wanted to be able to roll out the new token to all of their services over time, which meant the system had to be able to support both the old and new token for a period of time. And you know exactly how they handled that.

    private bool IsValidToken(string? token)
    {
        if (string.Equals("xxxxxxxx-xxxxxx+xxxxxxx+xxxxxx-xxxxxx-xxxxxx+xxxxx", token)) return true;
        else if (string.Equals("yyyyyyy-yyyyyy+yyyyy+yyyyy-yyyyy-yyyyy+yyyy", token)) return true;
        return false;
    }
    

    For a change, I’m more mad about this insecurity than the if(cond) return true pattern, but boy, I hate that pattern.

    [Advertisement]
    Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleFirefox Add-Ons Website Revamps Listing Pages
    Next Article XO – configurable ESLint wrapper

    Related Posts

    News & Updates

    I replaced my Samsung OLED TV with this Sony Mini LED model for a week – and didn’t regret it

    July 29, 2025
    News & Updates

    I tested the most popular robot mower on the market – and it was a $5,000 crash out

    July 29, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    Ubuntu 25.10 Switches to Rust-based sudo

    Linux

    CVE-2025-2802 – WordPress LayoutBoxx Plugin Shortcode Execution Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Sam Altman says the Singularity is imminent – here’s why

    News & Updates

    ChatGPT’s subscribers and revenue soar in 2025 – here’s why

    News & Updates

    Highlights

    CVE-2025-27891 – Samsung Exynos Modem NAS Packet Length Check Vulnerability

    May 14, 2025

    CVE ID : CVE-2025-27891

    Published : May 14, 2025, 9:15 p.m. | 1 hour, 51 minutes ago

    Description : An issue was discovered in Samsung Mobile Processor, Wearable Processor, and Modem Exynos 980, 990, 850, 1080, 2100, 1280, 2200, 1330, 1380, 1480, 2400, 9110, W920, W930, W1000, Modem 5123, Modem 5300, and Modem 5400. The lack of a length check leads to out-of-bounds reads via malformed NAS packets.

    Severity: 0.0 | NA

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    CVE-2025-7511 – Code-projects Chat System SQL Injection Vulnerability

    July 13, 2025

    Samsung’s 500Hz gaming monitor isn’t just wicked fast — it overcomes a big OLED flaw

    May 13, 2025

    Dell’s new Pro Max lineup offers top-tier laptops for sky-high prices

    July 17, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.