-
Notifications
You must be signed in to change notification settings - Fork 15
test: add e2e tests for RV bypass functionality #127
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
Open
sarmahaj
wants to merge
1
commit into
fido-device-onboard:main
Choose a base branch
from
sarmahaj:e2e-rv-bypass
base: main
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.
Open
Changes from all commits
Commits
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,20 @@ | ||
| services: | ||
| go-fdo-client: | ||
| container_name: go-fdo-client | ||
| hostname: go-fdo-client | ||
| image: go-fdo-client | ||
| # Build from local go-fdo-client directory with RV bypass support | ||
| # Path is relative to this compose file: deployments/compose/client/ | ||
| # ../../../ goes to project root, then ../go-fdo-client to sibling dir | ||
| build: ../../../../go-fdo-client | ||
| working_dir: ${container_working_dir:-/workdir}/device-credentials | ||
| user: "${container_user}" | ||
| networks: | ||
| - fdo | ||
| volumes: | ||
| - ${base_dir:-./test/workdir}:${container_working_dir:-/workdir} | ||
| restart: no | ||
| networks: | ||
| fdo: | ||
| name: fdo | ||
| external: true |
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,66 @@ | ||
| include: | ||
| - fdo-networks.yaml | ||
| services: | ||
| manufacturer: | ||
| container_name: manufacturer | ||
| hostname: manufacturer | ||
| image: manufacturer | ||
| build: ../../.. | ||
| environment: | ||
| TZ: Europe/Madrid | ||
| user: ${container_user} | ||
| command: | ||
| - --db-type=sqlite | ||
| - --db-dsn=file:${container_working_dir:-/workdir}/manufacturer.db | ||
| - --log-level=debug | ||
| - manufacturing | ||
| - manufacturer:8038 | ||
| - --manufacturing-key=${container_working_dir:-/workdir}/certs/manufacturer.key | ||
| - --owner-cert=${container_working_dir:-/workdir}/certs/owner.crt | ||
| - --device-ca-cert=${container_working_dir:-/workdir}/certs/device_ca.crt | ||
| - --device-ca-key=${container_working_dir:-/workdir}/certs/device_ca.key | ||
| working_dir: ${container_working_dir:-/workdir} | ||
| volumes: | ||
| - ${base_dir:-./test/workdir}:${container_working_dir:-/workdir} | ||
| networks: | ||
| - fdo | ||
| ports: | ||
| - 8038:8038 | ||
| restart: unless-stopped | ||
| healthcheck: | ||
| test: [ "CMD", "curl --silent --output /dev/null --fail http://manufacturer:8038/health" ] | ||
| interval: 5s | ||
| timeout: 30s | ||
| retries: 5 | ||
| start_period: 5s | ||
|
|
||
| owner: | ||
| container_name: owner | ||
| hostname: owner | ||
| image: owner | ||
| build: ../../.. | ||
| environment: | ||
| TZ: Europe/Madrid | ||
| user: ${container_user} | ||
| command: | ||
| - --db-type=sqlite | ||
| - --db-dsn=file:${container_working_dir:-/workdir}/owner.db | ||
| - --log-level=debug | ||
| - owner | ||
| - owner:8043 | ||
| - --owner-key=${container_working_dir:-/workdir}/certs/owner.key | ||
| - --device-ca-cert=${container_working_dir:-/workdir}/certs/device_ca.crt | ||
| working_dir: ${container_working_dir:-/workdir} | ||
| volumes: | ||
| - ${base_dir:-./test/workdir}:${container_working_dir:-/workdir} | ||
| networks: | ||
| - fdo | ||
| ports: | ||
| - 8043:8043 | ||
| restart: unless-stopped | ||
| healthcheck: | ||
| test: [ "CMD", "curl --silent --output /dev/null --fail http://owner:8043/health" ] | ||
| interval: 5s | ||
| timeout: 30s | ||
| retries: 5 | ||
| start_period: 5s |
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,99 @@ | ||
| #! /usr/bin/env bash | ||
| # RV bypass test: Device skips TO1 by getting Owner address directly from voucher (TO0 not needed) | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/utils.sh" | ||
|
|
||
| verify_rv_bypass_behavior() { | ||
| local guid="$1" | ||
| local device_log="${logs_dir}/onboarding-device-${guid}.log" | ||
|
|
||
| echo " 🔍 Checking device onboard log for bypass indicators..." | ||
|
|
||
| # Device onboarding completed successfully | ||
| if grep -q "FIDO Device Onboard Complete" "${device_log}" || grep -q "Credential Reuse Protocol" "${device_log}"; then | ||
sarmahaj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo " ✅ Device onboarding completed" | ||
| else | ||
| echo " ❌ Device onboarding did not complete" | ||
| cat "${device_log}" | ||
| return 1 | ||
| fi | ||
|
|
||
| # Rendezvous service was NOT contacted (device skips TO1, no TO0 needed) | ||
| if [ -f "${rendezvous_log}" ]; then | ||
| echo " ❌ Rendezvous log exists but should not with RV bypass!" | ||
| return 1 | ||
| fi | ||
| echo " ✅ Rendezvous service was not used (device skipped TO1)" | ||
|
|
||
| # Owner received TO2 directly (msg/60) | ||
| find_in_log_or_fail "${owner_log}" 'msg/60' | ||
| echo " ✅ Owner received TO2 protocol messages (direct connection)" | ||
|
|
||
| # Owner completed TO2 (msg/70) | ||
| find_in_log_or_fail "${owner_log}" 'msg/70' | ||
| echo " ✅ Owner completed TO2 protocol" | ||
|
|
||
| echo " 🎉 RV bypass behavior verified successfully!" | ||
| } | ||
|
|
||
| run_test() { | ||
|
|
||
| echo "⭐ Creating directories" | ||
| create_directories | ||
|
|
||
| echo "⭐ Cleaning up any old log files" | ||
| rm -f "${logs_dir}"/*.log | ||
|
|
||
| echo "⭐ Generating service certificates" | ||
| generate_service_certs | ||
|
|
||
| echo "⭐ Build and install 'go-fdo-client' binary" | ||
| install_client | ||
|
|
||
| echo "⭐ Build and install 'go-fdo-server' binary" | ||
| install_server | ||
|
|
||
| echo "⭐ Adding hostnames to /etc/hosts" | ||
| set_hostnames | ||
|
|
||
| echo "⭐ Start Manufacturing and Owner services (NO Rendezvous with bypass!)" | ||
| start_service "${manufacturer_service_name}" | ||
| start_service "${owner_service_name}" | ||
|
|
||
| echo "⭐ Wait for the services to be ready:" | ||
| wait_for_service_ready "${manufacturer_service_name}" | ||
| wait_for_service_ready "${owner_service_name}" | ||
|
|
||
| echo "⭐ Setting Rendezvous Info with RV BYPASS flag" | ||
| set_or_update_rendezvous_info "${manufacturer_url}" "${owner_service_name}" "${owner_dns}" "${owner_port}" "http" "true" | ||
|
|
||
| echo "⭐ Run Device Initialization" | ||
| run_device_initialization | ||
|
|
||
| guid=$(get_device_guid) | ||
| echo "⭐ Device initialized with GUID: ${guid}" | ||
|
|
||
| echo "⭐ Sending Ownership Voucher to the Owner" | ||
| send_manufacturer_ov_to_owner "${manufacturer_url}" "${guid}" "${owner_url}" | ||
|
|
||
| echo "⭐ Setting or updating Owner Redirect Info (RVTO2Addr)" | ||
| set_or_update_owner_redirect_info "${owner_url}" "${owner_service_name}" "${owner_dns}" "${owner_port}" | ||
|
|
||
| echo "⭐ SKIPPING TO0 (no need - device will skip TO1 via RV bypass)" | ||
|
|
||
| echo "⭐ Running FIDO Device Onboard with RV bypass" | ||
| run_fido_device_onboard --debug | ||
|
|
||
| echo "⭐ Saving container logs (no-op for binary tests)" | ||
| save_logs | ||
|
|
||
| echo "⭐ Verifying RV bypass behavior in logs" | ||
| verify_rv_bypass_behavior "${guid}" | ||
|
|
||
| echo "⭐ Success! ✅" | ||
| } | ||
|
|
||
| # Allow running directly | ||
| [[ "${BASH_SOURCE[0]}" != "$0" ]] || { run_test; cleanup; } | ||
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,12 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/../ci/test-rv-bypass.sh" | ||
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/utils.sh" | ||
|
|
||
| client_compose_file="deployments/compose/client/fdo-client-rv-bypass.yaml" | ||
| servers_compose_file="deployments/compose/server/fdo-rv-bypass-servers.yaml" | ||
|
|
||
| # Allow running directly | ||
| [[ "${BASH_SOURCE[0]}" != "$0" ]] || { run_test; cleanup; } |
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.
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.
Check notice
Code scanning / devskim
A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note