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

      5 preinstalled apps you should delete from your Samsung phone immediately

      July 30, 2025

      Ubuntu Linux lagging? Try my 10 go-to tricks to speed it up

      July 30, 2025

      How I survived a week with this $130 smartwatch instead of my Garmin and Galaxy Ultra

      July 30, 2025

      YouTube is using AI to verify your age now – and if it’s wrong, that’s on you to fix

      July 30, 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

      Time-Controlled Data Processing with Laravel LazyCollection Methods

      July 30, 2025
      Recent

      Time-Controlled Data Processing with Laravel LazyCollection Methods

      July 30, 2025

      Create Apple Wallet Passes in Laravel

      July 30, 2025

      The Laravel Idea Plugin is Now FREE for PhpStorm Users

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

      New data shows Xbox is utterly dominating PlayStation’s storefront — accounting for 60% of the Q2 top 10 game sales spots

      July 30, 2025
      Recent

      New data shows Xbox is utterly dominating PlayStation’s storefront — accounting for 60% of the Q2 top 10 game sales spots

      July 30, 2025

      Opera throws Microsoft to Brazil’s watchdogs for promoting Edge as your default browser — “Microsoft thwarts‬‭ browser‬‭ competition‬‭‬‭ at‬‭ every‬‭ turn”

      July 30, 2025

      Activision once again draws the ire of players for new Diablo Immortal marketing that appears to have been made with generative AI

      July 30, 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

    5 preinstalled apps you should delete from your Samsung phone immediately

    July 30, 2025
    News & Updates

    Ubuntu Linux lagging? Try my 10 go-to tricks to speed it up

    July 30, 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

    CVE-2025-47702 – Drupal oEmbed Providers Cross-Site Scripting (XSS)

    Common Vulnerabilities and Exposures (CVEs)

    Betting apps in Bangladesh review

    Learning Resources

    The dead giveaway that ChatGPT wrote your content – and how to work around it

    News & Updates

    CVE-2025-20284 – Cisco ISE/PIC Root Execution Remote Command Injection

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    CVE-2025-20977 – Samsung Notes Implicit Intent Information Leak Vulnerability

    May 7, 2025

    CVE ID : CVE-2025-20977

    Published : May 7, 2025, 9:15 a.m. | 2 hours, 20 minutes ago

    Description : Use of implicit intent for sensitive communication in translation in Samsung Notes prior to version 4.4.29.23 allows local attackers to get sensitive information. User interaction is required for triggering this vulnerability.

    Severity: 3.3 | LOW

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

    CVE-2024-13962 – Avast Cleanup Premium Link Following Local Privilege Escalation Vulnerability

    May 9, 2025

    JSHint – static code analysis tool

    July 25, 2025

    NVIDIA’s RTX 5060 GPUs are official — $299 starting price, massive performance gains

    April 15, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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