Skip to content

Commit fbc2e1e

Browse files
author
Alvaro Muñoz
committed
Remove caching actions that cache files outside of the CWD
1 parent 14f1672 commit fbc2e1e

File tree

1 file changed

+3
-78
lines changed

1 file changed

+3
-78
lines changed

ql/lib/codeql/actions/security/CachePoisoningQuery.qll

Lines changed: 3 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -51,87 +51,13 @@ abstract class CacheWritingStep extends Step {
5151
class CacheActionUsesStep extends CacheWritingStep, UsesStep {
5252
CacheActionUsesStep() { this.getCallee() = "actions/cache" }
5353

54-
override string getPath() {
55-
if exists(this.(UsesStep).getArgument("path"))
56-
then result = this.(UsesStep).getArgument("path").splitAt("\n")
57-
else result = "?"
58-
}
54+
override string getPath() { result = this.(UsesStep).getArgument("path").splitAt("\n") }
5955
}
6056

6157
class CacheActionSaveUsesStep extends CacheWritingStep, UsesStep {
6258
CacheActionSaveUsesStep() { this.getCallee() = "actions/cache/save" }
6359

64-
override string getPath() {
65-
if exists(this.(UsesStep).getArgument("path"))
66-
then result = this.(UsesStep).getArgument("path").splitAt("\n")
67-
else result = "?"
68-
}
69-
}
70-
71-
class SetupJavaUsesStep extends CacheWritingStep, UsesStep {
72-
SetupJavaUsesStep() {
73-
this.getCallee() = "actions/setup-java" and
74-
(
75-
exists(this.getArgument("cache")) or
76-
exists(this.getArgument("cache-dependency-path"))
77-
)
78-
}
79-
80-
// TODO: Try to get the actual path being cached
81-
override string getPath() { result = "?" }
82-
}
83-
84-
class SetupGoUsesStep extends CacheWritingStep, UsesStep {
85-
SetupGoUsesStep() {
86-
this.getCallee() = "actions/setup-go" and
87-
(
88-
not exists(this.getArgument("cache"))
89-
or
90-
this.getArgument("cache") = "true"
91-
)
92-
}
93-
94-
// TODO: Try to get the actual path being cached
95-
override string getPath() { result = "?" }
96-
}
97-
98-
class SetupNodeUsesStep extends CacheWritingStep, UsesStep {
99-
SetupNodeUsesStep() {
100-
this.getCallee() = "actions/setup-node" and
101-
(
102-
exists(this.getArgument("cache")) or
103-
exists(this.getArgument("cache-dependency-path"))
104-
)
105-
}
106-
107-
// TODO: Try to get the actual path being cached
108-
override string getPath() { result = "?" }
109-
}
110-
111-
class SetupPythonUsesStep extends CacheWritingStep, UsesStep {
112-
SetupPythonUsesStep() {
113-
this.getCallee() = "actions/setup-python" and
114-
(
115-
exists(this.getArgument("cache")) or
116-
exists(this.getArgument("cache-dependency-path"))
117-
)
118-
}
119-
120-
// TODO: Try to get the actual path being cached
121-
override string getPath() { result = "?" }
122-
}
123-
124-
class SetupDotnetUsesStep extends CacheWritingStep, UsesStep {
125-
SetupDotnetUsesStep() {
126-
this.getCallee() = "actions/setup-dotnet" and
127-
(
128-
this.getArgument("cache") = "true" or
129-
exists(this.getArgument("cache-dependency-path"))
130-
)
131-
}
132-
133-
// TODO: Try to get the actual path being cached
134-
override string getPath() { result = "?" }
60+
override string getPath() { result = this.(UsesStep).getArgument("path").splitAt("\n") }
13561
}
13662

13763
class SetupRubyUsesStep extends CacheWritingStep, UsesStep {
@@ -140,6 +66,5 @@ class SetupRubyUsesStep extends CacheWritingStep, UsesStep {
14066
this.getArgument("bundler-cache") = "true"
14167
}
14268

143-
// TODO: Try to get the actual path being cached
144-
override string getPath() { result = "?" }
69+
override string getPath() { result = "vendor/bundle" }
14570
}

0 commit comments

Comments
 (0)