fix: privateer binary version compatibility with pvtr-github-repo-scanner v0.23.2 (IN-1170)#4214
Open
joanagmaia wants to merge 12 commits into
Open
fix: privateer binary version compatibility with pvtr-github-repo-scanner v0.23.2 (IN-1170)#4214joanagmaia wants to merge 12 commits into
joanagmaia wants to merge 12 commits into
Conversation
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the security_best_practices_worker Docker build to use a newer privateer binary that is compatible with the pvtr-github-repo-scanner plugin version already pinned in the image, addressing IPC (gob) decoding failures caused by SDK version mismatch.
Changes:
- Bump
privateerbinary version from0.7.0to0.21.2inDockerfile.security_best_practices_worker.
Note: The PR title does not include a JIRA key in parentheses (expected format is type: description (CM-XXX) per .claude/rules/commit-workflow.md:52-56), so CI/policy checks may fail until that’s corrected.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
32134a4 to
fb2616b
Compare
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
…K fields privateer-sdk v1.24.0 removed `run-duration` in favor of `start`/`end` timestamps; compute the duration locally so the existing column stays populated. Adds the new optional `plan` and `confidence-level` fields to the YAML types so they survive parsing into Redis. Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
…ps (IN-1170) Addresses PR review: guard against null returns from redis cache and post-insert DB lookups so workflow failures surface with context instead of TypeError on undefined property access. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
…or fields (IN-1170) Addresses PR review: guard computeRunDuration against missing or unparseable timestamps so NaN/negative durations don't reach the DB, and attach truncated stdout/stderr on rejected binary errors so Temporal payloads stay within serialization limits. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
39ed854 to
f394703
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Restores the
upsertOSPSBaselineSecurityInsightsworkflow after the plugin upgrade in #4126. That PR bumpedpvtr-github-repo-scannerto v0.23.2 (requiresprivateer-sdk v1.24.0) but left the rest of the stack on the v1.4.0 contract, causing the workflow to fail at every layer.What changed
Dockerfile (
scripts/services/docker/Dockerfile.security_best_practices_worker)0.7.0→0.21.2to match the plugin's SDKpvtrbinary asprivateer/root/.privateer/bin/plugins.jsonso the SDK's new manifest-based plugin discovery finds thegithub-repopluginRuntime (
services/apps/security_best_practices_worker/src/activities/index.ts)runBinarytreats exit code1(failed assessments — run completed) as success, since the result file is still written. Codes ≥2 still reject and attach truncated stdout/stderr as structured fields on the errorsaveOSPSBaselineInsightsToDBupdated for the new YAML shape (see below)runDurationderived fromstart/endtimestamps (the SDK no longer emits it as a discrete field)Types (
services/apps/security_best_practices_worker/src/types.ts)evaluation-suites,catalog-id,start-time,end-time,corrupted-state),control-evaluationsis now a nestedEvaluationLogobject with anevaluationsarray,assessment-logsreplacesassessments, and control/requirement IDs are now nestedEntryMappingobjects withreference-id/entry-id. Verified field-for-field againstgemaraproj/go-gemarav0.4.0planandconfidence-levelfields shipped by the SDK so they survive the YAML → Redis hop (DB persistence deferred — see follow-ups)Schema changes shipped by upstream
Five fields the old SDK emitted are no longer present in the v1.24.0 output. Tracked upstream:
corrupted-stateper controlremediation-guideper controlassessment-logs[].recommendation(ossf/gemara#109) — already captured per-assessmentrun-durationper assessmentstart+endtimestamps (ossf/gemara#112) — derived locally in this PRvalueper assessmentchangesper assessmentThe DB columns for the removed-without-replacement fields (
corruptedStateper-control,value,changes) will be populated with their default (false/''/null) for new rows.ON CONFLICT DO UPDATEis left as plainEXCLUDED.*, so re-evaluations overwrite normally.Verified no display impact: the Tinybird pipe that feeds the Insights security widget (
security_deduplicated_merged_copy_pipe.pipe) does not project any of the 5 fields, and the frontendSecurityData/SecurityAssessmentDatatypes inlfx-insightsonly consumecontrolId,result,message,category,assessments[].{requirementId, description, result, message, recommendation}. All of these are still populated.Follow-ups (not in this PR)
confidence-levelandplanto new columns onsecurityInsightsEvaluationAssessments— net-new SDK data we currently drop after parsingcorruptedStateper-control,remediationGuide,runDuration,value,changes) and clean up the Tinybird datasource schemas — they're unused downstreamTest plan
upsertOSPSBaselineSecurityInsightsagainst a test reposecurityInsightsEvaluationsandsecurityInsightsEvaluationAssessmentsrows:recommendation,start,end,runDurationpopulated; missing fields default as documentedNote
Medium Risk
Touches the end-to-end OSPS evaluation → Redis → Postgres path and changes how several assessment fields are persisted, though downstream Insights display is documented as unchanged.
Overview
Restores the OSPS baseline security insights Temporal workflow after the
pvtr-github-repo-scannerupgrade by aligning the container and worker with the newer Privateer SDK output contract.The security_best_practices_worker image now ships privateer
0.21.2(renamedpvtrbinary), writesplugins.jsonfor manifest-basedgithub-repoplugin discovery, and keeps the plugin pinned to v0.23.2.Runtime parsing and persistence were updated for the v1.24.0 YAML shape: kebab-case keys, nested
control-evaluations.evaluations,assessment-logsinstead ofassessments, and control/requirement IDs from nestedentry-idfields.runBinarytreats exit code 1 (failed assessments but completed run) as success;saveOSPSBaselineInsightsToDBadds guards for missing Redis/suite rows, derivesrunDurationfromstart/end, and stores defaults where upstream removed per-controlcorrupted-state,remediation-guide,value, andchanges.Reviewed by Cursor Bugbot for commit 871c16d. Bugbot is set up for automated code reviews on this repo. Configure here.