omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tests / path / check_path_boundary.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # TEST HARNESS: PATH-1 boundary check (spec 8.2 and 17.2). |
| 18 | # A path is evidence, never authority: the PATH module must not reference |
| 19 | # runtime or capability symbols, offer any execute, dispatch, promote or |
| 20 | # authorize entry point, or use heap, threads, sockets or host I/O syscalls. |
| 21 | # Comments are stripped before matching. |
| 22 | set -eu |
| 23 | root=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd) |
| 24 | bad=0 |
| 25 | for f in "$root/src/path/rx_path.om" "$root/src/path/rx_path_core.om"; do |
| 26 | code=$(sed -E '/^[[:space:]]*note([[:space:]].*)?$/d' "$f") |
| 27 | if printf '%s\n' "$code" | grep -nE 'aienos_cap_|RX_ERR_CAP|rx_world_|rx_argus_|rx_cortex_|rx_jspace_' ; then |
| 28 | echo "BOUNDARY $f: references capability or runtime symbols" >&2; bad=1 |
| 29 | fi |
| 30 | if printf '%s\n' "$code" | grep -nE 'rx_path_[a-z_]*(exec|run|dispatch|authori|grant|promot|permit|effect)' ; then |
| 31 | echo "BOUNDARY $f: declares an authority-bearing entry point" >&2; bad=1 |
| 32 | fi |
| 33 | if printf '%s\n' "$code" | grep -nE '\b(fopen|fclose|read|write|stat|renames|socknew|bind|listen|accept|send|recv|connect|execve|fork|mmap|malloc|calloc|realloc|free|pthread_[a-z_]*)\b' ; then |
| 34 | echo "BOUNDARY $f: uses heap, threads or system calls" >&2; bad=1 |
| 35 | fi |
| 36 | done |
| 37 | if [ "$bad" -ne 0 ]; then exit 1; fi |
| 38 | echo "PATH boundary: PASS (no runtime links, no authority entry points, no heap or threads)" |