1 capture
22 May 2025
Apr MAY Jun
22
2024 2025 2026
success
fail

About this capture

COLLECTED BY

Collection: Save Page Now

TIMESTAMPS

The Wayback Machine - http://web.archive.org/web/20250522041751/https://github.com/github/codeql-go/pull/167
 

Skip to content  

Navigation Menu

 






Sign in  












GitHub Copilot  
Write better code with AI  



GitHub Models   New  
Manage and compare prompts  



GitHub Advanced Security  
Find and fix vulnerabilities  



Actions  
Automate any workflow  



Codespaces  
Instant dev environments  









Issues  
Plan and track work  



Code Review  
Manage code changes  



Discussions  
Collaborate outside of code  



Code Search  
Find more, search less  





Explore  

Why GitHub  

All features  

Documentation  

GitHub Skills  

Blog  









By company size  

Enterprises  

Small and medium teams  

Startups  

Nonprofits  



By use case  

DevSecOps  

DevOps  

CI/CD  

View all use cases  





By industry  

Healthcare  

Financial services  

Manufacturing  

Government  

View all industries  




View all solutions  






Topics  

AI

DevOps  

Security  

Software Development  

View all  





Explore  

Learning Pathways  

Events & Webinars  

Ebooks & Whitepapers  

Customer Stories  

Partners  

Executive Insights  













GitHub Sponsors  
Fund open source developers  







The ReadME Project  
GitHub community articles  



Repositories  

Topics  

Trending  

Collections  













Enterprise platform  
AI-powered developer platform  



Available add-ons  



GitHub Advanced Security  
Enterprise-grade security features  



Copilot for business  
Enterprise-grade AI features  



Premium Support  
Enterprise-grade 24/7 support  






Pricing
 



Search or jump to...  

Search code, repositories, users, issues, pull requests...




Clear

Search syntax tips 










Provide feedback  







We read every piece of feedback, and take your input very seriously.


 
 


Saved searches  

Use saved searches to filter your results more quickly

 






To see all available qualifiers, see our documentation.






 
 

Sign in  
//voltron/pull_requests_fragments/pull_request_layout;ref_cta:Sign up;ref_loc:header logged out"}">  Sign up  
Appearance settings  





Copy link  

Contributor  


@gagliardetto gagliardetto   commented  Jun 9, 2020    





Summary



This PR adds taint-tracking for many standard Go library packages for which (in my opinion) it makes sense to have taint tracking (I erred on the side of abundance).

Each taint-track was manually decided. CodeQL and golang code were generated from those decisions.

