mirror of
https://github.com/zizmorcore/zizmor.git
synced 2025-12-23 08:47:33 +00:00
fix(obfuscation): don't consider fromJSON(...) constant-reducible (#1178)
This commit is contained in:
parent
ffd91b1eb1
commit
9ed3607f8f
5 changed files with 35 additions and 1 deletions
|
|
@ -304,7 +304,10 @@ impl<'src> Expr<'src> {
|
|||
|| func == "startsWith"
|
||||
|| func == "endsWith"
|
||||
|| func == "toJSON"
|
||||
|| func == "fromJSON"
|
||||
// TODO(ww): `fromJSON` *is* frequently reducible, but
|
||||
// doing so soundly with subexpressions is annoying.
|
||||
// We overapproximate for now and consider it non-reducible.
|
||||
// || func == "fromJSON"
|
||||
|| func == "join"
|
||||
{
|
||||
args.iter().all(|e| e.constant_reducible())
|
||||
|
|
|
|||
|
|
@ -812,6 +812,13 @@ fn obfuscation() -> Result<()> {
|
|||
.run()?
|
||||
);
|
||||
|
||||
insta::assert_snapshot!(
|
||||
zizmor()
|
||||
.input(input_under_test("obfuscation/issue-1177-repro.yml"))
|
||||
.args(["--persona=pedantic"])
|
||||
.run()?
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
source: crates/zizmor/tests/integration/snapshot.rs
|
||||
expression: "zizmor().input(input_under_test(\"obfuscation/issue-1177-repro.yml\")).args([\"--persona=pedantic\"]).run()?"
|
||||
---
|
||||
No findings to report. Good job!
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# https://github.com/zizmorcore/zizmor/issues/1177
|
||||
|
||||
name: Issue 1177 Repro
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
issue-1177-repro:
|
||||
# we should not flag this as an obfuscation finding, since it's
|
||||
# not actually constant reducible to `!contains(Array, ...)`
|
||||
if: ${{ !contains(fromJSON('["push", "pull_request"]'), github.event_name) }}
|
||||
name: issue-1177-repro
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: true
|
||||
|
|
@ -41,6 +41,9 @@ of `zizmor`.
|
|||
some cache usage variants in newer versions of `actions/setup-node`
|
||||
(#1152)
|
||||
|
||||
* Fixed a bug where the [obfuscation] audit would incorrectly flag
|
||||
some subexpressions as constant-reducible when they were not (#1170)
|
||||
|
||||
### Deprecations ⚠️
|
||||
|
||||
* The `unknown` values for `--min-severity` and `--min-confidence`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue