THINK FIRST·CODE LATER

← All labs

Multilevel security: Bell–LaPadula and Biba

Problem

Input: the model (BLP or BIBA), the number of levels and their names from lowest to highest, then lines subject NAME LEVEL, object NAME LEVEL, and requests SUBJECT read|write OBJECT.

Rules:

  • BLP (confidentiality): read allowed iff level(subject) ≥ level(object) ("no read up"); write allowed iff level(subject) ≤ level(object) ("no write down").
  • BIBA (integrity): read allowed iff level(subject) ≤ level(object) ("no read down"); write allowed iff level(subject) ≥ level(object) ("no write up").

Print analyst (Confidential) read exams (Secret): DENIED by no read up or … ALLOWED, and finally BLP: a of n requests allowed.

Data for this lab

Your program reads its data from standard input. Download the file, then give it to your program as shown below. Start with data set 1: its expected output is given.

os14-4-data-1.txt

BLP 3
Public Confidential Secret
subject intern Public
subject analyst Confidential
subject director Secret
object brochure Public
object grades Confidential
object exams Secret
analyst read brochure
analyst read exams
analyst write brochure
analyst write exams
director read grades
intern write grades
What your program must print for os14-4-data-1.txt
analyst (Confidential) read brochure (Public): ALLOWED
analyst (Confidential) read exams (Secret): DENIED by no read up
analyst (Confidential) write brochure (Public): DENIED by no write down
analyst (Confidential) write exams (Secret): ALLOWED
director (Secret) read grades (Confidential): ALLOWED
intern (Public) write grades (Confidential): ALLOWED
BLP: 4 of 6 requests allowed

Run your program first, then open this and compare line by line: your output must contain these lines exactly.

How to give the file to my program

Terminal (macOS, Linux, or Windows Command Prompt), after compiling:

java Main < os14-4-data-1.txt

Windows PowerShell does not understand <:

Get-Content os14-4-data-1.txt | java Main

IntelliJ IDEA: Run → Edit Configurations → Redirect input from. Or simply paste the content of the file into the console when the program waits for input.

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.