All notable changes to this project are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Add C++
thisand function call patterns toincorrect-use-of-sizeof. - Add detections for
confstr,ttyname_r/ptsname_r,strfind/strrspn/strtrns,readlinkat,fgetws/fgetws_l,*cftime,chdir,chroot,copylist,dbminit,fattach,ftw,truncate,umask/ulimit,cdev_init,inet_*,utmp*,OemToCharW,mbs/wcs,*spawn*,CreateProcess*, and missingget*family functions (interesting-api-calls). - Add detections for some Microsoft-specific functions (
interesting-api-calls). - Add detections for missing
str*family functions (insecure-api-strcpy-strcat,interesting-api-calls,overlapping-src-dst,write-into-stack-buffer). - Add detections for
mempcpyandwmempcpy(use-of-source-size-in-copy,interesting-api-calls,overlapping-src-dst,signed-unsigned-conversion,write-into-stack-buffer). - Add detections for
swprintfandvswprintf(signed-insigned-conversion,write-into-stack-buffer). - Add detection for
p2openandwordexp(command-injection,interesting-api-calls). - Add detections for
faccessat,faccessat2, andfstatat(insecure-api-access-stat,interesting-api-calls). - Add detections for
rand48family functions (insecure-api-rand-srand,interesting-api-calls). - Add detections for
sysloganderr/warnfunction families (memory-address-exposure). - Add detections for missing
signalfamily functions (insecure-api-signal,interesting-api-calls). - Add detection for
tmpnam_r(insecure-api-mktemp-tmpnam-tempnam,interesting-api-calls). - Add detection for
VirtualAlloc(integer-wraparound). - Add detection for
syscall(interesting-api-calls). - Add some code samples (
command-injection,format-string-bugs,incorrect-use-of-sizeof,insecure-api-access-stat,insecure-api-gets,insecure-api-scanf,insecure-api-sprintf-vsprintf,interesting-api-calls,off-by-one,unsafe-ret-snprintf-vsnprintf,use-after-free,use-of-source-size-in-copy,unterminated-string-strncpy). - Add required metadata to contribute rules to the Semgrep Registry.
- Add
prettier-checkGitHub action to check YAML formatting.
- Extend
*s*printfpattern matching (interesting-api-calls). - Improve matching of array creation patterns (
incorrect-use-of-free,putenv-stack-var,ret-stack-address,write-into-stack-buffer). - Improve matching of array creation and length calculation (
off-by-one). - Optimize uses of the deep expression operator (
unchecked-ret-malloc,use-after-free). - Exclude string literals as source (
insecure-api-scanf). - Add detections for
snprintffamily functions and improve pattern matching (use-of-source-size-in-copy). - Replace the pattern
= $_;with= ...;everywhere. - Rename
incorrect-order-setuid-setgid-etcintoincorrect-order-setuid-setgid. - Rename
incorrect-use-of-strncpy-memcpy-etcintouse-of-source-size-in-copy. - Rename
insecure-api-scanf-etcintoinsecure-api-scanf. - Rename
unchecked-ret-scanf-etcintounchecked-ret-scanf. - Rename
insecure-api-strcpy-stpcpy-strcatintoinsecure-api-strcpy-strcat. - Rename
unterminated-string-strncpy-stpncpyintounterminated-string-strncpy. - Rename
unchecked-ret-malloc-calloc-reallocintounchecked-ret-malloc. - Rename
insecure-api-access-stat-lstatintoinsecure-api-access-stat. - Rename
insecure-api-atoi-atol-atofintoinsecure-api-ato. - Rearrange rule order based on new subcategory/likelihood/impact metrics.
- Improve documentation.
- Update SARIF output example.
1.1.0 - 2025-12-03
- Add
high-entropy-assignmentandregex-dosrules that use the new metavariable-analysis feature. - Add detections for the
__iso99_*scanffunction family (format-string-bugs,insecure-api-scanf,unchecked-ret-scanf). - Add detections for the
_mb*and*_s/*_lfunction families (insecure-api-strcpy-stpcpy-strcat,interesting-api-calls,unsafe-ret-strlcpy-strlcat,unsafe-strlen,unterminated-string-strncpy-stpncpy,write-into-stack-buffer). - Add some code samples (
incorrect-use-of-strncpy-memcpy-etc,integer-wraparound,overlapping-src-dst). - Add SARIF output example as requested.
- Add GitHub action to automate rule validation and testing.
- Rename
incorrect-use-of-strncpy-stpncpy-strlcpyintoincorrect-use-of-strncpy-memcpyand add matching ofmemcpyand its main variants. - Rename
incorrect-use-of-sprintf-snprintfintooverlapping-src-dstand add matching of other copy functions. - Exclude length known at compile time from
memcpymatches (interesting-api-calls). - Explicitly exclude
$_ = 0assignments to reduce false positives (integer-truncation,signed-unsigned-conversion). - Refactor some rules to include other variants and improve readability and scalability (
unsafe-ret-snprintf-vsnprintf,unsafe-ret-strlcpy-strlcat,unsafe-strlen). - Implement case-insensitive matching (
interesting-api-calls). - Reduce false positives (
format-string-bugs,putenv-stack-var,ret-stack-address,unsafe-ret-snprintf-vsnprintf,write-into-stack-buffer). - Use the new anonymous metavariables feature where suitable.
- Optimize some patterns (
integer-truncation,integer-wraparound,mismatched-memory-management,mismatched-memory-management-cpp,off-by-one,write-into-stack-buffer,missing-return). - Change some confidence levels (
integer-truncation,integer-wraparound,putenv-stack-var,ret-stack-address). - Move rules into a dedicated folder.
- Improve documentation and code formatting.
- Remove non-existent API functions (
insecure-api-strcpy-stpcpy-strcat,unterminated-string-strncpy-stpncpy).
1.0.0 - 2025-09-26
Historical, battle-tested stable release.