Each taint-tracked element has its own test scenario with golang code ( see https://github.com/gagliardetto/codeql-go/tree/taint-stdlib-a/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow )

The taint-tracking modules (one module per package, one package per file) are in https://github.com/gagliardetto/codeql-go/tree/taint-stdlib-a/ql/src/semmle/go/frameworks/stdlib

The Taint-Tracking Classes



For each std lib package, there is one file that contains the module and classes dedicated to the taint-tracking for that package.

Right now, the codeql classes are in their most human-friendly form (very easily readable); if performance requires it, they can be compressed (ugly-fied) in some very efficient ways.

The Golang Test Code



For each taint-tracking class, there is a simulation of that scenario in a Golang function.

I wrote a custom testing query to simplify my life and be able to visually inspect the results in vscode thanks to the CodeQL extension that highlights taint-tracking elements.

TODO



 Any other library you consider worth including?

 I'm still working on some more libraries taint-tracking, that should be added this week.

 Remove duplicates from https://github.com/github/codeql-go/blob/master/ql/src/semmle/go/frameworks/Stdlib.qll and also make sure I did not miss any taint-tracking currently implemented there.

 Establish a standardized directory and file hierarchy and logic.

 Right now, all of the taint-tracking modules are imported inside https://github.com/github/codeql-go/blob/master/ql/src/semmle/go/frameworks/Stdlib.qll (with import semmle.go.frameworks.stdlib.ImportAll), but the imports could be made more selective, deciding case by case.

 Compress (uglify) classes.

The Standard Library (from list available at https://godoc.org/-/go; see also https://golang.org/pkg/)


Go version: go version go1.14.1 linux/amd64

NOTE: ignored all internal and vendor packages.

Each item in the list is a package on its own; those that have a [x] are the ones that have been tracked and have tests.


 archive/tar

 archive/zip

 bufio

 builtin

 bytes

 cmd/api

 cmd/asm

 cmd/buildid

 cmd/cgo

 cmd/compile

 cmd/cover

 cmd/dist

 cmd/doc

 cmd/fix

 cmd/go

 cmd/gofmt

 cmd/link

 cmd/nm

 cmd/objdump

 cmd/pack

 cmd/pprof

 cmd/test2json

 cmd/trace

 cmd/vet

 compress/bzip2

 compress/flate

 compress/gzip

 compress/lzw

 compress/zlib

 container/heap

 container/list

 container/ring

 context

 crypto

 crypto/aes

 crypto/cipher

 crypto/des

 crypto/dsa

 crypto/ecdsa

 crypto/ed25519

 crypto/elliptic

 crypto/hmac

 crypto/md5

 crypto/rand

 crypto/rc4

 crypto/rsa

 crypto/sha1

 crypto/sha256

 crypto/sha512

 crypto/subtle

 crypto/tls

 crypto/x509

 crypto/x509/pkix

 database/sql

 database/sql/driver

 debug/dwarf

 debug/elf

 debug/gosym

 debug/macho

 debug/pe

 debug/plan9obj

 encoding

 encoding/ascii85

 encoding/asn1

 encoding/base32

 encoding/base64

 encoding/binary

 encoding/csv

 encoding/gob

 encoding/hex

 encoding/json

 encoding/pem

 encoding/xml

 errors

 expvar

 flag

 fmt

 go/ast

 go/build

 go/constant

 go/doc

 go/format

 go/importer

 go/parser

 go/printer

 go/scanner

 go/token

 go/types

 hash

 hash/adler32

 hash/crc32

 hash/crc64

 hash/fnv

 hash/maphash

 html

 html/template

 image

 image/color

 image/color/palette

 image/draw

 image/gif

 image/jpeg

 image/png

 index/suffixarray

 io

io/ioutil

 log

 log/syslog

 math

 math/big

 math/bits

 math/cmplx

 math/rand

 mime

 mime/multipart

 mime/quotedprintable

 net

 net/http

 net/http/cgi

 net/http/cookiejar

 net/http/fcgi

 net/http/httptest

 net/http/httptrace

 net/http/httputil

 net/http/pprof

 net/mail

 net/rpc

 net/rpc/jsonrpc

 net/smtp

 net/textproto

 net/url

 os

os/exec

 os/signal

 os/user

 path

 path/filepath

 plugin

 reflect

 regexp

 regexp/syntax

 runtime

 runtime/cgo

 runtime/debug

 runtime/pprof

 runtime/race

 runtime/trace

 sort

 strconv

 strings

 sync

 sync/atomic

 syscall

 syscall/js

 testing

 testing/iotest

 testing/quick

 text/scanner

 text/tabwriter

 text/template

 text/template/parse

 time

 unicode

 unicode/utf16

 unicode/utf8

 unsafe

 















gagliardetto   added 9commits  May 29, 2020 17:53











Add taint tracking through various standard libraries  






daf8fd6  













Add bytes package taint models  






99f8b9f  













Add compression libraries' models  






d8dfb80  













net: Add various connection types with their methods  






ca40434  













net: add Conn read and Conn  






3754dcd  













Add Taint tracking to standard methods: Read, ReadAt, Write  






2f3ce00  













Expand the standard library taint-tracking to include 67 libraries in    






a9ab76b  



… total












Add taint-tracking for WriteAt method  






2dcf39d  













Add "import semmle.go.frameworks.stdlib.ImportAll" to semmle.go.frame    






bc5c13c  



…works.Stdlib.qll













Copy link  

Contributor  


max-schaefer   commented  Jun 9, 2020  



Wow, thanks very much for tackling this very ambitious project! We'll hold off on reviewing for now, let us know when it's ready.

















gagliardetto   added 20commits  June 10, 2020 11:31











Fix ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow.expected  






f0e36e2  













Regenerate codeql and golang: v2  






87fcad5  













StdlibTaintFlow: Regenerate golang test scenarios' code  






054b420  













Regenerate go files  






4f4bacb  













Remove taint tracking class  






1b697b6  













Use a deterministic number generator for var names  






480e2a6  













Regenerate .expect  






9c24559  













frameworks/Stdlib.qll: remove duplicated module Net  






6b22671  













frameworks/Stdlib.qll: remove duplicated module CompressZlib  






6bb6a2b  













frameworks/Stdlib.qll: remove duplicated module CompressLzw  






30ee42e  













frameworks/Stdlib.qll: remove duplicated module CompressFlate  






47aa512  













frameworks/Stdlib.qll: remove duplicated module CompressBzip2  






9468f1b  













frameworks/Stdlib.qll: remove duplicated module CompressGzip  






b907ccb  













frameworks/Stdlib.qll: remove duplicated module EncodingCsv  






18f972d  













frameworks/Stdlib.qll: remove duplicated module TextScanner  






9de11e8  













frameworks/Stdlib.qll: remove duplicated module CryptoCipher  






b313cf4  













frameworks/Stdlib.qll: remove duplicate taint-tracking  






01e54d1  













Remove TaintStepTest_SyscallUnixCredentials_B0I0O0  






a7a474b  













Fix tests  






cb02cc8  













Merge branch 'master' into taint-stdlib-a  






0770782  

















Copy link  

Contributor  


max-schaefer   commented  Jul 6, 2020  



Looks good, thanks!

















This was referenced Jul 6, 2020


Add taint-tracking for methods: Read, ReadAt, Write, WriteAt  #244  

Closed  





Add taint-tracking for archive/tar and archive/zip  #251  

Merged  






@sauyon sauyon  removed their assignment  Jul 11, 2020  





This was referenced Aug 4, 2020


Add taint tracking for bufio and bytes packages  #274  

Merged  





Add taint tracking for the compress/* packages  #276  

Merged  






@max-schaefer max-schaefer  changed the base branch from   master  to main   August 10, 2020 15:58 





This was referenced Sep 1, 2020


Add taint-tracking for reflect package  #317  

Merged  





Move path and path/filepath packages to stdlib  #316  

Merged  





Move strconv and strings packages' taint-tracking to stdlib, and expand them  #318  

Closed  





Add taint-tracking for packages inside text/*  #320  

Merged  





Add taint-tracking for packages inside mime/*  #321  

Merged  





Add taint-tracking for packages in html/*  #322  

Merged  





Add taint-tracking for packages in encoding/*  #323  

Merged  







This was referenced Sep 12, 2020


Add taint-tracking for context package  #331  

Merged  





Add taint-tracking for sync and sync/atomic  #332  

Merged  





Add taint-tracking for syscall  #333  

Merged  





Add taint-tracking for package sort  #334  

Merged  





Expand taint-tracking for ospackage  #336  

Merged  





Add taint-tracking for packages inside net/* (except for net/url, which was left as-is)  #337  

Merged  





Add taint-tracking for errors, expvar, database/sql, database/sql/driver packages  #342  

Merged  





Move to stdlib and extend the models for fmt package  #341  

Merged  





Move to stdlib and expand taint-tracking for ioand io/ioutil packages  #340  

Merged  





Move and extend Log module for package log with taint-tracking  #339  

Merged  







This was referenced Sep 21, 2020


Add taint-tracking for container/* packages  #346  

Merged  





Add taint-tracking for crypto/* packages  #347  

Merged  





Remove duplicate models (the end)  #353  

Merged  











Copy link  

Contributor   Author  


gagliardetto   commented  Sep 24, 2020  



All PRs merged. Closing.
















@gagliardetto gagliardetto  closed this  Sep 24, 2020  






@gagliardetto gagliardetto  mentioned this pull request   Sep 24, 2020  


codeql-go: Expand Go standard library taint-tracking models to 63 packages, 554 models and 733 tests (from ~13 packages, ~103 models, ~50 tests)  github/securitylab#187  

Closed  


1 task  








Sign up for free  to subscribe to this conversation on GitHub.  Already have an account?  Sign in.  








Reviewers
No reviews

Assignees
No one assigned

Labels  

None yet



Projects
None yet

Milestone
No milestone



Development

Successfully merging this pull request may close these issues.






3 participants  








Add this suggestion to a batch that can be applied as a single commit.  This suggestion is invalid because no changes were made to the code.  Suggestions cannot be applied while the pull request is closed.  Suggestions cannot be applied while viewing a subset of changes.  Only one suggestion per line can be applied in a batch.  Add this suggestion to a batch that can be applied as a single commit.  Applying suggestions on deleted lines is not supported.  You must change the existing code in this line in order to create a valid suggestion.  Outdated suggestions cannot be applied.  This suggestion has been applied or marked resolved.  Suggestions cannot be applied from pending reviews.  Suggestions cannot be applied on multi-line comments.  Suggestions cannot be applied while the pull request is queued to merge.  Suggestion cannot be applied right now. Please check back later.  




Footer



© 2025 GitHub, Inc.  


Terms  

Privacy  

Security  

Status  

Docs  

Contact  






You cant perform that action at this time.