Repository navigation
CLI-1510 Generate a release report from the Harbor benchmark (PoC) #1241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jonathan-balli-sonarsource
wants to merge
2
commits into
master
Choose a base branch
from
task/jb/CLI-1510-harbor-release-report
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| usage="usage: git-branch.sh pull <dir> | push <file.json> (BENCHMARK_DATA_REMOTE is the repository, BENCHMARK_DATA_BRANCH the branch, default benchmark-data)" | ||
| remote="${BENCHMARK_DATA_REMOTE:?${usage}}" | ||
| branch="${BENCHMARK_DATA_BRANCH:-benchmark-data}" | ||
| action="${1:?${usage}}" | ||
| target="${2:?${usage}}" | ||
|
|
||
| export GIT_TERMINAL_PROMPT=0 | ||
| work="$(mktemp -d)" | ||
| trap 'rm -rf "${work}"' EXIT | ||
| git init -q "${work}" | ||
| git -C "${work}" remote add origin "${remote}" | ||
|
|
||
| branch_exists() { | ||
| local status=0 | ||
| git -C "${work}" ls-remote --exit-code --heads origin "${branch}" > /dev/null || status=$? | ||
| case "${status}" in | ||
| 0) return 0 ;; | ||
| 2) return 1 ;; | ||
| *) echo "Cannot reach '${remote}'" >&2; exit 1 ;; | ||
| esac | ||
| } | ||
|
|
||
| case "${action}" in | ||
| pull) | ||
| branch_exists || { echo "No branch '${branch}' in '${remote}'" >&2; exit 1; } | ||
| git -C "${work}" fetch -q --depth 1 origin "${branch}" | ||
| git -C "${work}" checkout -q FETCH_HEAD | ||
| mkdir -p "${target}" | ||
| find "${work}" -maxdepth 1 -name '*.json' -exec cp {} "${target}" \; | ||
| ;; | ||
| push) | ||
| [[ -f "${target}" ]] || { echo "No file '${target}'" >&2; exit 1; } | ||
| if branch_exists; then | ||
| git -C "${work}" fetch -q --depth 1 origin "${branch}" | ||
| git -C "${work}" checkout -q -B "${branch}" FETCH_HEAD | ||
| else | ||
| git -C "${work}" checkout -q --orphan "${branch}" | ||
| fi | ||
| cp "${target}" "${work}/" | ||
| git -C "${work}" add -- "$(basename "${target}")" | ||
| if git -C "${work}" diff --cached --quiet; then | ||
| echo "$(basename "${target}") is already stored" >&2 | ||
| exit 0 | ||
| fi | ||
| git -C "${work}" -c user.name=harbor-benchmark -c user.email=harbor-benchmark@users.noreply.github.com \ | ||
| commit -q -m "Add $(basename "${target}")" | ||
| git -C "${work}" push -q origin "HEAD:refs/heads/${branch}" | ||
| ;; | ||
| *) | ||
| echo "${usage}" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| usage="usage: local-dir.sh pull <dir> | push <file.json> (BENCHMARK_DATA_DIR is the storage folder)" | ||
| store="${BENCHMARK_DATA_DIR:?${usage}}" | ||
| action="${1:?${usage}}" | ||
| target="${2:?${usage}}" | ||
|
|
||
| case "${action}" in | ||
| pull) | ||
| [[ -d "${store}" ]] || { echo "No storage folder '${store}'" >&2; exit 1; } | ||
| mkdir -p "${target}" | ||
| find "${store}" -maxdepth 1 -name '*.json' -exec cp {} "${target}" \; | ||
| ;; | ||
| push) | ||
| [[ -f "${target}" ]] || { echo "No file '${target}'" >&2; exit 1; } | ||
| mkdir -p "${store}" | ||
| cp "${target}" "${store}/" | ||
| ;; | ||
| *) | ||
| echo "${usage}" >&2 | ||
| exit 1 | ||
| ;; | ||
| esac |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Security: Release JSON and dashboard are published without the secrets scan
The README sets the rule "Nothing is published before it is scanned". It also says the report job scans its report text, even though that text is built only from
result.jsonfields and numbers taken from artifacts that were already scanned. The new release JSON comes from the same fields: task names, agent and model names,config.jsonmodel names and trial folder names. Yet it is uploaded as therelease-reportartifact and pushed to a durable external repository, anddashboard.htmlis uploaded too, withoutci/scan-secrets.pyrunning on either. This bypasses the scan the README describes, and the data store may become public (see open points). Fix: runpython3 -I benchmarks/harbor/ci/scan-secrets.py release-reportbefore the upload, the same wayreport.txtis scanned.Was this helpful? React with 👍 / 👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changed. The release JSON is built only from task, agent and model names and from numbers in result.json and trajectory.json final_metrics, never from message text, so I see no way for a secret to reach it. The artifacts it reads were already scanned and redacted by the benchmark jobs. I would rather not add a scan step to a PoC for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked
benchmarks/harbor/report/to-json.ts. The output has no message text: the only free-form strings aretask,agentandmodel, and everything else is a number or a fixed status. The leak risk is lower than the finding suggests.One gap remains. On the crash path (
crashedTrialRecord, lines 100-109),taskcomes from the trial folder name andagent/modelfromconfig.json. Those files were not read fromresult.json, and the agent may be able to write them. The README says the artifacts were "already scanned and redacted", but a value in a field that no scan flagged would still be published to the external repository and the dashboard.If you accept that small risk for the PoC, the finding can stay as a known limitation. Running
python3 -I benchmarks/harbor/ci/scan-secrets.py release-reportbefore the upload is a one-line step if you change your mind. I made no code changes.