@@ -14,9 +14,11 @@ module UnsafeUnzipSymlink {
1414 import UnsafeUnzipSymlinkCustomizations:: UnsafeUnzipSymlink
1515
1616 /**
17+ * DEPRECATED: Use `EvalSymlinksFlow` instead.
18+ *
1719 * A taint-flow configuration tracking archive header fields flowing to a `path/filepath.EvalSymlinks` call.
1820 */
19- class EvalSymlinksConfiguration extends TaintTracking2:: Configuration {
21+ deprecated class EvalSymlinksConfiguration extends TaintTracking2:: Configuration {
2022 EvalSymlinksConfiguration ( ) { this = "Archive header field symlinks resolved" }
2123
2224 override predicate isSource ( DataFlow:: Node source ) { source instanceof FilenameWithSymlinks }
@@ -33,18 +35,31 @@ module UnsafeUnzipSymlink {
3335 }
3436 }
3537
38+ // Archive header field symlinks resolved
39+ private module EvalSymlinksConfig implements DataFlow:: ConfigSig {
40+ predicate isSource ( DataFlow:: Node source ) { source instanceof FilenameWithSymlinks }
41+
42+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof EvalSymlinksSink }
43+
44+ predicate isBarrier ( DataFlow:: Node node ) { node instanceof EvalSymlinksInvalidator }
45+ }
46+
47+ private module EvalSymlinksFlow = TaintTracking:: Global< EvalSymlinksConfig > ;
48+
3649 /**
3750 * Holds if `node` is an archive header field read that flows to a `path/filepath.EvalSymlinks` call.
3851 */
3952 private predicate symlinksEvald ( DataFlow:: Node node ) {
40- exists ( EvalSymlinksConfiguration c | c . hasFlow ( getASimilarReadNode ( node ) , _) )
53+ EvalSymlinksFlow :: flow ( getASimilarReadNode ( node ) , _)
4154 }
4255
4356 /**
57+ * DEPRECATED: Use `Flow` instead.
58+ *
4459 * A taint-flow configuration tracking archive header fields flowing to an `os.Symlink` call,
4560 * which never flow to a `path/filepath.EvalSymlinks` call.
4661 */
47- class SymlinkConfiguration extends TaintTracking:: Configuration {
62+ deprecated class SymlinkConfiguration extends TaintTracking:: Configuration {
4863 SymlinkConfiguration ( ) { this = "Unsafe unzipping of symlinks" }
4964
5065 override predicate isSource ( DataFlow:: Node source ) {
@@ -63,4 +78,17 @@ module UnsafeUnzipSymlink {
6378 guard instanceof SymlinkSanitizerGuard
6479 }
6580 }
81+
82+ private module Config implements DataFlow:: ConfigSig {
83+ predicate isSource ( DataFlow:: Node source ) {
84+ source instanceof FilenameWithSymlinks and
85+ not symlinksEvald ( source )
86+ }
87+
88+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof SymlinkSink }
89+
90+ predicate isBarrier ( DataFlow:: Node node ) { node instanceof SymlinkSanitizer }
91+ }
92+
93+ module Flow = TaintTracking:: Global< Config > ;
6694}
0 commit comments