Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Conversation

@owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Oct 12, 2020

No description provided.

@owen-mc owen-mc requested a review from a team October 12, 2020 16:16
Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

Looks good -- let's have an lgtm eval with some query that cares about the logger-call range, and please add a change note

fn in ["Dump", "Print", "Println"] and
this = f.getACall()
|
f.hasQualifiedName(pkg, fn)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this not work?

Suggested change
f.hasQualifiedName(pkg, fn)
this.getTarget().hasQualifiedName(pkg, fn)

I'd also be tempted to inline packagePath here.

And similar below.

(Is this code generated via @gagliardetto's tool?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. The code isn't auto-generated - I think I copied the code from another model and changed the details.

}
}

from TaintTracking::Configuration config, DataFlow::PathNode source, DataFlow::PathNode sink
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd still like to transition to comment-based tests. I should put making a framework for that on my to-do list.

}

override DataFlow::Node getAMessageComponent() {
exists(int i | i >= 1 | result = this.getArgument(i))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you excluding the format string here and below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I've fixed it now.

@owen-mc
Copy link
Contributor Author

owen-mc commented Oct 14, 2020

@smowton I have added a change note. Our modelling of loggers is only used in two places: the cleartext logging query, and to rule out some FPs in ConstantOauth2State. I ran the cleartext logging query on all projects in lgtm with an extra predicate to make sure the sink is from Spew, and got nothing. But that is what I'd expect, as I wouldn't really expect passwords and the like to be in structs that are being pretty-printed.

@smowton
Copy link
Contributor

smowton commented Oct 14, 2020

Fair enough -- I thought perhaps we might spot some things heading to Spew's printf methods as ordinary strings (presumably alongside structs and such that motivate using Spew). Using this is of course more rare than the stdlib fmt methods, so this could just be rare.

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

Actually one change to make then lgtm

Co-authored-by: Chris Smowton <smowton@github.com>
@owen-mc owen-mc merged commit f49ff27 into github:main Oct 16, 2020
@owen-mc owen-mc deleted the spew branch October 16, 2020 13:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants