Update inputs: computing_math/os_log_permission_guard_v1/base
Browse files- tasks/computing_math/os_log_permission_guard_v1/base/input/active_writers.json +5 -0
- tasks/computing_math/os_log_permission_guard_v1/base/input/environment_notes.md +8 -0
- tasks/computing_math/os_log_permission_guard_v1/base/input/fs_snapshot.tar.gz +3 -0
- tasks/computing_math/os_log_permission_guard_v1/base/input/ownership.csv +7 -0
- tasks/computing_math/os_log_permission_guard_v1/base/input/permissions.csv +7 -0
- tasks/computing_math/os_log_permission_guard_v1/base/input/setup_workspace.sh +28 -0
- tasks/computing_math/os_log_permission_guard_v1/base/input/task_instructions.md +50 -0
tasks/computing_math/os_log_permission_guard_v1/base/input/active_writers.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"active_writers": [
|
| 3 |
+
"/var/logs/worker.log"
|
| 4 |
+
]
|
| 5 |
+
}
|
tasks/computing_math/os_log_permission_guard_v1/base/input/environment_notes.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Environment Notes
|
| 2 |
+
|
| 3 |
+
- Treat `syslog` as the protected system user.
|
| 4 |
+
- Ownership truth comes from `ownership.csv`.
|
| 5 |
+
- Initial permission truth comes from `permissions.csv`.
|
| 6 |
+
- Files listed in `active_writers.json` must not be modified.
|
| 7 |
+
- Evaluation is based on the final metadata/file state inside the reconstructed workspace rather than real kernel-level ownership or process tables.
|
| 8 |
+
- The intended target workspace after running `setup.sh` is `./sandbox_fs`.
|
tasks/computing_math/os_log_permission_guard_v1/base/input/fs_snapshot.tar.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a9b85d99cfd8c9b0b35e0ba2ba67d2a6d194a16b6a578d758d39c11611296db4
|
| 3 |
+
size 676
|
tasks/computing_math/os_log_permission_guard_v1/base/input/ownership.csv
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
path,owner,group
|
| 2 |
+
/var/logs/app.log,appuser,app
|
| 3 |
+
/var/logs/worker.log,appuser,app
|
| 4 |
+
/var/logs/audit.log,auditor,audit
|
| 5 |
+
/var/logs/sys.log,syslog,syslog
|
| 6 |
+
/var/logs/metrics.log,monitor,ops
|
| 7 |
+
/var/logs/notes.txt,appuser,app
|
tasks/computing_math/os_log_permission_guard_v1/base/input/permissions.csv
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
path,mode
|
| 2 |
+
/var/logs/app.log,640
|
| 3 |
+
/var/logs/worker.log,644
|
| 4 |
+
/var/logs/audit.log,600
|
| 5 |
+
/var/logs/sys.log,640
|
| 6 |
+
/var/logs/metrics.log,644
|
| 7 |
+
/var/logs/notes.txt,644
|
tasks/computing_math/os_log_permission_guard_v1/base/input/setup_workspace.sh
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
if [[ $# -ne 1 ]]; then
|
| 5 |
+
echo "Usage: $0 OUTPUT_DIR" >&2
|
| 6 |
+
exit 2
|
| 7 |
+
fi
|
| 8 |
+
|
| 9 |
+
INPUT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
| 10 |
+
OUTPUT_DIR="$(mkdir -p "$1" && cd "$1" && pwd)"
|
| 11 |
+
SANDBOX="${OUTPUT_DIR}/sandbox_fs"
|
| 12 |
+
|
| 13 |
+
rm -rf "${SANDBOX}"
|
| 14 |
+
mkdir -p "${SANDBOX}"
|
| 15 |
+
tar -xzf "${INPUT_DIR}/fs_snapshot.tar.gz" -C "${SANDBOX}"
|
| 16 |
+
|
| 17 |
+
while IFS=, read -r path mode; do
|
| 18 |
+
[[ "${path}" == "path" ]] && continue
|
| 19 |
+
path="${path%$'
|
| 20 |
+
mode="${mode%$'
|
| 21 |
+
chmod "${mode}" "${SANDBOX}${path}"
|
| 22 |
+
done < "${INPUT_DIR}/permissions.csv"
|
| 23 |
+
|
| 24 |
+
cp "${INPUT_DIR}/ownership.csv" "${OUTPUT_DIR}/ownership.csv"
|
| 25 |
+
cp "${INPUT_DIR}/permissions.csv" "${OUTPUT_DIR}/permissions.csv"
|
| 26 |
+
cp "${INPUT_DIR}/active_writers.json" "${OUTPUT_DIR}/active_writers.json"
|
| 27 |
+
|
| 28 |
+
echo "Workspace ready at ${SANDBOX}"
|
tasks/computing_math/os_log_permission_guard_v1/base/input/task_instructions.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OS Log Permission Guard v1
|
| 2 |
+
|
| 3 |
+
You are working on a Linux VM. Use the prepared metadata and filesystem snapshot
|
| 4 |
+
to update log-file permissions safely.
|
| 5 |
+
|
| 6 |
+
## Inputs
|
| 7 |
+
|
| 8 |
+
- `fs_snapshot.tar.gz` contains the sandbox filesystem with `/var/logs` files.
|
| 9 |
+
- `ownership.csv` is the ownership source of truth.
|
| 10 |
+
- `permissions.csv` is the initial permission source of truth.
|
| 11 |
+
- `active_writers.json` lists files that are treated as actively written and must not be modified.
|
| 12 |
+
- `setup_workspace.sh` reconstructs a writable sandbox under the output directory.
|
| 13 |
+
|
| 14 |
+
The active-writer list is declarative for this benchmark. Do not try to kill or
|
| 15 |
+
interfere with processes.
|
| 16 |
+
|
| 17 |
+
## Required Work
|
| 18 |
+
|
| 19 |
+
1. Run `input/setup_workspace.sh output` from the task root, or otherwise create
|
| 20 |
+
an equivalent workspace at `output/sandbox_fs`.
|
| 21 |
+
2. Change every regular `.log` file under `output/sandbox_fs/var/logs` to mode
|
| 22 |
+
`444`, except:
|
| 23 |
+
- files owned by `syslog` according to `ownership.csv`;
|
| 24 |
+
- files listed in `active_writers.json`.
|
| 25 |
+
3. Do not modify non-`.log` files.
|
| 26 |
+
4. Do not change file contents.
|
| 27 |
+
5. Do not change the ownership/group metadata reported in your final state.
|
| 28 |
+
6. Write `output/final_state.json` with one entry for every file listed in
|
| 29 |
+
`ownership.csv`.
|
| 30 |
+
|
| 31 |
+
## final_state.json Format
|
| 32 |
+
|
| 33 |
+
Use either a list or mapping under the top-level key `files`. Each file entry
|
| 34 |
+
must include `path`, `type`, `owner`, `group`, and `mode`.
|
| 35 |
+
|
| 36 |
+
Example list form:
|
| 37 |
+
|
| 38 |
+
```json
|
| 39 |
+
{
|
| 40 |
+
"files": [
|
| 41 |
+
{
|
| 42 |
+
"path": "/var/logs/example.log",
|
| 43 |
+
"type": "regular",
|
| 44 |
+
"owner": "exampleuser",
|
| 45 |
+
"group": "example",
|
| 46 |
+
"mode": "444"
|
| 47 |
+
}
|
| 48 |
+
]
|
| 49 |
+
}
|
| 50 |
+
```
|