<?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>DEV Community: Nexus Verify</title>
    <description>The latest articles on DEV Community by Nexus Verify (@nexusverify).</description>
    <link>https://dev.to/nexusverify</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4239443%2F84bad731-7199-40a1-845d-86ea53ad352f.png</url>
      <title>DEV Community: Nexus Verify</title>
      <link>https://dev.to/nexusverify</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nexusverify"/>
    <language>en</language>
    <item>
      <title>Weak randomness that protects nothing — and the one that only looks harmless</title>
      <dc:creator>Nexus Verify</dc:creator>
      <pubDate>Wed, 25 Nov 2026 15:56:47 +0000</pubDate>
      <link>https://dev.to/nexusverify/weak-randomness-that-protects-nothing-and-the-one-that-only-looks-harmless-3h5i</link>
      <guid>https://dev.to/nexusverify/weak-randomness-that-protects-nothing-and-the-one-that-only-looks-harmless-3h5i</guid>
      <description>&lt;p&gt;"Weak randomness" sounds like a verdict. In a scanner report it is only a pointer — and this teardown is about the two times that pointer landed in a real run, and why neither one meant what the label suggested.&lt;/p&gt;

&lt;p&gt;This is from a run we publish so builders can see what a check actually looks like before they buy one. No client code was involved. Two public Java codebases, scanned as-is with a frozen OWASP rule set (Semgrep 1.140.0):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MyBatis JPetStore-6&lt;/strong&gt; — an online-store web app: 46 Java files, 7,628 lines&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spark (perwendel/spark)&lt;/strong&gt; — a Java web framework: 184 Java files, 21,272 lines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Total: &lt;strong&gt;230 files, 28,900 lines, about 46 seconds. 16 findings issued, every one read in context and dispositioned: 1 real fix (low), 1 informational, 14 not-a-defect.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An earlier teardown in this series covered the one real fix (a deletion cookie missing its Secure flag). This one is about CWE-330 — weak randomness — the smallest category in the report: exactly two hits.&lt;/p&gt;

&lt;h2&gt;
  
  
  What was checked
&lt;/h2&gt;

&lt;p&gt;The rule set covers, among others, weak randomness (CWE-330), SQL injection (CWE-89), and insecure cookies (CWE-614). It reads Java source only. Code or logic living in XML mappers, configuration, or another language is outside its sight, and the report says so out loud — "not checked" is never dressed up as "checked and clean."&lt;/p&gt;

&lt;h2&gt;
  
  
  Hit one: a random number that guards nothing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;JPetStore-6, &lt;code&gt;.mvn/wrapper/MavenWrapperDownloader.java:97&lt;/code&gt; — CWE-330, &lt;code&gt;ThreadLocalRandom.current().nextLong()&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Read in context, the value does one job: it helps name a temporary file while the Maven wrapper downloads itself during a build. It is not a session token. It is not a reset code, an ID anyone can guess their way into, or a key. Nothing an attacker wants depends on whether that number is predictable.&lt;/p&gt;

&lt;p&gt;Disposition: &lt;strong&gt;not a defect.&lt;/strong&gt; A random value only matters to security when something trusts it — when guessing it gets you in, resets something, or reveals something. Here, guessing it gets you the name of a temp file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hit two: harmless here, hazardous as a habit
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Spark, &lt;code&gt;src/test/java/spark/examples/books/Books.java:48&lt;/code&gt; — CWE-330, &lt;code&gt;new Random()&lt;/code&gt; minting an ID in the bundled example app.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This one is the mirror image. In its actual home — a demo app inside a test tree — predictable IDs hurt nobody; it is example code showing how the framework works. So it is not a defect either.&lt;/p&gt;

&lt;p&gt;Disposition: &lt;strong&gt;informational&lt;/strong&gt; — and that word is doing real work. Example code is the most-copied code in any ecosystem. The day that &lt;code&gt;new Random()&lt;/code&gt; ID pattern gets pasted into production — into order IDs, invite links, password-reset tokens, anything sequential-or-guessable that an outsider can enumerate — it becomes a genuine vulnerability with a quiet origin: "it came from the framework's own example."&lt;/p&gt;

