Skip to content

[K9VULN-16456] Add additional generated file detections#932

Merged
jasonforal merged 8 commits into
mainfrom
jf/K9VULN-16456
Jun 25, 2026
Merged

[K9VULN-16456] Add additional generated file detections#932
jasonforal merged 8 commits into
mainfrom
jf/K9VULN-16456

Conversation

@jasonforal

@jasonforal jasonforal commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

Adds extra substring matches for common ecosystem code generators.

(This is an AI-generated PR, but it needed heavy steering and touch-ups. I've reviewed each commit.)

Java

Substring GitHub count
@javax.annotation.Generated 696k
This file is generated by 89k
This class was generated by 75k
by ANTLR 67k

JavaScript

Substring GitHub count
@generated by 10k
Auto-generated by 90k

Python

Substring GitHub count
file was automatically generated by 81k
Automatically generated by Colab 115k

Ruby

Substring GitHub count
# Code generated by 199k
This file is auto-generated from the current 288k

TypeScript

Substring GitHub count
@generated by 53k
auto-generated by 434k

Rust

Substring GitHub count
@generated by 61k
automatically generated by rust-bindgen 58k

Swift

Substring GitHub count
Generated by the Swift generator plugin for the protocol buffer compiler 22k
This file was automatically generated 31k

PHP

Substring GitHub count
@generated by Composer 394k
@generated by a phing 271k
This file has been auto-generated by the Symfony 530k

jasonforal and others added 8 commits June 25, 2026 10:17
Extends the Java match arm with banners emitted by:
- @javax.annotation.Generated (JSR-250, used by OpenAPI Generator,
  MapStruct, wsimport, JAXB)
- "This file is generated by" (jOOQ and similar SQL/IDL generators)
- JAXB/wsimport ("This class was generated by")
- ANTLR 4 ("// Generated from ... by ANTLR ...")

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ed by)

Extends the JavaScript match arm with:
- "@generated by" (protoc and similar tools that emit
  "@generated by <tool>" banners)
- "Auto-generated by" (pmndrs/gltfjsx React Three Fiber component
  generator and similar tools)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Extends the Python match arm with:
- "file was automatically generated by" (SWIG and similar tools that
  emit this prefix)
- "Automatically generated by Colab" (Colab-exported notebooks/scripts)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Extends the Ruby match arm with:
- "# Code generated by" (Speakeasy and other generators)
- "This file is auto-generated from the current"
  (Rails db/schema.rb)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ed by)

Extends the TypeScript match arm with:
- "@generated by" (protobuf-ts and similar; the trailing " by"
  avoids the webpack-alias false positives that bare "@generated"
  produces)
- "auto-generated by" (openapi-typescript and other tools that emit
  this lowercase prefix)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Matches banners emitted by:
- "@generated by" (prost / tonic gRPC, SeaORM)
- "automatically generated by rust-bindgen" (rust-bindgen C FFI)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Matches banners emitted by:
- "Generated by the Swift generator plugin for the protocol buffer
  compiler" (SwiftProtobuf)
- "This file was automatically generated" (Swift codegen tools)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Matches banners emitted by:
- "@generated by Composer" (Composer autoload files)
- "@generated by a phing" (Phing build tool task output)
- "This file has been auto-generated by the Symfony" (Symfony DI
  container cache)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@jasonforal
jasonforal marked this pull request as ready for review June 25, 2026 15:33
@jasonforal
jasonforal requested a review from a team as a code owner June 25, 2026 15:33
Copilot AI review requested due to automatic review settings June 25, 2026 15:33
@datadog-datadog-prod-us1

Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: No data available
Overall Coverage: 85.06% (+0.06%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: fd7d7fb | Docs | Datadog PR Page | Give us feedback!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands static-analysis-kernel’s generated-file heuristics by adding additional header substring detections for common generators across multiple ecosystems (Java, JS/TS, Python, Ruby, Rust, Swift, PHP), along with corresponding unit tests to reduce false negatives when deciding whether to skip analysis on generated sources.

Changes:

  • Added multiple new per-language header substring matches in is_generated_file.
  • Added/expanded unit tests to cover the new detection substrings (including new tests for PHP/Swift/Rust).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/static-analysis-kernel/src/analysis/generated_content.rs
@jasonforal
jasonforal merged commit 0e527b1 into main Jun 25, 2026
91 checks passed
@jasonforal
jasonforal deleted the jf/K9VULN-16456 branch June 25, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants