Skip to main content

Verifying the Secure Baseline

Simple Story

Even a rule sheet that allows no worksheet lets a few through. The permitted aids need them to do their work, such as picking a random number.

Both ways of watching have to let exactly the same things through and stop the same things. This page lists each one and the proof that the two agree. They agree on every one but one. With some editions of the permitted aids, one way stops an aid fetching a tool it needs for itself, and the other way never sees it. Where one way never even sees an act, the page names that difference, so a new one cannot slip in unseen.

Who is who

The secure baseline is what a policy with no file entries still allows. The instructor-facing list is What works without an entry. This page records how each backend decides each item and which test proves it, so a change to one backend that the other does not follow fails the build.

The parity test​

BaselineExemptionParityTest (src/test/java/de/tum/cit/ase/ares/api/aop/java/) sends the same call, with the same arguments and the same allow-list, through the real file-system check of both runtime backends, from a supervised frame (example.student.BaselineAdviceProbe). Each row states the verdict expected from each backend. A row whose two verdicts differ must be named in INTENDED_ASYMMETRIES, and every name there must still differ, so fixing a difference forces its entry to be deleted. Today the list is empty: every verdict row agrees.

The same class compares the constants the backends duplicate:

  • the native-library suffixes trusted under java.home, equal on both;
  • the random-seed devices, named on instrumentation only (see below);
  • no list of file names allowed wherever they lie, on either backend;
  • the calls ArchUnit and T. J. Watson Libraries for Analysis (WALA) allow without an entry, equal once both use one notation.

What each backend decides​

OperationInstrumentationAspectJProven by (parity test covers runtime backends only)
Read under java.homeAllowed: trusted start-up rootAllowed: same root, from the Java Virtual Machine (JVM)'s start-up recordParity test; BaselineStandardAllowTest (certificates, locale and charset data)
Create, replace or delete under java.homeRefusedRefusedParity test
Load a Java Development Kit (JDK) native library under java.home, by pathAllowedAllowedParity test
The JDK loading its own native library by nameAllowed at Runtime.loadLibrary0 for a caller from the JVM's own or the platform class loader, a plain name and a file directly in the JDK's library folder, on JDK 17, 21 and 25 onlyNothing to allow: the JDK's call sites are not wovenNativeLibraryFirstLoadTest; NativeLibraryJdkLoadTest
Load a native library by name from student code, or from test code beneath student codeRefusedRefusedParity test (the three by bare name rows); NativeLibraryLoadDeniedTest
Read a .jar in the start-up Maven repositoryAllowedAllowedParity test; JceGeneratedExerciseTest (start-up repository only)
Read an entry of an already-open JarFile/ZipFileAllowed for entries or getInputStream on a JDK archive class; Ares still checks opening itSameParity test (including malformed method details); ArchiveEntryInterceptionTest (student subclass, four modes); BaselineStandardAllowTest (open JDK archives, both backends)
SecureRandom, UUID.randomUUID()Allowed while the JDK's own seed class reads the deviceNothing to allow: the JDK's read is not wovenBaselineStandardAllowTest; BaselineStillDeniedTest (direct read, provider callback)
System timezoneNothing to allow: read natively or under java.homeSameBaselineStandardAllowTest; BaselineStillDeniedTest (direct read)
Temporary file without a directoryAllowed in the directory fixed at start-upAllowed in the start-up directoryParity test; BaselineStandardAllowTest; BaselineStillDeniedTest (named directories, links, a planting file attribute)
Files.createTempDirectoryRefusedRefusedParity test; BaselineStillDeniedTest
A file named like one of Ares's own filesChecked like any other fileChecked like any other fileParity test
A student recordRewritten for thread and monitor calls; its generated methods pass throughWoven like any classBaselineStandardAllowTest.test_useRecord…, ThreadSystemAccessTest.test_recordStartsThread…, JavaInstrumentationRecordCallSiteTest

Named differences​

  • Random-seed devices. Instrumentation sees the JDK opening /dev/urandom while seeding and allows exactly that; AspectJ never sees it. Both refuse a student who opens the device directly. The reason AspectJ cannot see the JDK's own calls is section 2 of the weaknesses page.
  • The JDK's own native libraries. Instrumentation sees the JDK ask for its own library by name, such as awt on a student's first BufferedImage, and allows exactly that at Runtime.loadLibrary0; AspectJ never sees it. Both refuse a load by name that student code, or test code beneath it, asks for. On a feature release other than 17, 21 and 25, instrumentation keeps the check at the public loadLibrary methods and refuses the JDK's own first loads too, see the execute operations.
  • A thread started through a method reference. Refused on instrumentation, missed by AspectJ; this is an AspectJ weakness outside the baseline, listed in section 3 of the weaknesses page.

Removed name-based exemptions​

Both backends dropped two exemptions that once matched a file by its name alone:

  • the JDK's cryptography policy file names (default_local.policy and the like): genuine cryptography reads them under java.home;
  • six Ares file names (messages.properties, EssentialClasses.yaml and others), matched by their ending for every action. Ares reads its own files itself, outside any student call. The re-entrancy guard skips file access made while a check runs.

The parity test has denied rows for a default_local.policy outside java.home (read), a messages.properties (read, overwrite and delete) and an EssentialClasses.yaml (overwrite). PrecompileTest checks that a generated exercise's copy of the advice carries neither list.

Running the evidence​

mvn test -Dtest=BaselineExemptionParityTest,JavaInstrumentationRecordCallSiteTest
mvn test -Dtest='BaselineStandardAllowTest,BaselineStillDeniedTest,ThreadSystemAccessTest'
mvn test -Dtest='PrecompileTest,JceGeneratedExerciseTest'

The integration tests carry one method per mode combination (…MavenArchunitAspectJ, …MavenArchunitInstrumentation, …MavenWalaAspectJ, …MavenWalaInstrumentation).