mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-10 14:24:05 +01:00
fix code injection via template expansion
github.event.pull_request.head.repo.full_name may expand into attacker-controllable code Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
1907bca23a
commit
b069b11219
19
.github/workflows/analysis.yml
vendored
19
.github/workflows/analysis.yml
vendored
@ -30,34 +30,45 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Setup variables
|
- name: Setup variables
|
||||||
id: get-vars
|
id: get-vars
|
||||||
|
env:
|
||||||
|
PR_REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
|
||||||
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
|
GITHUB_REPO: ${{ github.repository }}
|
||||||
run: |
|
run: |
|
||||||
if [ -z "$GITHUB_HEAD_REF" ]; then
|
if [ -z "$GITHUB_HEAD_REF" ]; then
|
||||||
# push
|
# push
|
||||||
{
|
{
|
||||||
echo "branch=$GITHUB_REF_NAME"
|
echo "branch=$GITHUB_REF_NAME"
|
||||||
echo "pr=$GITHUB_RUN_ID"
|
echo "pr=$GITHUB_RUN_ID"
|
||||||
echo "repo=${{ github.repository }}"
|
echo "repo=$GITHUB_REPO"
|
||||||
} >> "$GITHUB_OUTPUT"
|
} >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
# pull request
|
# pull request
|
||||||
|
SAFE_REPO_NAME=$(echo "$PR_REPO_FULL_NAME" | sed 's/[^a-zA-Z0-9._-]//g')
|
||||||
|
SAFE_BRANCH=$(echo "$GITHUB_HEAD_REF" | sed 's/[^a-zA-Z0-9._-]//g')
|
||||||
|
|
||||||
{
|
{
|
||||||
echo "branch=$GITHUB_HEAD_REF"
|
printf 'branch=%s\n' "$SAFE_BRANCH"
|
||||||
echo "pr=${{ github.event.pull_request.number }}"
|
printf 'pr=%s\n' "$PR_NUMBER"
|
||||||
echo "repo=${{ github.event.pull_request.head.repo.full_name }}"
|
printf 'repo=%s\n' "$SAFE_REPO_NAME"
|
||||||
} >> "$GITHUB_OUTPUT"
|
} >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
with:
|
with:
|
||||||
repository: ${{ steps.get-vars.outputs.repo }}
|
repository: ${{ steps.get-vars.outputs.repo }}
|
||||||
ref: ${{ steps.get-vars.outputs.branch }}
|
ref: ${{ steps.get-vars.outputs.branch }}
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
|
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
|
||||||
with:
|
with:
|
||||||
distribution: "temurin"
|
distribution: "temurin"
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt install python3-defusedxml
|
sudo apt install python3-defusedxml
|
||||||
|
|
||||||
- name: Run analysis wrapper
|
- name: Run analysis wrapper
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
Loading…
Reference in New Issue
Block a user