Skip to content

Commit 1689685

Browse files
Revert "Merge branch 'main' into feature/gitleaks"
This reverts commit a088db3, reversing changes made to 8f4aa00.
1 parent a088db3 commit 1689685

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

cve_scan/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ runs:
123123
--retry-all-errors \
124124
${DD_URL}/api/v2/reimport-scan/ \
125125
-H "accept: application/json" \
126+
-H "Content-Type: multipart/form-data" \
126127
-H "Authorization: Token ${DD_TOKEN}" \
127128
-F "auto_create_context=True" \
128129
-F "minimum_severity=Info" \

gitleaks/action.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ inputs:
55
scan_mode:
66
description: "Scan mode: full | diff"
77
required: false
8-
default: "diff"
8+
default: "full"
99
gitleaks_version:
1010
description: "Gitleaks version to install"
1111
required: false
@@ -93,7 +93,7 @@ runs:
9393
exit 0
9494
fi
9595
96-
mapfile -t FILES < <(git diff --name-only --diff-filter=AMR "${BASE_SHA}" "${HEAD_SHA}")
96+
mapfile -t FILES < <(git diff --name-only --diff-filter=AMR "${BASE_SHA}...${HEAD_SHA}")
9797
if (( ${#FILES[@]} == 0 )); then
9898
echo "No changed files."
9999
echo "src_dir=" >> "$GITHUB_OUTPUT"
@@ -112,7 +112,7 @@ runs:
112112
echo '{}' > "$PATCH_JSON"
113113
114114
while IFS= read -r file; do
115-
HUNKS="$(git diff --unified=0 "${BASE_SHA}" "${HEAD_SHA}" -- "$file" \
115+
HUNKS="$(git diff --unified=0 "${BASE_SHA}...${HEAD_SHA}" -- "$file" \
116116
| awk '/^@@/ {print}' \
117117
| sed -n 's/.*+\([0-9]\+\),\([0-9]\+\).*/\1 \2/p')"
118118
@@ -163,6 +163,8 @@ runs:
163163
- name: Filter findings by added lines (patch)
164164
if: ${{ inputs.scan_mode == 'diff' }}
165165
shell: bash
166+
env:
167+
SRC_DIR: ${{ steps.prpatch.outputs.src_dir }}
166168
run: |
167169
set -euo pipefail
168170
PATCH_MAP_PATH="${{ steps.prpatch.outputs.patch_map }}"
@@ -174,16 +176,19 @@ runs:
174176
fi
175177
176178
MAP_JSON="$(cat "${PATCH_MAP_PATH}")"
179+
SRC_PREFIX="${SRC_DIR%/}/"
177180
178-
jq --argjson map "${MAP_JSON}" '
181+
jq --argjson map "${MAP_JSON}" --arg src "${SRC_PREFIX}" '
179182
def arr: if type=="object" and has("findings") then .findings
180183
elif type=="array" then . else [] end;
184+
def strip($p; s): if s|startswith($p) then s[($p|length):] else s end;
185+
181186
arr
182187
| map(
183188
. as $f
184-
| ($f.File // $f.file // $f.Target // $f.Location.File // "") as $file
189+
| (strip($src; ($f.File // $f.file // $f.Target // $f.Location.File // ""))) as $rel
185190
| ($f.StartLine // $f.Line // $f.Location.StartLine // 0) as $line
186-
| if ($map[$file] // empty) as $ranges
191+
| if ($map[$rel] // []) as $ranges
187192
| any($ranges[]; $line >= .[0] and $line <= .[1])
188193
then $f else empty end
189194
)

svace_analyze/action.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -294,21 +294,8 @@ runs:
294294
fi
295295
}
296296
297-
get_svace_bin() {
298-
proj="${1}"
299-
svace_version=$(send "cat ${proj}/.svace-dir/svace-dir.version | awk 'FNR==3{print}'")
300-
301-
svace_bin="/opt/svace-${svace_version}/bin/svace"
302-
if [[ $(send "[[ -x ${svace_bin} ]] && echo true || echo false") == true ]]; then
303-
echo "${svace_bin}"
304-
else
305-
echo "svace"
306-
error "\"${svace_bin}\" is not executable on analyze server. Using default."
307-
fi
308-
}
309-
310297
if [[ $(send "[[ -d /${SVACE_ANALYZE_DIR}/${CI_COMMIT_HASH} ]] && echo true || echo false") == false ]]; then
311-
echo "::warning file=$(realpath "$0")::Specified commit directory doesn't exists on analyze server." && exit 1
298+
echo "::warning file=$(realpath "$0")::Specified commit directory doesn't exists on analyze server." && exit 0
312299
fi
313300
314301
projects=$(send "find /${SVACE_ANALYZE_DIR}/${CI_COMMIT_HASH} \\( -type d -iname .svace-dir -o -iname *.tar.gz \\) -exec dirname {} \\;")
@@ -325,12 +312,10 @@ runs:
325312
326313
if [[ $(send "[[ -d ${proj}/.svace-dir ]] && echo true || echo false") == true ]]; then
327314
define_import_params import_project import_branch
328-
svace_bin=$(get_svace_bin "${proj}")
329-
info "Using svace binary: $svace_bin"
330315
331316
info "Start analyzing project \"${svacer_proj}\" ..."
332-
send "${svace_bin} config --svace-dir ${proj} THREAD_NUMBER auto"
333-
send "${svace_bin} analyze --set-config SKIP_UNREACHABLE_PROCEDURE_ANALYSIS=${SKIP_UNREACHABLE_PROCEDURE_ANALYSIS} --quiet --svace-dir ${proj}"
317+
send "svace config --svace-dir ${proj} THREAD_NUMBER auto"
318+
send "svace analyze --set-config SKIP_UNREACHABLE_PROCEDURE_ANALYSIS=${SKIP_UNREACHABLE_PROCEDURE_ANALYSIS} --quiet --svace-dir ${proj}"
334319
success "Analysis completed successfully!"
335320
336321
info "Start archiving project \"${svacer_proj}\" ..."

0 commit comments

Comments
 (0)