Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions go/ql/lib/ext/context.model.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@
"extensible": "summaryModel"
},
"data": [
// AfterFunc should be modeled when callback-based library models are supported.
["context", "", false, "Cause", "", "", "Argument[0]", "ReturnValue", "taint", "manual"],
["context", "", false, "WithCancel", "", "", "Argument[0]", "ReturnValue[0]", "taint", "manual"],
["context", "", false, "WithDeadline", "", "", "Argument[0]", "ReturnValue[0]", "taint", "manual"],
["context", "", false, "WithDeadlineCause", "", "", "Argument[0]", "ReturnValue[0]", "taint", "manual"],
["context", "", false, "WithDeadlineCause", "", "", "Argument[2]", "ReturnValue[0]", "taint", "manual"],
["context", "", false, "WithTimeout", "", "", "Argument[0]", "ReturnValue[0]", "taint", "manual"],
["context", "", false, "WithTimeoutCause", "", "", "Argument[0]", "ReturnValue[0]", "taint", "manual"],
["context", "", false, "WithTimeoutCause", "", "", "Argument[2]", "ReturnValue[0]", "taint", "manual"],
["context", "", false, "WithValue", "", "", "Argument[0..2]", "ReturnValue", "taint", "manual"],
["context", "", false, "WithoutCancel", "", "", "Argument[0]", "ReturnValue", "taint", "manual"],
["context", "Context", true, "Value", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"]
]
}
Expand Down
20 changes: 19 additions & 1 deletion go/ql/lib/ext/crypto.tls.model.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,26 @@
},
"data": [
["crypto/tls", "", false, "Client", "", "", "Argument[0]", "ReturnValue", "taint", "manual"],
["crypto/tls", "", false, "NewResumptionState", "", "", "Argument[0..1]", "ReturnValue[0]", "taint", "manual"],
["crypto/tls", "", false, "NewResumptionState", "", "", "Argument[1].Dereference.Field[crypto/tls.SessionState.Extra]", "ReturnValue[0]", "taint", "manual"],
["crypto/tls", "", false, "NewListener", "", "", "Argument[0]", "ReturnValue", "taint", "manual"],
["crypto/tls", "", false, "Server", "", "", "Argument[0]", "ReturnValue", "taint", "manual"]
["crypto/tls", "", false, "ParseSessionState", "", "", "Argument[0]", "ReturnValue[0]", "taint", "manual"],
["crypto/tls", "", false, "QUICClient", "", "", "Argument[0]", "ReturnValue", "taint", "manual"],
["crypto/tls", "", false, "QUICServer", "", "", "Argument[0]", "ReturnValue", "taint", "manual"],
Comment thread
owen-mc marked this conversation as resolved.
Resolved
["crypto/tls", "", false, "Server", "", "", "Argument[0]", "ReturnValue", "taint", "manual"],
["crypto/tls", "ClientSessionState", true, "ResumptionState", "", "", "Argument[receiver]", "ReturnValue[0..1]", "taint", "manual"],
["crypto/tls", "Config", true, "DecryptTicket", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"],
["crypto/tls", "Config", true, "DecryptTicket", "", "", "Argument[0]", "ReturnValue[0]", "taint", "manual"],
["crypto/tls", "Config", true, "EncryptTicket", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"],
["crypto/tls", "Config", true, "EncryptTicket", "", "", "Argument[1]", "ReturnValue[0]", "taint", "manual"],
["crypto/tls", "Config", true, "EncryptTicket", "", "", "Argument[1].Dereference.Field[crypto/tls.SessionState.Extra]", "ReturnValue[0]", "taint", "manual"],
["crypto/tls", "QUICConn", true, "ConnectionState", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"],
["crypto/tls", "QUICConn", true, "HandleData", "", "", "Argument[1]", "Argument[receiver]", "taint", "manual"],
["crypto/tls", "QUICConn", true, "NextEvent", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"],
["crypto/tls", "QUICConn", true, "SetTransportParameters", "", "", "Argument[0]", "Argument[receiver]", "taint", "manual"],
["crypto/tls", "SessionState", true, "Bytes", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"],
["crypto/tls", "SessionState", true, "Bytes", "", "", "Argument[receiver].Dereference.Field[crypto/tls.SessionState.Extra]", "ReturnValue[0]", "taint", "manual"],
["crypto/tls", "SessionState", true, "Bytes", "", "", "Argument[receiver].Field[crypto/tls.SessionState.Extra]", "ReturnValue[0]", "taint", "manual"]
]
}
]
Expand Down
2 changes: 2 additions & 0 deletions go/ql/lib/ext/io.fs.model.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
},
"data": [
["io/fs", "", false, "FileInfoToDirEntry", "", "", "Argument[0]", "ReturnValue", "taint", "manual"],
["io/fs", "", false, "FormatDirEntry", "", "", "Argument[0]", "ReturnValue", "taint", "manual"],
["io/fs", "", false, "FormatFileInfo", "", "", "Argument[0]", "ReturnValue", "taint", "manual"],
Comment thread
owen-mc marked this conversation as resolved.
Resolved
["io/fs", "", false, "Glob", "", "", "Argument[0]", "ReturnValue[0]", "taint", "manual"],
["io/fs", "", false, "ReadDir", "", "", "Argument[0]", "ReturnValue[0]", "taint", "manual"],
["io/fs", "", false, "ReadFile", "", "", "Argument[0]", "ReturnValue[0]", "taint", "manual"],
Expand Down
1 change: 1 addition & 0 deletions go/ql/lib/ext/math.big.model.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"extensible": "summaryModel"
},
"data": [
["math/big", "Int", true, "Float64", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"],
["math/big", "Int", true, "Int64", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"]
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Added data flow models for APIs mentioned in the minor library changes section of the Go 1.21 release notes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
reverseRead
| CryptoTls.go:66:23:66:27 | implicit-deref state | Origin of readStep is missing a PostUpdateNode. |

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.

Are you planning to address these consistency failures?

@owen-mc owen-mc Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not in this PR. It's a pre-existing problem that's out of scope for adding these models. But thanks for the prod - I'll have a look into addressing it in a separate PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've made a draft PR #23245 to fix those consistency test results. I'll update it after this has merged, and then run DCA and QA, as it might lead to a lot more results, if this lack of post-update nodes was stopping flow.

| CryptoTls.go:73:23:73:27 | state | Origin of readStep is missing a PostUpdateNode. |
| CryptoTls.go:119:23:119:27 | implicit-deref state | Origin of readStep is missing a PostUpdateNode. |
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Code generated by https://github.com/gagliardetto/codebox. DO NOT EDIT.
// Code partially generated by https://github.com/gagliardetto/codebox, with manual additions
// for context APIs added in Go 1.21.

package main

Expand Down Expand Up @@ -26,6 +27,52 @@ func TaintStepTest_ContextWithTimeout_B0I0O0(sourceCQL interface{}) interface{}
return intoContext957
}

func TaintStepTest_ContextWithDeadlineCauseContext(sourceCQL interface{}) interface{} {
Comment thread
owen-mc marked this conversation as resolved.
Resolved
fromContext := sourceCQL.(context.Context)
intoContext, _ := context.WithDeadlineCause(fromContext, time.Time{}, nil)
return intoContext
}

func TaintStepTest_ContextWithDeadlineCauseError(sourceCQL interface{}) interface{} {
fromError := sourceCQL.(error)
intoContext, _ := context.WithDeadlineCause(nil, time.Time{}, fromError)
return intoContext
}

func TaintStepTest_ContextWithTimeoutCauseContext(sourceCQL interface{}) interface{} {
fromContext := sourceCQL.(context.Context)
intoContext, _ := context.WithTimeoutCause(fromContext, 0, nil)
return intoContext
}

func TaintStepTest_ContextWithTimeoutCauseError(sourceCQL interface{}) interface{} {
fromError := sourceCQL.(error)
intoContext, _ := context.WithTimeoutCause(nil, 0, fromError)
return intoContext
}

func TaintStepTest_ContextWithoutCancel(sourceCQL interface{}) interface{} {
fromContext := sourceCQL.(context.Context)
return context.WithoutCancel(fromContext)
}

func TaintStepTest_ContextCause(sourceCQL interface{}) interface{} {
fromContext := sourceCQL.(context.Context)
return context.Cause(fromContext)
}

func TaintStepTest_ContextWithDeadlineCauseRoundTrip(sourceCQL interface{}) interface{} {
fromError := sourceCQL.(error)
ctx, _ := context.WithDeadlineCause(nil, time.Time{}, fromError)
return context.Cause(ctx)
}

func TaintStepTest_ContextWithTimeoutCauseRoundTrip(sourceCQL interface{}) interface{} {
fromError := sourceCQL.(error)
ctx, _ := context.WithTimeoutCause(nil, 0, fromError)
return context.Cause(ctx)
}

func TaintStepTest_ContextWithValue_B0I0O0(sourceCQL interface{}) interface{} {
fromContext520 := sourceCQL.(context.Context)
intoContext443 := context.WithValue(fromContext520, nil, nil)
Expand Down Expand Up @@ -163,4 +210,44 @@ func RunAllTaints_Context() {
out := TaintStepTest_OldContextContextValue_B0I0O0(source)
sink(13, out)
}
{
source := newSource(14)
out := TaintStepTest_ContextWithDeadlineCauseContext(source)
sink(14, out)
}
{
source := newSource(15)
out := TaintStepTest_ContextWithDeadlineCauseError(source)
sink(15, out)
}
{
source := newSource(16)
out := TaintStepTest_ContextWithTimeoutCauseContext(source)
sink(16, out)
}
{
source := newSource(17)
out := TaintStepTest_ContextWithTimeoutCauseError(source)
sink(17, out)
}
{
source := newSource(18)
out := TaintStepTest_ContextWithoutCancel(source)
sink(18, out)
}
{
source := newSource(19)
out := TaintStepTest_ContextCause(source)
sink(19, out)
}
{
source := newSource(20)
out := TaintStepTest_ContextWithDeadlineCauseRoundTrip(source)
sink(20, out)
}
{
source := newSource(21)
out := TaintStepTest_ContextWithTimeoutCauseRoundTrip(source)
sink(21, out)
}
}
Loading
Loading