Repository navigation
Release: dev into main #8
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
12 commits
Select commit
Hold shift + click to select a range
649f2a5
./check.sh: the repository's check, which CI runs
florianamette 7bf4403
Merge pull request #1 from CyberCTF/check-command
florianamette 108bdfa
The image carries an SBOM and its provenance, and the published index…
florianamette 830c4d8
Merge pull request #2 from CyberCTF/image-sbom-provenance
florianamette 7af9d9c
player-account.sh: the folder's group is the account's own where it i…
florianamette 13d711c
Merge pull request #3 from CyberCTF/shared-folder-squashed
florianamette cb39d26
The launcher pins a commit and the scripts' hashes; their tests live …
florianamette d1741e7
Merge pull request #5 from CyberCTF/pin-commit-and-hashes
florianamette 8ac69a8
tests/scripts.sh: nothing is accepted on the player's behalf
florianamette 724261a
Merge pull request #6 from CyberCTF/scripts-accept-nothing
florianamette 54261e2
vm/toolset.sh: a small fixed set where Kali's toolset isn't there
florianamette 5771a69
Merge pull request #7 from CyberCTF/vm-toolset-small-set
florianamette 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,36 @@ | ||
| #!/usr/bin/env bash | ||
| # The attack box's check, the command CI runs (.github/workflows/image.yml) and a contributor runs: | ||
| # | ||
| # ./check.sh the scripts: the VM set-up's compositions parse, shellcheck passes, and | ||
| # their tests (tests/scripts.sh) pass | ||
| # ./check.sh image the image built locally (no registry, no secrets) and smoke-tested | ||
| # ./check.sh all both | ||
| # | ||
| # The VM set-up's parts are fragments of one script (vm/kali.sh defines `$keep`): each composition | ||
| # the launcher makes must parse, with the player's account between the toolset and the desktop. | ||
| set -euo pipefail | ||
| cd "$(dirname "$0")" | ||
|
|
||
| scripts() { | ||
| local parts | ||
| for parts in "vm/kali.sh vm/toolset.sh" "vm/kali.sh vm/toolset.sh vm/desktop.sh" "vm/kali.sh vm/desktop.sh"; do | ||
| # shellcheck disable=SC2086 # the list is the files, split on purpose | ||
| if ! cat $parts | sh -n; then echo "check: the VM set-up doesn't parse as $parts" >&2; return 1; fi | ||
| done | ||
| shellcheck check.sh player-account.sh smoke-test.sh tests/scripts.sh | ||
| tests/scripts.sh | ||
| echo "check: scripts ok" | ||
| } | ||
|
|
||
| image() { | ||
| docker build --pull -t attack-box:smoke . | ||
| ./smoke-test.sh attack-box:smoke | ||
| echo "check: image ok" | ||
| } | ||
|
|
||
| case "${1:-scripts}" in | ||
| scripts) scripts ;; | ||
| image) image ;; | ||
| all) scripts && image ;; | ||
| *) echo "usage: ./check.sh [scripts|image|all]" >&2; exit 2 ;; | ||
| 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
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.
When running
./check.sh all, callingscriptson the left side of&&disables Bash'serrexitbehavior throughout that function. Consequently, failures fromshellcheckortests/scripts.share ignored, the final echo reports success, and the image checks proceed; if those pass, the overall command exits successfully despite failed script checks. This was reproduced with a failing shellcheck stub. Invokescriptsoutside the conditional list or explicitly propagate failures from both checks.Useful? React with 👍 / 👎.