This repository was archived by the owner on Sep 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Lab-2143 CI Fixes #3
Merged
pr0uxx
merged 5 commits into
main
from
LAB-2143-LogEngine-extremely-decoupled-from-shield
Jul 30, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8c960d0
Pin Socket CLI version in reachability workflow
pr0uxx 090bc78
Set GitHub registry only for publish step
pr0uxx 5dabb4a
Automate Socket reachability pin updates
pr0uxx 7369a83
Set npm auth token before GitHub publish
pr0uxx f0058cd
Update Security-Reachability.yml
pr0uxx 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
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,67 @@ | ||
| import { readFile, writeFile } from 'node:fs/promises'; | ||
| import { fileURLToPath } from 'node:url'; | ||
|
|
||
| const PYPI_URL = 'https://pypi.org/pypi/socketsecurity/json'; | ||
| const RELEASE_AGE_MILLISECONDS = 24 * 60 * 60 * 1000; | ||
| const workflowPath = fileURLToPath(new URL('../.github/workflows/Security-Reachability.yml', import.meta.url)); | ||
| const versionPattern = /^\d+(?:\.\d+)*$/u; | ||
| const pinPattern = /socketsecurity==(?<version>\d+(?:\.\d+)*)/gu; | ||
|
|
||
| const compareVersions = (left, right) => { | ||
| const leftParts = left.split('.').map(Number); | ||
| const rightParts = right.split('.').map(Number); | ||
| const partCount = Math.max(leftParts.length, rightParts.length); | ||
|
|
||
| for (let index = 0; index < partCount; index += 1) { | ||
| const difference = (leftParts[index] ?? 0) - (rightParts[index] ?? 0); | ||
|
|
||
| if (difference !== 0) { | ||
| return difference; | ||
| } | ||
| } | ||
|
|
||
| return 0; | ||
| }; | ||
|
|
||
| const response = await fetch(PYPI_URL); | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(`Unable to retrieve socketsecurity releases from PyPI: ${ response.status } ${ response.statusText }`); | ||
| } | ||
|
|
||
| const { releases } = await response.json(); | ||
| const cutoffTime = Date.now() - RELEASE_AGE_MILLISECONDS; | ||
| const eligibleRelease = Object.entries(releases) | ||
| .filter(([version, files]) => versionPattern.test(version) && Array.isArray(files) && files.length > 0 && files.every((file) => !file.yanked)) | ||
| .map(([version, files]) => { | ||
| const mostRecentUpload = Math.max(...files.map((file) => Date.parse(file.upload_time_iso_8601))); | ||
|
|
||
| return { | ||
| 'mostRecentUpload': mostRecentUpload, | ||
| 'version': version | ||
| }; | ||
| }) | ||
| .filter(({ mostRecentUpload }) => Number.isFinite(mostRecentUpload) && mostRecentUpload <= cutoffTime) | ||
| .sort((left, right) => compareVersions(right.version, left.version))[0]; | ||
|
|
||
| if (!eligibleRelease) { | ||
| throw new Error('PyPI did not return a non-yanked stable socketsecurity release at least 24 hours old.'); | ||
| } | ||
|
|
||
| const workflow = await readFile(workflowPath, 'utf8'); | ||
| const pins = [...workflow.matchAll(pinPattern)]; | ||
|
|
||
| if (pins.length !== 1) { | ||
| throw new Error(`Expected exactly one socketsecurity pin in ${ workflowPath }, found ${ pins.length }.`); | ||
| } | ||
|
|
||
| const currentVersion = pins[0].groups.version; | ||
|
|
||
| if (currentVersion === eligibleRelease.version) { | ||
| process.stdout.write(`Reachability pin is current: socketsecurity==${ currentVersion }\n`); | ||
| } else { | ||
| const updatedWorkflow = workflow.replace(pinPattern, `socketsecurity==${ eligibleRelease.version }`); | ||
|
|
||
| await writeFile(workflowPath, updatedWorkflow); | ||
| process.stdout.write(`Updated reachability pin: socketsecurity==${ currentVersion } -> socketsecurity==${ eligibleRelease.version }\n`); | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.