&lt;p&gt;Same rule, same label, two different reasons to stand down — and a third case, the production copy, where the correct answer would have been "fix this first."&lt;/p&gt;

&lt;h2&gt;
  
  
  The question that separates them
&lt;/h2&gt;

&lt;p&gt;For any weak-randomness hit, one question does most of the adjudication:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What breaks if someone can predict this number?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nothing depends on it (a temp-file name) → not a defect, with the reason written down.&lt;/li&gt;
&lt;li&gt;Something demo-only depends on it (an example app's IDs) → informational; flag the pattern, not the file.&lt;/li&gt;
&lt;li&gt;Access, money, identity, or recovery depends on it (tokens, reset codes, production IDs) → real finding, fix before launch, with a cryptographically secure generator.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A scanner cannot ask that question. It does not know what your number protects. That is not a scanner failure — it is the boundary of what pattern matching is, and the reason the human read is part of the service rather than an apology for the tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers underneath
&lt;/h2&gt;

&lt;p&gt;This rule set was not tuned for this sample. On its labeled calibration corpus (OWASP Benchmark v1.2, scored blind — the detector never saw the answer file), it measured &lt;strong&gt;precision 0.7169 and Youden J 0.4100&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In plain terms: hits that do not survive reading are expected, budgeted behavior. In this run the full tally was 1 real fix (Spark's deletion cookie, &lt;code&gt;Response.java:314&lt;/code&gt;, missing the Secure flag), 1 informational (the example-code randomness above), and 14 not-a-defect — each with its reason printed beside it, including the four "SQL injection" warnings in a routing file that contains no SQL at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a builder can use from this
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ask what the number protects before you touch the code.&lt;/strong&gt; Severity lives in the dependency, not in the generator's name.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat example code as future production code.&lt;/strong&gt; Audit the patterns your examples teach, because your users will copy them verbatim.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write the disposition down.&lt;/strong&gt; "Not a defect — value names a temp file, protects nothing" can be re-checked in seconds a year from now. An unexplained dismissal has to be re-argued from scratch.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;If you want this kind of check on your own app before launch, the intake is at verify.novitasnexus.com — &lt;a href="mailto:verify@novitasnexus.com"&gt;verify@novitasnexus.com&lt;/a&gt; if you prefer email.&lt;/p&gt;

</description>
      <category>java</category>
      <category>opensource</category>
      <category>security</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>The deletion cookie that forgot Secure — a teardown of 230 Java files in 46 seconds</title>
      <dc:creator>Nexus Verify</dc:creator>
      <pubDate>Wed, 11 Nov 2026 16:03:56 +0000</pubDate>
      <link>https://dev.to/nexusverify/the-deletion-cookie-that-forgot-secure-a-teardown-of-230-java-files-in-46-seconds-o47</link>
      <guid>https://dev.to/nexusverify/the-deletion-cookie-that-forgot-secure-a-teardown-of-230-java-files-in-46-seconds-o47</guid>
      <description>&lt;p&gt;Most security scans end with a long list and no clear answer to "so what do I fix first?"&lt;/p&gt;

&lt;p&gt;This teardown is from a real run — the sample scan we publish so builders can see exactly what a check looks like before they buy one. No client code was involved. The targets were two public Java codebases, scanned as-is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MyBatis JPetStore-6&lt;/strong&gt; — a real online-store web app: 46 Java files, 7,628 lines&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spark (perwendel/spark)&lt;/strong&gt; — a Java web framework: 184 Java files, 21,272 lines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Total: &lt;strong&gt;230 files, 28,900 lines, about 46 seconds of instrument time.&lt;/strong&gt; The instrument was Semgrep 1.140.0 with a frozen set of OWASP-category rules for Java — SQL injection, XSS, command injection, path traversal, weak crypto, weak randomness, insecure cookies, and others. It reads Java source only; anything living in XML mappers or config is outside its sight, and we say so in the report.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Findings issued: 16. Every one was read in context and dispositioned.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually broke
&lt;/h2&gt;

&lt;p&gt;One real fix, low severity — and it's the kind of bug almost nobody writes on purpose:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spark, &lt;code&gt;Response.java:314&lt;/code&gt; — the cookie that deletes a cookie was built without the Secure flag.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Spark's normal cookie path does this right. Its deletion path didn't carry the same flag. A deletion cookie should carry the same protections as the cookie it replaces. Otherwise you have one code path that respects your cookie policy and a second, quieter path that doesn't.&lt;/p&gt;

&lt;p&gt;The fix is one line. The lesson is bigger:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Check every path that sets a cookie — create, update, &lt;em&gt;and&lt;/em&gt; delete. Frameworks and apps usually secure the happy path. The cleanup path is where the flag gets dropped.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you ship anything with session cookies, grep for every cookie construction in your codebase today — not just the login handler.&lt;/p&gt;

&lt;h2&gt;
  
  
  What held — and why we report it anyway
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;JPetStore-6: 1 finding, not a defect.&lt;/strong&gt; A &lt;code&gt;ThreadLocalRandom&lt;/code&gt; call in the Maven wrapper downloader names a temporary file during a build-tool download. It protects nothing, so weak randomness there is not a security problem. Counted, explained, no fix recommended.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spark, &lt;code&gt;Response.java:292&lt;/code&gt;: not a defect.&lt;/strong&gt; This is the correct normal cookie method. It calls &lt;code&gt;setSecure(secured)&lt;/code&gt; from its own parameter. A pattern scanner can't see that the flag is parameterized, so it fired anyway. We note it so a reader can see &lt;em&gt;why&lt;/em&gt; a hit was dismissed, not just that it was.&lt;/p&gt;

&lt;h2&gt;
  
  
  The noise, counted in the open
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;4 × SQL injection (CWE-89) in Spark's route dispatcher — false positives.&lt;/strong&gt; The lines are route-dispatch calls like &lt;code&gt;Routes.execute(...)&lt;/code&gt;. The file contains no SQL at all. The rule's sink pattern binds on a generic &lt;code&gt;execute(...)&lt;/code&gt; shape. That's a known collision class.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;8 × insecure cookie in test code.&lt;/strong&gt; Mock verifications asserting that a cookie method was called. They set no cookies. Counted here, excluded from the fix list.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1 × weak randomness in example code.&lt;/strong&gt; &lt;code&gt;new Random()&lt;/code&gt; minting an ID in a bundled example app. Fine in a demo. It would be a real problem if that pattern were copied into production — predictable IDs are guessable IDs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tally: &lt;strong&gt;1 real fix (low), 1 informational, 14 not-a-defect — each with the reason printed beside it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the labeled benchmark corpus where this same rule set was calibrated, its measured precision was 0.7169. In plain terms: even a decent scanner will hand you hits that don't survive reading. The reading is the service.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a builder can use from this
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Audit cookie deletion as well as cookie creation.&lt;/strong&gt; Same flags, every path.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't let example-code randomness reach production.&lt;/strong&gt; &lt;code&gt;new Random()&lt;/code&gt; for IDs, tokens, or filenames that matter is a defect; for a throwaway temp name, it isn't. Context decides.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Demand dispositions, not just counts.&lt;/strong&gt; "16 findings" means nothing until each one is marked real, informational, or not-a-defect with a reason. If a report won't show its dismissals, you can't trust its fixes.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;If you want this kind of check on your own app before launch, the intake is at verify.novitasnexus.com — &lt;a href="mailto:verify@novitasnexus.com"&gt;verify@novitasnexus.com&lt;/a&gt; if you prefer email.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>infosec</category>
      <category>java</category>
      <category>security</category>
    </item>
  </channel>
</rss>
