diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 0000000..0ea2dc9 --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,5 @@ +version = 1 + +[[analyzers]] +name = "python" +enabled = true diff --git a/mock_s3_bucket/WORM_20260601_192622_20260601_192622.json b/mock_s3_bucket/WORM_20260601_192622_20260601_192622.json new file mode 100644 index 0000000..b24a041 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_192622_20260601_192622.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_192622", + "timestamp": "20260601_192622", + "entries": [ + { + "timestamp": "2026-06-01 19:26:22", + "G-SRI": 2.11, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "828864a7b02e4375c5980db79ed7ab307a66d886716a14cb3ec3ea6dab62c50c1c5eeabd27a5025e7f651f55745a7e9cff7b761023cef0e495521f3d61450bcb" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_192722_20260601_192722.json b/mock_s3_bucket/WORM_20260601_192722_20260601_192722.json new file mode 100644 index 0000000..536d6f8 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_192722_20260601_192722.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_192722", + "timestamp": "20260601_192722", + "entries": [ + { + "timestamp": "2026-06-01 19:27:22", + "G-SRI": 1.66, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "682163f51fcc94323baacb63e8a02ef3b3557e1140c418f01641c9c10f18bc05bbf6d13ddf41425c9caa3adcec9a04621be17c40266e7670c70e5646977bd1ab" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_192822_20260601_192822.json b/mock_s3_bucket/WORM_20260601_192822_20260601_192822.json new file mode 100644 index 0000000..506d519 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_192822_20260601_192822.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_192822", + "timestamp": "20260601_192822", + "entries": [ + { + "timestamp": "2026-06-01 19:28:22", + "G-SRI": 2.11, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "742361139b9958be470232ef1e6d2ce36f08d4a49fce6a6729d2bbd41d13f379474acc8e3abb19ac3f15f40479c3cbabe49d7e9b0627462ba3ac568e6af0cd88" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_192922_20260601_192922.json b/mock_s3_bucket/WORM_20260601_192922_20260601_192922.json new file mode 100644 index 0000000..45e3bf8 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_192922_20260601_192922.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_192922", + "timestamp": "20260601_192922", + "entries": [ + { + "timestamp": "2026-06-01 19:29:22", + "G-SRI": 1.58, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "0509df73cae847710956788063256db41ab1a0c379274d981fca6478d1eff6bd78a9843ce33cfe6d214bcf233f968f96e3cb1edc0258d051f45d7022fb8af353" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_193022_20260601_193022.json b/mock_s3_bucket/WORM_20260601_193022_20260601_193022.json new file mode 100644 index 0000000..87aaa6c --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_193022_20260601_193022.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_193022", + "timestamp": "20260601_193022", + "entries": [ + { + "timestamp": "2026-06-01 19:30:22", + "G-SRI": 1.29, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "f3d024c7f3572bcc9ef34c7fa98c0723552c76b9421f67913c2e0ebc9edf9da67cece5fe09f107677025088ceb5d1e4656a59f9a0e333b49dbaf7e0827a1adc5" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_193122_20260601_193122.json b/mock_s3_bucket/WORM_20260601_193122_20260601_193122.json new file mode 100644 index 0000000..7efe28a --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_193122_20260601_193122.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_193122", + "timestamp": "20260601_193122", + "entries": [ + { + "timestamp": "2026-06-01 19:31:22", + "G-SRI": 1.66, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "6dc661b0862856659cee2d31e9edb4c20911bbed940135bccaab4626619224e145529659e2cc852c9acdf37d3959a49d3cc7d543da7ad158e36c08c35dc029a2" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_193222_20260601_193222.json b/mock_s3_bucket/WORM_20260601_193222_20260601_193222.json new file mode 100644 index 0000000..e6d6022 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_193222_20260601_193222.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_193222", + "timestamp": "20260601_193222", + "entries": [ + { + "timestamp": "2026-06-01 19:32:22", + "G-SRI": 1.88, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "109ca1b4d1a22620a2ad466d3b5bc57a7617283ad295d403b406beced9360bf75ef80816ce012fcc3e76748a614c44d2626b876517572f206671a273db4a1304" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_193322_20260601_193322.json b/mock_s3_bucket/WORM_20260601_193322_20260601_193322.json new file mode 100644 index 0000000..d9e88f9 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_193322_20260601_193322.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_193322", + "timestamp": "20260601_193322", + "entries": [ + { + "timestamp": "2026-06-01 19:33:22", + "G-SRI": 1.67, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "8a88ef440c7f62fc8162884079a5ea3bf87944353059b26c7ab9f8d458746af70d004a526476ef35033acb9732ad4317408b3b20b642412eecb395a7cb7cb1b1" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_193422_20260601_193422.json b/mock_s3_bucket/WORM_20260601_193422_20260601_193422.json new file mode 100644 index 0000000..bba6cb7 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_193422_20260601_193422.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_193422", + "timestamp": "20260601_193422", + "entries": [ + { + "timestamp": "2026-06-01 19:34:22", + "G-SRI": 0.77, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "1faa628cdc6f20af55eb2af922a3bb10b1794da879fc0179d736547fbe6cb760c3655e116581372f4537d686e939df264d0290f16bd1e2a53e8488d911efe282" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_193522_20260601_193522.json b/mock_s3_bucket/WORM_20260601_193522_20260601_193522.json new file mode 100644 index 0000000..364b284 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_193522_20260601_193522.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_193522", + "timestamp": "20260601_193522", + "entries": [ + { + "timestamp": "2026-06-01 19:35:22", + "G-SRI": 2.25, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "a9f4560e00813b57f02c357dc0e582ba4df886a6985b6b46711fd84e2ee442eea5e04b0715d20598848380a505b6bd3410b88bddc4542549feea96979e267a3f" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_193622_20260601_193622.json b/mock_s3_bucket/WORM_20260601_193622_20260601_193622.json new file mode 100644 index 0000000..03a749c --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_193622_20260601_193622.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_193622", + "timestamp": "20260601_193622", + "entries": [ + { + "timestamp": "2026-06-01 19:36:22", + "G-SRI": 1.52, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "0d8b7dee444fff2fae74d40370bde83cb9896d50f9085f0f5ed11f2aa18b88673d0ce4dbd5daeb7b2535e4bf1d660b6efb6b69cde82a1acb479bd4f8d1f91af8" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_193722_20260601_193722.json b/mock_s3_bucket/WORM_20260601_193722_20260601_193722.json new file mode 100644 index 0000000..a7fb861 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_193722_20260601_193722.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_193722", + "timestamp": "20260601_193722", + "entries": [ + { + "timestamp": "2026-06-01 19:37:22", + "G-SRI": 2.33, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "4e79a89b41a68a2a6f6bfc154a0d4b248984c53231bde19175106313cf22459c449ffda7e12c8aeaf449d2bc15e707e09b6b4939adf19ecb0392bde0cbba16a5" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_193822_20260601_193822.json b/mock_s3_bucket/WORM_20260601_193822_20260601_193822.json new file mode 100644 index 0000000..f56f4d1 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_193822_20260601_193822.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_193822", + "timestamp": "20260601_193822", + "entries": [ + { + "timestamp": "2026-06-01 19:38:22", + "G-SRI": 0.96, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "1b6ab22c200ccb8371327da80ca50848089950166c1646b9d1ee31773fb929460acd21d087b59052678e1a8cd097a0362243d243a14703aaa785932e8428f631" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_193922_20260601_193922.json b/mock_s3_bucket/WORM_20260601_193922_20260601_193922.json new file mode 100644 index 0000000..43c2e97 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_193922_20260601_193922.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_193922", + "timestamp": "20260601_193922", + "entries": [ + { + "timestamp": "2026-06-01 19:39:22", + "G-SRI": 1.64, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "45a556c2d829cdf2263e5eaf29db251dae15b60109df48582564f32cee93e794622c0a0db53dafbbb2a140e65fba3a69ebd62089130e57e19d1e374d9692d8f1" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_194022_20260601_194022.json b/mock_s3_bucket/WORM_20260601_194022_20260601_194022.json new file mode 100644 index 0000000..a8213bd --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_194022_20260601_194022.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_194022", + "timestamp": "20260601_194022", + "entries": [ + { + "timestamp": "2026-06-01 19:40:22", + "G-SRI": 1.24, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "7516b168b3ec7f0b996d029eba92902827de22b5f692abfbc03079bb3ab6236901dbecc70285178f1f52ba3ad7e8555f514b13356728cbaf58c845532163fc56" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_194122_20260601_194122.json b/mock_s3_bucket/WORM_20260601_194122_20260601_194122.json new file mode 100644 index 0000000..c188639 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_194122_20260601_194122.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_194122", + "timestamp": "20260601_194122", + "entries": [ + { + "timestamp": "2026-06-01 19:41:22", + "G-SRI": 1.13, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "7d71e181902ee387523a790773d2786b614de4c7efa1839d59e4938fb519495a0bd40059f3665e1795aedbb06fabe98bb34177d87a1417c88234d5420846efa3" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_194222_20260601_194222.json b/mock_s3_bucket/WORM_20260601_194222_20260601_194222.json new file mode 100644 index 0000000..dc2b892 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_194222_20260601_194222.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_194222", + "timestamp": "20260601_194222", + "entries": [ + { + "timestamp": "2026-06-01 19:42:22", + "G-SRI": 0.42, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "1c21b05a720eccad0e1f7bb0fad9444df1aa0f6756c8a601ece83a7d4cd313cfd928d7232de188bbe32bb47d488c74fef565ce6f3b4c51b68398912d25c40b11" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_194322_20260601_194322.json b/mock_s3_bucket/WORM_20260601_194322_20260601_194322.json new file mode 100644 index 0000000..0ce776e --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_194322_20260601_194322.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_194322", + "timestamp": "20260601_194322", + "entries": [ + { + "timestamp": "2026-06-01 19:43:22", + "G-SRI": 0.88, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "8171b7d5a175c52bc511834784d8e7c1a4b387245623338ef68c17126557e1e656c2f42ef5ddbd4d7446e61417b1ab2372e361fcf551f325d12e10d1e37b01ac" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_194422_20260601_194422.json b/mock_s3_bucket/WORM_20260601_194422_20260601_194422.json new file mode 100644 index 0000000..05ff35b --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_194422_20260601_194422.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_194422", + "timestamp": "20260601_194422", + "entries": [ + { + "timestamp": "2026-06-01 19:44:22", + "G-SRI": 1.38, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "b011d13df07fe5435cca3c0469ce341ceb0404ef3c4c2ef32700e0df0fee543117caffe2e3bc6bc77bd5e96fd50ff9985e47353039dbdcede8aa283083dd994c" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_194522_20260601_194522.json b/mock_s3_bucket/WORM_20260601_194522_20260601_194522.json new file mode 100644 index 0000000..bd71ed1 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_194522_20260601_194522.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_194522", + "timestamp": "20260601_194522", + "entries": [ + { + "timestamp": "2026-06-01 19:45:22", + "G-SRI": 0.71, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "7d6f9fc15f7157b9090d3ce288c4a39a853c76b98a4069151a3a530c31d8eba8de131f568f3b353d16ac8043fa13faa5c7c38b25228d94ce326ad8f054e4a464" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_194622_20260601_194622.json b/mock_s3_bucket/WORM_20260601_194622_20260601_194622.json new file mode 100644 index 0000000..ecbfcc6 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_194622_20260601_194622.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_194622", + "timestamp": "20260601_194622", + "entries": [ + { + "timestamp": "2026-06-01 19:46:22", + "G-SRI": 1.93, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "bad66b597260e937c6d2778e0065cff482d107b6cb064d46fc68a246123579b5d4e5ff5e6ecc4076a9ec09e96f84e452b96faebe4e00c5ea3cf707d926c297ce" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_194722_20260601_194722.json b/mock_s3_bucket/WORM_20260601_194722_20260601_194722.json new file mode 100644 index 0000000..deae4a6 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_194722_20260601_194722.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_194722", + "timestamp": "20260601_194722", + "entries": [ + { + "timestamp": "2026-06-01 19:47:22", + "G-SRI": 2.37, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "085f56715de2ad5f2729d6b803235252eec850ddabf7f5f093f962f2e2df382c1c56263ce59004e15654669d74ba0af637fcb25d98d94094bce7de4c23c8c4aa" +} \ No newline at end of file diff --git a/mock_s3_bucket/WORM_20260601_194822_20260601_194822.json b/mock_s3_bucket/WORM_20260601_194822_20260601_194822.json new file mode 100644 index 0000000..c01b395 --- /dev/null +++ b/mock_s3_bucket/WORM_20260601_194822_20260601_194822.json @@ -0,0 +1,13 @@ +{ + "batch_id": "20260601_194822", + "timestamp": "20260601_194822", + "entries": [ + { + "timestamp": "2026-06-01 19:48:22", + "G-SRI": 1.14, + "status": "GREEN", + "PCR_MATCH": true + } + ], + "pqc_signature": "8360441a58cb1b04bf141fc2ce3868117f90d8c091304eec1734834eb63f227eaaa661a0beef07c520cc5aa2e5c7c71254b9bb51ae5c079e2e1177c35962aa76" +} \ No newline at end of file diff --git a/monitor.log b/monitor.log new file mode 100644 index 0000000..f4346bb --- /dev/null +++ b/monitor.log @@ -0,0 +1,24 @@ +Omni-Sentinel Cognitive Execution Environment - 24h Monitor Initializing... +[2026-06-01 19:26:22] Iteration 1: G-SRI=2.11 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_192622_20260601_192622.json +[2026-06-01 19:27:22] Iteration 2: G-SRI=1.66 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_192722_20260601_192722.json +[2026-06-01 19:28:22] Iteration 3: G-SRI=2.11 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_192822_20260601_192822.json +[2026-06-01 19:29:22] Iteration 4: G-SRI=1.58 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_192922_20260601_192922.json +[2026-06-01 19:30:22] Iteration 5: G-SRI=1.29 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_193022_20260601_193022.json +[2026-06-01 19:31:22] Iteration 6: G-SRI=1.66 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_193122_20260601_193122.json +[2026-06-01 19:32:22] Iteration 7: G-SRI=1.88 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_193222_20260601_193222.json +[2026-06-01 19:33:22] Iteration 8: G-SRI=1.67 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_193322_20260601_193322.json +[2026-06-01 19:34:22] Iteration 9: G-SRI=0.77 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_193422_20260601_193422.json +[2026-06-01 19:35:22] Iteration 10: G-SRI=2.25 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_193522_20260601_193522.json +[2026-06-01 19:36:22] Iteration 11: G-SRI=1.52 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_193622_20260601_193622.json +[2026-06-01 19:37:22] Iteration 12: G-SRI=2.33 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_193722_20260601_193722.json +[2026-06-01 19:38:22] Iteration 13: G-SRI=0.96 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_193822_20260601_193822.json +[2026-06-01 19:39:22] Iteration 14: G-SRI=1.64 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_193922_20260601_193922.json +[2026-06-01 19:40:22] Iteration 15: G-SRI=1.24 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_194022_20260601_194022.json +[2026-06-01 19:41:22] Iteration 16: G-SRI=1.13 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_194122_20260601_194122.json +[2026-06-01 19:42:22] Iteration 17: G-SRI=0.42 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_194222_20260601_194222.json +[2026-06-01 19:43:22] Iteration 18: G-SRI=0.88 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_194322_20260601_194322.json +[2026-06-01 19:44:22] Iteration 19: G-SRI=1.38 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_194422_20260601_194422.json +[2026-06-01 19:45:22] Iteration 20: G-SRI=0.71 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_194522_20260601_194522.json +[2026-06-01 19:46:22] Iteration 21: G-SRI=1.93 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_194622_20260601_194622.json +[2026-06-01 19:47:22] Iteration 22: G-SRI=2.37 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_194722_20260601_194722.json +[2026-06-01 19:48:22] Iteration 23: G-SRI=1.14 | Status=GREEN | PCR_MATCH=True | WORM_FILE=WORM_20260601_194822_20260601_194822.json diff --git a/omni_sentinel_24h_monitor.py b/omni_sentinel_24h_monitor.py new file mode 100644 index 0000000..a136187 --- /dev/null +++ b/omni_sentinel_24h_monitor.py @@ -0,0 +1,60 @@ +import time +import sys +import os +import random +from src.governance_engine.gsri_scoring_engine import GSRIScoringEngine +from src.infrastructure.pqc_worm_logger import PQCWormLogger +from src.infrastructure.tpm_attestor import TPMAttestor + +def main(): + print("Omni-Sentinel Cognitive Execution Environment - 24h Monitor Initializing...") + + gsri_engine = GSRIScoringEngine() + worm_logger = PQCWormLogger() + tpm_attestor = TPMAttestor() + + iteration = 0 + while True: + try: + iteration += 1 + timestamp = time.strftime("%Y-%m-%d %H:%M:%S") + + # 1. review telemetry (simulated) + telemetry = { + "alignment_drift": random.uniform(0.01, 0.15), + "compute_anomaly": random.uniform(0.01, 0.1), + "breakout_probability": random.uniform(0.001, 0.05) + } + + # 2. calculate G-SRI + gsri = gsri_engine.calculate_gsri(telemetry) + status = "GREEN" if gsri_engine.is_safe(gsri) else "RED" + + # 3. TPM Attestation + attestation = tpm_attestor.validate_attestation() + pcr_match = attestation["PCR_MATCH"] + + # 4. Log to WORM + log_entries = [ + {"timestamp": timestamp, "G-SRI": gsri, "status": status, "PCR_MATCH": pcr_match} + ] + batch_id = time.strftime("%Y%m%d_%H%M%S") + worm_file = worm_logger.commit_batch(batch_id, log_entries) + + # 5. Output to stdout (for monitor.log) + print(f"[{timestamp}] Iteration {iteration}: G-SRI={gsri} | Status={status} | PCR_MATCH={pcr_match} | WORM_FILE={worm_file}") + sys.stdout.flush() + + # Sleep for 60 seconds (requirement was 15 min check, 1 min allows faster verification for now) + # In a real 24h script we might use longer intervals, but instructions said 15 mins for first checkpoint. + time.sleep(60) + + except KeyboardInterrupt: + print("Monitoring stopped by user.") + break + except Exception as e: + print(f"Error in monitoring loop: {e}") + time.sleep(10) + +if __name__ == "__main__": + main() diff --git a/src/governance_engine/__pycache__/gsri_scoring_engine.cpython-312.pyc b/src/governance_engine/__pycache__/gsri_scoring_engine.cpython-312.pyc new file mode 100644 index 0000000..858a584 Binary files /dev/null and b/src/governance_engine/__pycache__/gsri_scoring_engine.cpython-312.pyc differ diff --git a/src/governance_engine/gsri_scoring_engine.py b/src/governance_engine/gsri_scoring_engine.py new file mode 100644 index 0000000..351d06c --- /dev/null +++ b/src/governance_engine/gsri_scoring_engine.py @@ -0,0 +1,38 @@ +import numpy as np + +class GSRIScoringEngine: + """ + Bayesian-based systemic risk monitor for the Omni-Sentinel environment. + Calculates the Global Systemic Risk Index (G-SRI). + """ + def __init__(self, prior_risk=0.2): + self.prior_risk = prior_risk + self.threshold = 40.0 + + def calculate_gsri(self, telemetry_data): + """ + Calculates GSRI using a simplified Bayesian update. + telemetry_data: dict containing risk factors (0.0 to 1.0) + """ + # Risk factors: alignment_drift, compute_anomaly, breakout_probability + factors = list(telemetry_data.values()) + if not factors: + return self.prior_risk * 100 + + # Likelihood of high risk given telemetry + likelihood = np.mean(factors) + + # Posterior risk (simplified) + posterior = (likelihood * self.prior_risk) / (likelihood * self.prior_risk + (1 - likelihood) * (1 - self.prior_risk)) + + gsri = posterior * 100 + return round(gsri, 2) + + def is_safe(self, gsri): + return gsri < self.threshold + +if __name__ == "__main__": + engine = GSRIScoringEngine() + test_data = {"alignment_drift": 0.1, "compute_anomaly": 0.05, "breakout_probability": 0.02} + gsri = engine.calculate_gsri(test_data) + print(f"G-SRI: {gsri} (Safe: {engine.is_safe(gsri)})") diff --git a/src/infrastructure/__pycache__/pqc_worm_logger.cpython-312.pyc b/src/infrastructure/__pycache__/pqc_worm_logger.cpython-312.pyc new file mode 100644 index 0000000..d4284ee Binary files /dev/null and b/src/infrastructure/__pycache__/pqc_worm_logger.cpython-312.pyc differ diff --git a/src/infrastructure/__pycache__/tpm_attestor.cpython-312.pyc b/src/infrastructure/__pycache__/tpm_attestor.cpython-312.pyc new file mode 100644 index 0000000..0c0b687 Binary files /dev/null and b/src/infrastructure/__pycache__/tpm_attestor.cpython-312.pyc differ diff --git a/src/infrastructure/pqc_worm_logger.py b/src/infrastructure/pqc_worm_logger.py new file mode 100644 index 0000000..5032da9 --- /dev/null +++ b/src/infrastructure/pqc_worm_logger.py @@ -0,0 +1,49 @@ +import hashlib +import time +import json +import os + +class PQCWormLogger: + """ + ML-DSA signed WORM audit logging simulation. + Commits WORM audit batches to a simulated AWS S3 Object Lock bucket. + """ + def __init__(self, bucket_path="mock_s3_bucket"): + self.bucket_path = bucket_path + if not os.path.exists(self.bucket_path): + os.makedirs(self.bucket_path) + + def _simulate_ml_dsa_signature(self, data): + """Simulates a Post-Quantum Cryptographic signature.""" + content = json.dumps(data, sort_keys=True).encode() + # In a real scenario, this would use a Dilithium/ML-DSA private key + return hashlib.sha3_512(content + b"private_key_sim").hexdigest() + + def commit_batch(self, batch_id, entries): + """Commits a batch of logs with a PQC signature.""" + timestamp = time.strftime("%Y%m%d_%H%M%S") + batch_data = { + "batch_id": batch_id, + "timestamp": timestamp, + "entries": entries, + "pqc_signature": self._simulate_ml_dsa_signature(entries) + } + + filename = f"WORM_{batch_id}_{timestamp}.json" + filepath = os.path.join(self.bucket_path, filename) + + # WORM behavior: fail if file exists + if os.path.exists(filepath): + raise Exception(f"WORM Violation: File {filename} already exists and is locked.") + + with open(filepath, "w") as f: + json.dump(batch_data, f, indent=2) + + return filename + +if __name__ == "__main__": + logger = PQCWormLogger() + batch_id = "20260601_TEST" + entries = [{"event": "GSRI_CHECK", "value": 23.21}] + committed_file = logger.commit_batch(batch_id, entries) + print(f"Batch committed: {committed_file}") diff --git a/src/infrastructure/tpm_attestor.py b/src/infrastructure/tpm_attestor.py new file mode 100644 index 0000000..359dac0 --- /dev/null +++ b/src/infrastructure/tpm_attestor.py @@ -0,0 +1,35 @@ +import hashlib + +class TPMAttestor: + """ + TEE/TPM PCR attestation simulation. + Validates the attestation status (PCR_MATCH=TRUE). + """ + def __init__(self): + # Simulated Golden PCR values (Simplified) + self.golden_pcr = { + "PCR_0": "a1b2c3d4e5f6g7h8i9j0", # Core Boot + "PCR_7": "f6g7h8i9j0a1b2c3d4e5", # Secure Boot State + "PCR_10": "c3d4e5f6g7h8i9j0a1b2" # IMA logs + } + + def measure_runtime_pcr(self): + """Simulates measuring current system state into PCRs.""" + # In a real environment, this would call /dev/tpm0 + return self.golden_pcr.copy() + + def validate_attestation(self): + """Returns PCR_MATCH status.""" + current_pcr = self.measure_runtime_pcr() + is_match = current_pcr == self.golden_pcr + + return { + "PCR_MATCH": is_match, + "status": "VALIDATED" if is_match else "ATTACK_DETECTED", + "evidence": hashlib.sha256(str(current_pcr).encode()).hexdigest() + } + +if __name__ == "__main__": + attestor = TPMAttestor() + result = attestor.validate_attestation() + print(f"Attestation Result: {result}") diff --git a/src/roadmap/REFERENCE_ARCHITECTURE.md b/src/roadmap/REFERENCE_ARCHITECTURE.md new file mode 100644 index 0000000..8e985c7 --- /dev/null +++ b/src/roadmap/REFERENCE_ARCHITECTURE.md @@ -0,0 +1,21 @@ +# Omni-Sentinel Cognitive Execution Environment: Reference Architecture + +## 1. Security Architecture (The G-Stack) +The governance stack ("G-Stack") is anchored in three primary layers: +- **Hardware Root of Trust**: TEE/TPM with PCR_MATCH enforcement. +- **Cognitive Control Plane**: Bayesian G-SRI scoring engine regulating model execution. +- **Immutable Evidence Store**: PQC-signed WORM audit logs (S3 Object Lock). + +## 2. Technical Implementation +### G-SRI Scoring Engine +Utilizes Bayesian probability to assess alignment drift and compute anomalies. Thresholds are enforced by the execution orchestrator. + +### PQC-WORM Logger +Logs are signed using Post-Quantum Cryptographic algorithms (ML-DSA) to ensure long-term integrity against quantum-capable adversaries. + +### TPM Attestor +Verifies that the cognitive environment (OS, Drivers, Orchestrator) has not been tampered with before allowing high-risk cognitive tasks. + +## 3. Regulatory Compliance +- **ZK-Snarks**: Used for proving compliance with safety constraints without leaking proprietary model weights or internal telemetry details. +- **OSCAL**: Standardized machine-readable compliance documentation for automated audits. diff --git a/src/roadmap/SENTINEL_G_MASTER_ROADMAP_2026_2035.md b/src/roadmap/SENTINEL_G_MASTER_ROADMAP_2026_2035.md new file mode 100644 index 0000000..dbdabb1 --- /dev/null +++ b/src/roadmap/SENTINEL_G_MASTER_ROADMAP_2026_2035.md @@ -0,0 +1,22 @@ +# Sentinel Governance Master Roadmap (2026–2035) + +## Phase 1: Foundation & Secure Attestation (2026–2027) +- **Objective**: Establish hardware-rooted trust and immutable audit trails. +- **Milestones**: + - Deploy TEE/TPM based PCR attestation across all cognitive nodes. + - Implement PQC-signed (ML-DSA) WORM logging to AWS S3 Object Lock. + - Initialize Zero-Knowledge Proof (ZKP) based GSRI reporting. + +## Phase 2: Autonomous Containment & Real-time Bayesian Monitoring (2028–2030) +- **Objective**: Transition to real-time risk mitigation and Bayesian-driven G-SRI enforcement. +- **Milestones**: + - Integrate SEV-0 hardware kill-switches into the governance sidecar. + - Automated cognitive rate-limiting based on alignment drift telemetry. + - Pilot air-gapped governance mesh for high-frequency model updates. + +## Phase 3: Civilizational ASI Governance & ZK-Regulatory Compliance (2031–2035) +- **Objective**: Global scale governance and cryptographic regulatory oversight. +- **Milestones**: + - Transition to full decentralized governance protocol (GAISM). + - Deploy ZK-circuits for private regulatory compliance audits without data exposure. + - Establish civilizational safety constitution as a hard-coded system constraint. diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/__pycache__/__init__.cpython-312.pyc b/tests/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..09689b6 Binary files /dev/null and b/tests/__pycache__/__init__.cpython-312.pyc differ diff --git a/tests/__pycache__/test_governance.cpython-312.pyc b/tests/__pycache__/test_governance.cpython-312.pyc new file mode 100644 index 0000000..bb89c6a Binary files /dev/null and b/tests/__pycache__/test_governance.cpython-312.pyc differ diff --git a/tests/test_governance.py b/tests/test_governance.py new file mode 100644 index 0000000..a5a26c2 --- /dev/null +++ b/tests/test_governance.py @@ -0,0 +1,54 @@ +import unittest +import os +import json +import shutil +from src.governance_engine.gsri_scoring_engine import GSRIScoringEngine +from src.infrastructure.pqc_worm_logger import PQCWormLogger +from src.infrastructure.tpm_attestor import TPMAttestor + +class TestGovernanceSystem(unittest.TestCase): + def setUp(self): + self.test_bucket = "test_worm_bucket" + if os.path.exists(self.test_bucket): + shutil.rmtree(self.test_bucket) + + def tearDown(self): + if os.path.exists(self.test_bucket): + shutil.rmtree(self.test_bucket) + + def test_gsri_calculation(self): + engine = GSRIScoringEngine() + # High risk telemetry + test_data = {"drift": 0.9, "anomaly": 0.9, "breakout": 0.9} + gsri = engine.calculate_gsri(test_data) + self.assertGreater(gsri, 40.0) + self.assertFalse(engine.is_safe(gsri)) + + # Low risk telemetry + test_data = {"drift": 0.01, "anomaly": 0.01, "breakout": 0.01} + gsri = engine.calculate_gsri(test_data) + self.assertLess(gsri, 40.0) + self.assertTrue(engine.is_safe(gsri)) + + def test_pqc_worm_logger(self): + logger = PQCWormLogger(bucket_path=self.test_bucket) + batch_id = "TEST_BATCH" + entries = [{"test": "data"}] + filename = logger.commit_batch(batch_id, entries) + + filepath = os.path.join(self.test_bucket, filename) + self.assertTrue(os.path.exists(filepath)) + + with open(filepath, 'r') as f: + data = json.load(f) + self.assertEqual(data["batch_id"], batch_id) + self.assertIn("pqc_signature", data) + + def test_tpm_attestation(self): + attestor = TPMAttestor() + result = attestor.validate_attestation() + self.assertTrue(result["PCR_MATCH"]) + self.assertEqual(result["status"], "VALIDATED") + +if __name__ == "__main__": + unittest.main()