Skip to content

Commit a4f5cfc

Browse files
authored
AAE-39560: security fixes (#11315)
1 parent e78c590 commit a4f5cfc

File tree

6 files changed

+42
-18
lines changed

6 files changed

+42
-18
lines changed

.github/actions/before-install/action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ runs:
4545
- name: RELEASE on master/develop patch branch
4646
if: ${{ env.BREAK_ACTION == false && github.event.pull_request.merged }}
4747
shell: bash
48+
env:
49+
REF_NAME: ${{ github.ref_name }}
4850
run: |
49-
if [[ "${{ github.ref_name }}" =~ ^master(-patch.*)?$ ]]; then
51+
if [[ "$REF_NAME" =~ ^master(-patch.*)?$ ]]; then
5052
# into master(-patch*)
5153
echo "Setting up CI flags for Push on master patch"
52-
elif [[ "${{ github.ref_name }}" =~ ^develop-patch.*$ ]]; then
54+
elif [[ "$REF_NAME" =~ ^develop-patch.*$ ]]; then
5355
# into develop-patch*
5456
echo "Setting up CI flags for Push develop patch"
5557
else

.github/actions/enable-dryrun/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ runs:
2020
- name: set dryrun flag to TRUE
2121
shell: bash
2222
id: dryrun
23+
env:
24+
DRY_RUN_FLAG: ${{ inputs.dry-run-flag }}
2325
run: |
24-
if [[ '${{ inputs.dry-run-flag }}' == 'true' ]]; then
26+
if [[ '$DRY_RUN_FLAG' == 'true' ]]; then
2527
echo "dryrun=--dryrun" >> $GITHUB_OUTPUT;
2628
echo "enabling dryrun"
2729
else

.github/actions/set-npm-tag/action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ runs:
1717

1818
- name: set TAG_NPM
1919
shell: bash
20+
env:
21+
BRANCH_NAME: ${{ inputs.branch_name }}
2022
run: |
2123
TAG_NPM="alpha"
2224
VERSION_IN_PACKAGE_JSON=$(node -p "require('./package.json')".version)
2325
echo "version in package.json=${VERSION_IN_PACKAGE_JSON}"
24-
if [[ ${{ inputs.branch_name }} =~ ^master(-patch.*)?$ ]]; then
26+
if [[ $BRANCH_NAME =~ ^master(-patch.*)?$ ]]; then
2527
# Pre-release versions
2628
if [[ $VERSION_IN_PACKAGE_JSON =~ ^[0-9]*\.[0-9]*\.[0-9]*-A\.[0-9]*$ ]];
2729
then
@@ -31,7 +33,7 @@ runs:
3133
TAG_NPM=latest
3234
fi
3335
fi
34-
if [[ ${{ inputs.branch_name }} =~ ^develop(-patch.*)?$ ]]; then
36+
if [[ $BRANCH_NAME =~ ^develop(-patch.*)?$ ]]; then
3537
TAG_NPM=alpha
3638
fi
3739
echo "TAG_NPM=${TAG_NPM}" >> $GITHUB_ENV

.github/workflows/git-tag.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ jobs:
5252
with:
5353
node-version-file: '.nvmrc'
5454
- name: "Release tag"
55+
env:
56+
DRYRUN_FLAG: ${{ steps.set-dryrun.outputs.dryrun }}
5557
run: |
5658
git fetch --all --quiet
57-
BRANCH=${GITHUB_REF##*/} ./scripts/github/release/git-tag.sh ${{ steps.set-dryrun.outputs.dryrun }}
59+
BRANCH=${GITHUB_REF##*/} ./scripts/github/release/git-tag.sh $DRYRUN_FLAG

.github/workflows/package_dispatch.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@ jobs:
1010
steps:
1111
- name: Dispatch event to monorepo
1212
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
13+
env:
14+
PACKAGE_NAME: ${{ github.event.registry_package.name }}
15+
PACKAGE_VERSION: ${{ github.event.registry_package.package_version.name }}
1316
with:
1417
github-token: ${{ secrets.PAT_WRITE_PKG }}
1518
retries: 3
1619
script: |
1720
const payload = {
18-
package_name: "${{ github.event.registry_package.name }}",
19-
package_version: "${{ github.event.registry_package.package_version.name }}"
21+
package_name: process.env.PACKAGE_NAME,
22+
package_version: process.env.PACKAGE_VERSION
2023
};
2124
2225
await github.rest.repos.createDispatchEvent({

.github/workflows/pull-request.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ jobs:
7373

7474
- name: ci:force flag parser
7575
shell: bash
76+
env:
77+
EVENT_NAME: ${{ github.event_name }}
78+
ACTOR: ${{ github.actor }}
7679
run: |
77-
if [ "${{ github.event_name }}" == "schedule" ] || [ "${{ github.actor }}" == "dependabot[bot]" ]; then
80+
if [ "$EVENT_NAME" == "schedule" ] || [ "$ACTOR" == "dependabot[bot]" ]; then
7881
echo -e "\033[32mci:force check can be skipped\033[0m"
7982
skip_check="true"
8083
elif [[ "$COMMIT_MESSAGE" == *"[ci:force]"* ]]; then
@@ -91,28 +94,33 @@ jobs:
9194

9295
- name: show pr number
9396
shell: bash
97+
env:
98+
PR_NUMBER: ${{ steps.action.outputs.number }}
9499
run: |
95-
echo "PR: ${{ steps.action.outputs.number }}"
100+
echo "PR: $PR_NUMBER"
96101
97102
- name: check if pr is approved
98103
env:
99104
DEVEL_FLAG: ${{ inputs.devel }}
100105
GH_TOKEN: ${{ github.token }}
101106
skip_check: "false"
107+
EVENT_NAME: ${{ github.event_name }}
108+
ACTOR: ${{ github.actor }}
109+
PR_NUMBER: ${{ steps.action.outputs.number }}
102110
run: |
103-
if [ "${{ github.event_name }}" == "schedule" ] || [ "${{ github.actor }}" == "dependabot[bot]" ]; then
111+
if [ "$EVENT_NAME" == "schedule" ] || [ "$ACTOR" == "dependabot[bot]" ]; then
104112
echo -e "\033[32mci:force check can be skipped\033[0m"
105113
skip_check="true"
106114
elif [[ "$COMMIT_MESSAGE" == *"[ci:force]"* ]]; then
107115
echo -e "\033[32m[ci:force] flag detected. No need for approval.\033[0m"
108116
skip_check="true"
109117
fi
110118
111-
if [ "${{ github.actor }}" == "dependabot[bot]" ] || [ "${{ github.actor }}" == "alfresco-build" ]; then
112-
echo -e "\033[32mCommit by ${{ github.actor }}. No need for approval.\033[0m"
119+
if [ "$ACTOR" == "dependabot[bot]" ] || [ "$ACTOR" == "alfresco-build" ]; then
120+
echo -e "\033[32mCommit by $ACTOR. No need for approval.\033[0m"
113121
skip_check="true"
114122
fi
115-
if [ "${{ github.event_name }}" == "schedule" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
123+
if [ "$EVENT_NAME" == "schedule" ] || [ "$EVENT_NAME" == "workflow_dispatch" ]; then
116124
echo -e "\033[32mSchedule event\033[0m"
117125
skip_check="true"
118126
fi
@@ -124,7 +132,7 @@ jobs:
124132
125133
if [ "$skip_check" == "false" ]; then
126134
echo "Checking PR approval"
127-
prNumber=${{ steps.action.outputs.number }}
135+
prNumber=$PR_NUMBER
128136
echo "PR: $prNumber"
129137
checkApproval=$(gh api /repos/$GITHUB_REPOSITORY/pulls/$prNumber/reviews | jq '.[] | select(.state == "APPROVED") | .user.login')
130138
if [[ $checkApproval ]]; then
@@ -184,8 +192,10 @@ jobs:
184192
- uses: ./.github/actions/setup
185193
- uses: ./.github/actions/download-node-modules-and-artifacts
186194
- name: Run unit tests
195+
env:
196+
EXCLUDE_PATTERN: ${{ matrix.unit-tests.exclude }}
187197
run: |
188-
/usr/bin/xvfb-run --auto-servernum npm run test:affected -- $NX_CALCULATION_FLAGS --exclude=${{ matrix.unit-tests.exclude }}
198+
/usr/bin/xvfb-run --auto-servernum npm run test:affected -- $NX_CALCULATION_FLAGS --exclude=$EXCLUDE_PATTERN
189199
190200
lint:
191201
# long timeout required when cache has to be recreated
@@ -241,9 +251,12 @@ jobs:
241251
core.setFailed('The PR contains a forbidden label! You are not allowed to merge until the label is there.');
242252
}
243253
- name: Check value after
254+
env:
255+
STEP_RESULT: ${{ toJson(steps.pr-forbidden.*.result) }}
256+
HAS_FAILURE: ${{ contains(toJson(steps.pr-forbidden.*.result), 'failure') }}
244257
run: |
245-
echo "result ${{ toJson(steps.pr-forbidden.*.result) }}" && echo "result ${{ steps.pr-forbidden.*.result }}"
246-
echo "result ${{ contains(toJson(steps.pr-forbidden.*.result), 'failure') }}"
258+
echo "Step result: $STEP_RESULT"
259+
echo "Has failure: $HAS_FAILURE"
247260
248261
finalize:
249262
if: ${{ always() }}

0 commit comments

Comments
 (0)