Commit e96c40c
š llx: stop array contains/difference builtins panicking on a null argument (#8320)
* š llx: stop array contains/difference builtins panicking on a null argument
`arrayContainsAll`, `arrayContainsNone`, and `arrayDifferenceV2` guarded the
receiver array against null but then did an unchecked `arg.Value.([]any)` on
the argument. When the argument resolves to a typed null array ā e.g. a
`map[string][]T` key miss such as `pam.conf.services["su"]` on a host with no
`/etc/pam.d` (COS, Flatcar, Bottlerocket k8s nodes) ā that assertion panics
with `interface conversion: interface {} is nil, not []interface {}`.
Because the executor runs blocks in goroutines the panic is unrecoverable and
crashes the entire scan rather than failing the single check. The dict
variants already use the safe comma-ok form; only the array variants were
affected.
Guard the argument the same way the receiver is guarded: a null argument
propagates as null. The compiled `⦠== []` wrapper then resolves the check to
a clean pass/fail instead of crashing.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* š¢ core: lock containsAll-of-empty-list returns true
mondoo-linux-security's su-restriction check relies on
`groups.containsAll(suRestrictedGroups)` being true when suRestrictedGroups is
an empty (typed, non-null) []string. Add a regression test pinning that
containsAll of an empty list is vacuously satisfied, distinct from the null-arg
case which propagates null.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 379da11 commit e96c40c
2 files changed
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
815 | 815 | | |
816 | 816 | | |
817 | 817 | | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
818 | 826 | | |
819 | 827 | | |
820 | 828 | | |
| |||
920 | 928 | | |
921 | 929 | | |
922 | 930 | | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
923 | 939 | | |
924 | 940 | | |
925 | 941 | | |
| |||
973 | 989 | | |
974 | 990 | | |
975 | 991 | | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
976 | 1000 | | |
977 | 1001 | | |
978 | 1002 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
741 | 741 | | |
742 | 742 | | |
743 | 743 | | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
744 | 769 | | |
745 | 770 | | |
746 | 771 | | |
| |||
0 commit comments