fossas / fossa-cli

Fast, portable and reliable dependency analysis for any codebase. Supports license & vulnerability scanning for large monoliths. Language-agnostic; integrates with 20+ build systems.
https://fossa.com
Other
1.29k stars 173 forks source link

Update jar-callgraph.jar #1454

Closed JeffreyHuynh1 closed 3 months ago

JeffreyHuynh1 commented 4 months ago

Overview

It was discovered that the jar callgraph logic doesn’t account for creating all the appropriate edges for interfaces. Looking at the dependency mvn+com.squareup.okio_okio$1.15.0 we can see where our current jar callgraph logic fails to create the edges for interfaces.

Acceptance criteria

Testing plan

Manual testing plan:

Look at the output and see that we now edges for:

Makes edges for interface methods and the classes that implement them

M:okio.Source:timeout() (M)okio.Okio$2:timeout()
M:okio.Source:read(okio.Buffer,long) (M)okio.Okio$2:read(okio.Buffer,long)
M:okio.Source:close() (M)okio.Okio$2:close()
M:okio.Source:timeout() (M)okio.Pipe$PipeSource:timeout()
M:okio.Source:read(okio.Buffer,long) (M)okio.Pipe$PipeSource:read(okio.Buffer,long)
M:okio.Source:close() (M)okio.Pipe$PipeSource:close()
M:okio.Source:timeout() (M)okio.InflaterSource:timeout()
M:okio.Source:read(okio.Buffer,long) (M)okio.InflaterSource:read(okio.Buffer,long)
M:okio.Source:close() (M)okio.InflaterSource:close()
M:okio.Source:timeout() (M)okio.GzipSource:timeout()
M:okio.Source:read(okio.Buffer,long) (M)okio.GzipSource:read(okio.Buffer,long)
M:okio.Source:close() (M)okio.GzipSource:close()
M:okio.Source:timeout() (M)okio.AsyncTimeout$2:timeout()
M:okio.Source:read(okio.Buffer,long) (M)okio.AsyncTimeout$2:read(okio.Buffer,long)
M:okio.Source:close() (M)okio.AsyncTimeout$2:close()
M:okio.Source:timeout() (M)okio.ForwardingSource:timeout()
M:okio.Source:read(okio.Buffer,long) (M)okio.ForwardingSource:read(okio.Buffer,long)

Previously, we only had an edge like: M:okio.Buffer:writeAll(okio.Source) (I)okio.Source:read(okio.Buffer,long) for interface method calls. Because we are calling an interface method, it is also possible to call of the classes that implement the interface depending on implementation. These are the newly added edges after the update.

M:okio.Buffer:writeAll(okio.Source) (I)okio.BufferedSource:read(okio.Buffer,long)
M:okio.Buffer:writeAll(okio.Source) (I)okio.Pipe$PipeSource:read(okio.Buffer,long)
M:okio.Buffer:writeAll(okio.Source) (I)okio.ForwardingSource:read(okio.Buffer,long)
M:okio.Buffer:writeAll(okio.Source) (I)okio.GzipSource:read(okio.Buffer,long)
M:okio.Buffer:writeAll(okio.Source) (I)okio.InflaterSource:read(okio.Buffer,long)
M:okio.Buffer:writeAll(okio.Source) (I)okio.AsyncTimeout$2:read(okio.Buffer,long)
M:okio.Buffer:writeAll(okio.Source) (I)okio.Okio$2:read(okio.Buffer,long)

Risks

Metrics

References

Checklist

JeffreyHuynh1 commented 3 months ago

Thanks for catching that, forgot to delete jar-callgraph-1.0.1.jar