Skip to content

Commit fbf03fa

Browse files
author
Alvaro Muñoz
committed
New expression is always true tests
1 parent c9b2dac commit fbf03fa

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

ql/test/query-tests/Security/CWE-571/.github/workflows/test.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Conditionally process PR
1+
name: Event
22

33
on:
4-
pull_request_target:
5-
types: [opened, synchronize, reopened]
4+
workflow_dispatch:
65

76
jobs:
8-
process-pr:
7+
if-tests:
98
runs-on: ubuntu-latest
9+
permissions: {}
1010
steps:
1111
- name: Test 1
1212
if: 1 == 2
@@ -36,10 +36,10 @@ jobs:
3636
- name: Test 7
3737
run: echo "Test 7 should not be printed"
3838
if: ${{
39-
github.actor == 'torvalds' ||
40-
github.actor == 'dependabot[bot]'
39+
1 == 2 ||
40+
3 == 4
4141
}}
42-
42+
4343
- name: Test 8
4444
run: echo "Test 8 should not be printed"
4545
if: >
@@ -87,3 +87,25 @@ jobs:
8787
false || 1 == 2
8888
)}}
8989
run: echo "Test 17 should not be printed"
90+
- name: Test 18
91+
if: ${{ github.event_name }} == 'foo'
92+
run: echo "Test 18 should not be printed"
93+
- name: Test 19
94+
if: ${{ contains(fromJSON('["OWNER", "MEMBER"]'), github.event.pull_request.author_association )}} || github.actor == 'renovate[bot]'
95+
run: echo "Test 19 should not be printed"
96+
- name: Test 20
97+
if: ${{ hashFiles('./docker/Dockerfile.debian') }} != ""
98+
run: echo "Test 20 should not be printed"
99+
- name: Test 21
100+
if: >
101+
${{ github.event.workflow_run.event == 'pull_request' &&
102+
github.event.workflow_run.conclusion == 'success' }}
103+
run: echo "Test 21 should not be printed"
104+
- name: Test 22
105+
if: |
106+
runner.os == 'Windows' && (
107+
startsWith(inputs.node, 'v10.') ||
108+
startsWith(inputs.node, 'v12.') ||
109+
startsWith(inputs.node, 'v14.')
110+
)
111+
run: echo "Test 22 should not be printed"

ql/test/query-tests/Security/CWE-571/ExpressionIsAlwaysTrue.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
| .github/workflows/test.yml:59:15:59:31 | " ${{ 1 == 2 }}" | Expression always evaluates to true |
66
| .github/workflows/test.yml:79:13:82:14 | \|+ | Expression always evaluates to true |
77
| .github/workflows/test.yml:85:13:88:14 | >+ | Expression always evaluates to true |
8+
| .github/workflows/test.yml:91:13:91:45 | ${{ git ... = 'foo' | Expression always evaluates to true |
9+
| .github/workflows/test.yml:94:13:94:141 | ${{ con ... e[bot]' | Expression always evaluates to true |
10+
| .github/workflows/test.yml:97:13:97:64 | ${{ has ... } != "" | Expression always evaluates to true |
11+
| .github/workflows/test.yml:100:13:102:63 | > | Expression always evaluates to true |

0 commit comments

Comments
 (0)