Skip to content

Commit c733110

Browse files
fix(security): stabilize remote checksum requirements
1 parent 6ecb4f6 commit c733110

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

scripts/generated/internal_checksums.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Used by check-manifest-drift.sh to detect unauthorized changes.
99

1010
declare -gA ACFS_INTERNAL_CHECKSUMS=(
11-
[scripts/lib/security.sh]="3fbf41fedfc47a8ef7bf382d6ca9b5d5a64db223a00a367fd2616a08c54a98a6"
11+
[scripts/lib/security.sh]="e71370eab043af60c60e56a627410ea5073c9715b9a4bbf213536b407c35d192"
1212
[scripts/lib/agents.sh]="66fac24c48c9ce7d17ae213ff2f8669a1902e77f01266f4eeaccdcef09e02856"
1313
[scripts/lib/update.sh]="c6c35bbaec3ce7d62e1ad024a1583ec99a58b3a89587b010ed37f70aadf5906f"
1414
[scripts/lib/doctor.sh]="8b055f242330f1e9571bb25d006ff09cf1f8bcbe81ba07260959e37c1b0f9e2b"

scripts/lib/security.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ declare -gA KNOWN_INSTALLERS=(
375375
[asb]="https://raw.githubusercontent.com/Dicklesworthstone/agent_settings_backup_script/main/install.sh"
376376
[pcr]="https://raw.githubusercontent.com/Dicklesworthstone/post_compact_reminder/main/install-post-compact-reminder.sh"
377377
)
378+
declare -ga ACFS_SECURITY_REQUIRED_INSTALLERS=("${!KNOWN_INSTALLERS[@]}")
378379

379380
# ============================================================
380381
# Checksum Verification Policy
@@ -1079,7 +1080,7 @@ acfs_checksums_file_looks_valid() {
10791080
fi
10801081
done < "$file"
10811082

1082-
for tool in "${!KNOWN_INSTALLERS[@]}"; do
1083+
for tool in "${ACFS_SECURITY_REQUIRED_INSTALLERS[@]}"; do
10831084
if [[ -z "${parsed_installers[$tool]:-}" ]] || [[ -z "${parsed_checksums[$tool]:-}" ]]; then
10841085
return 1
10851086
fi

tests/unit/lib/test_security.bats

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ write_security_checksums_fixture() {
2222
local index=1
2323

2424
printf 'installers:\n' > "$output_file"
25-
for tool in "${!KNOWN_INSTALLERS[@]}"; do
25+
for tool in "${ACFS_SECURITY_REQUIRED_INSTALLERS[@]}"; do
2626
printf -v checksum '%064d' "$index"
2727
printf ' %s:\n' "$tool" >> "$output_file"
2828
printf ' url: "%s"\n' "${KNOWN_INSTALLERS[$tool]}" >> "$output_file"
@@ -528,6 +528,17 @@ EOF
528528
assert_failure
529529
}
530530

531+
@test "acfs_checksums_file_looks_valid: ignores dynamic local installer keys" {
532+
local full_file
533+
full_file="$(create_temp_file)"
534+
535+
write_security_checksums_fixture "$full_file"
536+
KNOWN_INSTALLERS["local_only_tool"]="https://example.com/local-only.sh"
537+
538+
run acfs_checksums_file_looks_valid "$full_file"
539+
assert_success
540+
}
541+
531542
@test "acfs_refresh_loaded_checksums_from_remote: partial remote metadata preserves loaded state" {
532543
local existing_sha="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
533544

0 commit comments

Comments
 (0)