FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Make unguarded-action-lib better at ignoring uses of toolcache by robertbrignull · Pull Request #423 · github/codeql-action · GitHub

Make unguarded-action-lib better at ignoring uses of toolcache - #423

Merged
robertbrignull merged 3 commits into
mainfrom
robertbrignull/toolcache-query-safety
Mar 16, 2021
Merged

robertbrignull merged 3 commits into
mainfrom
robertbrignull/toolcache-query-safety

Conversation

Copy link
Copy Markdown
Contributor

This hopefully makes the unguarded-action-lib query ignore uses of @acitons/tool-cache that are hopefully ok because we're setting some environment variables like it's running on actions. This is not great but it's what we're doing and we're doing it intentionally so no point having open alerts about it. They'll just potentially hide more serious alerts.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.

Copy link
Copy Markdown
Contributor Author

This does move the setting of the env vars to earlier in the command execution so they'll be set for slightly more time but this should be fine. It's worth noting that we didn't un-set them before, so they would still be set for the majority of code. Moving the setting to the start of the runner command hopefully makes things clearer and less surprising.

Copy link
Copy Markdown
Contributor Author

aeisenberg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This looks reasonable to me.

Comment on lines +74 to +79
// program
// .command("init")
// ...
// .action(async (cmd: InitArgs) => {
// ...
// })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This won't catch patterns in this form:

program
  .command("init")
...
program
  .action(...)

Probably not a big deal since that's not a style being used in this code base. Though I wonder if we should explicitly add a query to prevent this style? In a separate PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Do you mean https://www.npmjs.com/package/commander#stand-alone-executable-subcommands? Yeah that's not a style we're currently using. Since we're now relying on it here, we could add another query to help enforce that. Alternatively I think we'll fail "safely" in that if this predicate doesn't detect the entry point correctly then it'll cause it to emit false positive alerts, which at least means we'll get notified about it and won't miss anything.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes... that pattern. Also, patterns like this:

const command = program
  .command("init")
...
command
  .action(...)

Just because you can write code like this, doesn't mean that you should.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oh right, I missed the variable assignment so I was a bit confused. Yes I agree that would be equivalent but would throw off the query.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

As you say above, may as well merge this as it's correct right now and doesn't make thing worse. We can introduce other checks later if we want to or need to.

robertbrignull merged commit 0f83463 into main Mar 16, 2021
robertbrignull deleted the robertbrignull/toolcache-query-safety branch March 16, 2021 16:13
github-actions Bot mentioned this pull request Mar 22, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL