feat: Onboard olafurpg/setup-scala action - #1
Conversation
7aae3fe to
d8889cb
Compare
Signed-off-by: Anurag Rajawat <anurag@stepsecurity.io>
d8889cb to
d3e333c
Compare
| javaVersion: string | ||
| ): Promise<JabbaInstall | undefined> { | ||
| const { stdout } = await exec.getExecOutput(jabba, ["ls-remote"]); | ||
| const pattern = new RegExp(javaVersion); |
There was a problem hiding this comment.
Security: Unvalidated user input used as RegExp pattern (ReDoS risk)
javaVersion comes directly from action input and is passed to new RegExp() without any sanitization. A specially crafted value (e.g. (a+)+b) can cause catastrophic backtracking and hang the runner process indefinitely.
| const pattern = new RegExp(javaVersion); | |
| const pattern = new RegExp(javaVersion.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')); |
Alternatively, consider using a simple String.prototype.includes() or startsWith() match if full regex isn't needed.
| await curl( | ||
| "https://raw.githubusercontent.com/sbt/sbt/develop/sbt", | ||
| path.join(bin, "sbt") | ||
| ); | ||
| await curl( | ||
| "https://raw.githubusercontent.com/dwijnand/sbt-extras/master/sbt", | ||
| path.join(bin, "sbtx") | ||
| ); | ||
| await curl( | ||
| "https://raw.githubusercontent.com/coursier/sbt-extras/master/sbt", | ||
| path.join(bin, "csbt") |
There was a problem hiding this comment.
Security: Downloading executable scripts from unpinned mutable branch references
All three URLs reference mutable branch HEADs (develop, master) with no checksum verification. The downloaded scripts are immediately made executable and placed on PATH. A compromised commit to any of these upstream repos results in arbitrary code execution on the runner.
Pin to specific commit SHAs instead of branch names, and verify a checksum after download:
| await curl( | |
| "https://raw.githubusercontent.com/sbt/sbt/develop/sbt", | |
| path.join(bin, "sbt") | |
| ); | |
| await curl( | |
| "https://raw.githubusercontent.com/dwijnand/sbt-extras/master/sbt", | |
| path.join(bin, "sbtx") | |
| ); | |
| await curl( | |
| "https://raw.githubusercontent.com/coursier/sbt-extras/master/sbt", | |
| path.join(bin, "csbt") | |
| await curl( | |
| "https://raw.githubusercontent.com/sbt/sbt/<COMMIT_SHA>/sbt", | |
| path.join(bin, "sbt") | |
| ); | |
| await curl( | |
| "https://raw.githubusercontent.com/dwijnand/sbt-extras/<COMMIT_SHA>/sbt", | |
| path.join(bin, "sbtx") | |
| ); | |
| await curl( | |
| "https://raw.githubusercontent.com/coursier/sbt-extras/<COMMIT_SHA>/sbt", | |
| path.join(bin, "csbt") | |
| ); |
| @@ -0,0 +1,39 @@ | |||
| { | |||
| "name": "typescript-action", | |||
There was a problem hiding this comment.
Failed Check: name field is a template leftover
The name field is still "typescript-action" from the GitHub Actions template. It should be updated to match the actual action name.
| "name": "typescript-action", | |
| "name": "setup-scala", |
PR ReviewAction TypeNode-based action — uses ✅ Passed Checks
❌ Failed Checks
|
Description
This PR onboards https://github.com/olafurpg/setup-scala action.