-
Notifications
You must be signed in to change notification settings - Fork 0
fix(pkg): harden FHIR registry fallback downloads #12
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9eda1a6
fix(pkg): validate and follow bounded registry tarball redirect
TheHalfMoon 5b8753c
test(pkg): cover real FHIR registry archive paths
TheHalfMoon c7be69a
ci(pkg): add bounded real registry download smoke
TheHalfMoon ddc7e83
style(pkg): apply rustfmt to registry hotfix
TheHalfMoon be94f92
test(pkg): measure official US Core archive layout
TheHalfMoon 6456adb
test(pkg): locate dependency manifest bound failure
TheHalfMoon 77cea4f
test(pkg): measure VSAC fallback manifest position
TheHalfMoon 8da4a42
fix(pkg): bound late-manifest decompression adaptively
TheHalfMoon 7d52cad
test(pkg): finalize registry archive smoke
TheHalfMoon 85a1ae3
test(pkg): isolate registry fallback end-to-end smoke
TheHalfMoon df319c6
fix(pkg): preserve redirect timeout budget
TheHalfMoon 68c9502
ci(pkg): pin registry smoke actions
TheHalfMoon b307154
style(pkg): apply rustfmt to timeout fix
TheHalfMoon e93b886
ci(pkg): pin node24 checkout revision
TheHalfMoon f4f12d0
fix(pkg): tighten manifest scan amplification bound
TheHalfMoon 14054ae
ci(pkg): harden live registry evidence
TheHalfMoon 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| name: registry-download-smoke | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - crates/commandf-pkg/src/archive.rs | ||
| - crates/commandf-pkg/src/registry.rs | ||
| - .github/workflows/registry-download-smoke.yml | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - crates/commandf-pkg/src/archive.rs | ||
| - crates/commandf-pkg/src/registry.rs | ||
| - .github/workflows/registry-download-smoke.yml | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| registry-download: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5 / node24 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: dtolnay/rust-toolchain@032958afbdc797a9164d3bc0b56325c1308924a5 # 1.97.1 | ||
| with: | ||
| components: rustfmt, clippy | ||
|
|
||
| - name: Format | ||
| run: cargo fmt --all -- --check | ||
|
|
||
| - name: Focused registry unit tests | ||
| run: cargo test --locked -p commandf-pkg registry::tests -- --skip real_primary_us_core_is_direct_gzip --skip real_secondary_us_core_follows_only_expected_tarball | ||
|
|
||
| - name: Focused archive bound tests | ||
| run: cargo test --locked -p commandf-pkg archive::tests | ||
|
|
||
| - name: Real primary US Core archive response | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| retry() { | ||
| local attempt=1 | ||
| until "$@"; do | ||
| if (( attempt >= 3 )); then | ||
| echo "real primary registry probe failed after ${attempt} attempts" >&2 | ||
| return 1 | ||
| fi | ||
| echo "real primary registry probe failed on attempt ${attempt}; retrying" >&2 | ||
| sleep $((attempt * 5)) | ||
| attempt=$((attempt + 1)) | ||
| done | ||
| } | ||
| retry cargo test --locked -p commandf-pkg registry::tests::real_primary_us_core_is_direct_gzip -- --ignored --exact | ||
|
|
||
| - name: Real secondary redirect-to-tarball response | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| retry() { | ||
| local attempt=1 | ||
| until "$@"; do | ||
| if (( attempt >= 3 )); then | ||
| echo "real secondary registry probe failed after ${attempt} attempts" >&2 | ||
| return 1 | ||
| fi | ||
| echo "real secondary registry probe failed on attempt ${attempt}; retrying" >&2 | ||
| sleep $((attempt * 5)) | ||
| attempt=$((attempt + 1)) | ||
| done | ||
| } | ||
| retry cargo test --locked -p commandf-pkg registry::tests::real_secondary_us_core_follows_only_expected_tarball -- --ignored --exact | ||
|
|
||
| - name: End-to-end exact VSAC fallback resolve and verify | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| for attempt in 1 2 3; do | ||
| rm -rf /tmp/commandf-registry-smoke | ||
| if cargo run --locked --quiet -p commandf -- \ | ||
| pkg resolve us.nlm.vsac@0.24.0 \ | ||
| --cache /tmp/commandf-registry-smoke/cache \ | ||
| --lock /tmp/commandf-registry-smoke/commandf.lock \ | ||
| && cargo run --locked --quiet -p commandf -- \ | ||
| pkg verify \ | ||
| --cache /tmp/commandf-registry-smoke/cache \ | ||
| --lock /tmp/commandf-registry-smoke/commandf.lock \ | ||
| && python - <<'PY' | ||
| import json | ||
| from pathlib import Path | ||
|
|
||
| lock = json.loads(Path('/tmp/commandf-registry-smoke/commandf.lock').read_text()) | ||
| matches = [ | ||
| item for item in lock['packages'] | ||
| if item['name'] == 'us.nlm.vsac' and item['version'] == '0.24.0' | ||
| ] | ||
| assert len(matches) == 1 | ||
| package = matches[0] | ||
| assert len(package['sha256']) == 64 | ||
| assert package['source'] == 'https://packages2.fhir.org/web/us.nlm.vsac-0.24.0.tgz' | ||
| PY | ||
| then | ||
| exit 0 | ||
| fi | ||
| if (( attempt >= 3 )); then | ||
| echo "VSAC fallback resolve/verify failed after ${attempt} attempts" >&2 | ||
| exit 1 | ||
| fi | ||
| echo "VSAC fallback resolve/verify failed on attempt ${attempt}; retrying" >&2 | ||
| sleep $((attempt * 5)) | ||
| done | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.