guibibeau/Inkling-2-Mini-Systems-v5
Text Generation • 26B • Updated • 3
id stringlengths 28 34 | mode stringclasses 1
value | category stringclasses 13
values | lang stringclasses 3
values | difficulty stringclasses 2
values | title stringlengths 119 154 | prompt stringlengths 0 3.96k | files listlengths 3 3 | test_file stringclasses 3
values | starter_files_json stringlengths 2.81k 13.8k | solution_files_json stringlengths 3.26k 14.2k | tests stringlengths 2.51k 8.29k |
|---|---|---|---|---|---|---|---|---|---|---|---|
cyber_lh_001_jwt_rbac_python_v1 | cyber_lh | jwt_rbac | python | expert | Multi-Tenant JWT Auth + Key Rotation + Hierarchical RBAC Policy Engine (edge-case concurrency & partial-failure recovery) | Build a 3-file Python 3.14 stdlib-only `Multi-Tenant JWT Auth + Key Rotation + Hierarchical RBAC Policy Engine`. A realistic defensively-audited codebase exists but is subtly broken. Fix every root cause across all affected files so that 100% of the integration tests pass.
Scope (defensive only, no offensive tooling):... | [
"core.py",
"store.py",
"service.py"
] | test_integration.py | {"core.py": "\"\"\"Hierarchical RBAC policy engine: role graph, allow/deny resolution, matching.\"\"\"\n\nfrom __future__ import annotations\n\nimport threading\nfrom dataclasses import dataclass\nfrom typing import Dict, FrozenSet, Iterable, List, Optional, Set\n\n\nclass PolicyError(Exception):\n \"\"\"Raised when... | {"core.py": "\"\"\"Hierarchical RBAC policy engine: role graph, allow/deny resolution, matching.\"\"\"\n\nfrom __future__ import annotations\n\nimport threading\nfrom dataclasses import dataclass\nfrom typing import Dict, FrozenSet, Iterable, List, Optional, Set\n\n\nclass PolicyError(Exception):\n \"\"\"Raised when... | """Integration audit suite: tenant isolation, rotation atomicity, RBAC invariants."""
import threading
import unittest
import core
import service
import store
class Clock:
"""Deterministic, injectable clock."""
def __init__(self, start: float = 1000.0) -> None:
self.now = start
def __call__(se... |
cyber_lh_002_jwt_rbac_python_v2 | cyber_lh | jwt_rbac | python | hard | Multi-Tenant JWT Auth + Key Rotation + Hierarchical RBAC Policy Engine (boundary overflow, rollback atomicity & stale-state invariant) | Implement and defensively audit a 3-file Python 3.14 stdlib-only system for Multi-Tenant JWT Auth + Key Rotation + Hierarchical RBAC Policy Engine. Scope: boundary overflow in role-depth resolution, rollback atomicity during key rotation, and stale-cache invariant breaks after rotation.
Contract:
1. `core.py`, `store.... | [
"core.py",
"store.py",
"service.py"
] | test_integration.py | {"core.py": "\"\"\"Core JWT + hierarchical RBAC primitives (stdlib only).\"\"\"\nfrom __future__ import annotations\n\nimport base64\nimport hashlib\nimport hmac\nimport json\nimport time\n\nMAX_ROLE_DEPTH = 3\nDEFAULT_LEEWAY = 30\n\n\nclass TokenError(Exception):\n pass\n\n\nclass PolicyError(Exception):\n pass\... | {"core.py": "\"\"\"Core JWT + hierarchical RBAC primitives (stdlib only).\"\"\"\nfrom __future__ import annotations\n\nimport base64\nimport hashlib\nimport hmac\nimport json\nimport time\n\nMAX_ROLE_DEPTH = 3\nDEFAULT_LEEWAY = 30\n\n\nclass TokenError(Exception):\n pass\n\n\nclass PolicyError(Exception):\n pass\... | import unittest
import core
from service import AuthError, AuthService
from store import StoreError, TenantStore
NOW = 1_000_000.0
def roles_fixture() -> dict:
return {
"root": {"parent": None, "perms": {"read"}},
"mid": {"parent": "root", "perms": {"write"}},
"leaf": {"parent": "mid", "... |
cyber_lh_006_jwt_rbac_python_v6 | cyber_lh | jwt_rbac | python | hard | Multi-Tenant JWT Auth + Key Rotation + Hierarchical RBAC Policy Engine (nested transaction / multi-tenant isolation & strict error propagation) | You are given a 3-file defensive-security codebase (`core.py`, `store.py`, `service.py`) implementing a multi-tenant JWT auth layer, a rotating key ring, a hierarchical RBAC policy engine, and a tenant-isolated store with nested transactions. Import it cleanly, then find and fix the real cross-file defects:
* Cross-te... | [
"core.py",
"store.py",
"service.py"
] | test_integration.py | {"core.py": "\"\"\"Core JWT primitives, tenant-scoped key rotation, and hierarchical RBAC.\"\"\"\n\nfrom __future__ import annotations\n\nimport base64\nimport hashlib\nimport hmac\nimport json\nimport time\nfrom dataclasses import dataclass\n\n\nclass AuthError(Exception):\n \"\"\"Base class for authentication fail... | {"core.py": "\"\"\"Core JWT primitives, tenant-scoped key rotation, and hierarchical RBAC.\"\"\"\n\nfrom __future__ import annotations\n\nimport base64\nimport hashlib\nimport hmac\nimport json\nimport time\nfrom dataclasses import dataclass\n\n\nclass AuthError(Exception):\n \"\"\"Base class for authentication fail... | import json
import unittest
import core
import service
import store
class IntegrationTests(unittest.TestCase):
def setUp(self) -> None:
self.ring = core.KeyRing()
self.policy = core.PolicyEngine()
self.backing = store.Store()
self.svc = service.Service(self.ring, self.policy, self... |
cyber_lh_009_tlv_proto_cpp_v1 | cyber_lh | tlv_proto | cpp | expert | Binary TLV Protocol Parser + Session Handshake + Replay Window Guard (edge-case concurrency & partial-failure recovery) | Implement a header-only C++20 defensive security component: a Binary TLV Protocol Parser (`core.hpp`), a tenant-scoped Session Store with an anti-replay sliding window (`store.hpp`), and a handshake/ingress `Service` (`service.hpp`).
Contract:
- All three headers use `#pragma once`; `test_integration.cpp` includes all... | [
"core.hpp",
"store.hpp",
"service.hpp"
] | test_integration.cpp | {"core.hpp": "#pragma once\n#include <cstdint>\n#include <cstddef>\n#include <vector>\n#include <string>\n\nnamespace proto {\n\nconstexpr size_t MAX_FIELDS = 256;\nconstexpr size_t HDR = 4; // type(1) + len(3 big-endian)\n\nstruct Field {\n uint8_t type{0};\n std::vector<uint8_t> value;\n};\n\nstruct ParseResult... | {"core.hpp": "#pragma once\n#include <cstdint>\n#include <cstddef>\n#include <vector>\n#include <string>\n\nnamespace proto {\n\nconstexpr size_t MAX_FIELDS = 256;\nconstexpr size_t HDR = 4; // type(1) + len(3 big-endian)\n\nstruct Field {\n uint8_t type{0};\n std::vector<uint8_t> value;\n};\n\nstruct ParseResult... | #include "core.hpp"
#include "store.hpp"
#include "service.hpp"
#include <cstdio>
#include <vector>
#include <string>
#include <thread>
#include <atomic>
#include <cstdint>
static int g_pass = 0;
static int g_fail = 0;
#define CHECK(cond) do { if (!(cond)) { std::printf(" assert failed: %s (line %d)\n", #cond, __L... |
cyber_lh_010_tlv_proto_node_v2 | cyber_lh | tlv_proto | node | hard | Binary TLV Protocol Parser + Session Handshake + Replay Window Guard (boundary overflow, rollback atomicity & stale-state invariant) | ID: cyber_lh_010_tlv_proto_node_v2
Title: Binary TLV Protocol Parser + Session Handshake + Replay Window Guard
You are auditing a defensive, in-memory session/binary-protocol layer built with Node.js v24 ESM (stdlib only, `.mjs`). Files: `core.mjs` (TLV codec, HMAC, replay window), `store.mjs` (transactional session s... | [
"core.mjs",
"store.mjs",
"service.mjs"
] | test_integration.mjs | {"core.mjs": "import { createHmac, timingSafeEqual } from 'node:crypto';\n\nexport const WINDOW_SIZE = 64;\n\nexport function encodeTLV(type, value) {\n if (!(value instanceof Uint8Array)) value = Buffer.from(value);\n if (!Number.isInteger(type) || type < 0 || type > 255) {\n throw new RangeError('tlv type out of... | {"core.mjs": "import { createHmac, timingSafeEqual } from 'node:crypto';\n\nexport const WINDOW_SIZE = 64;\n\nexport function encodeTLV(type, value) {\n if (!(value instanceof Uint8Array)) value = Buffer.from(value);\n if (!Number.isInteger(type) || type < 0 || type > 255) {\n throw new RangeError('tlv type out of... | import { test } from 'node:test';
import assert from 'node:assert/strict';
import { encodeTLV, parseTLV, macOver, touchWindow } from './core.mjs';
import { SessionStore } from './store.mjs';
import { SessionService } from './service.mjs';
test('encode/parse round-trip', () => {
const wire = encodeTLV(9, Buffer.from(... |
cyber_lh_011_tlv_proto_python_v3 | cyber_lh | tlv_proto | python | expert | Binary TLV Protocol Parser + Session Handshake + Replay Window Guard (multi-step state transition, ordering & resource exhaustion bounds) | Implement a 3-file defensive audit benchmark: `core.py` (binary TLV framing + HMAC helpers), `store.py` (session store + sliding replay window), `service.py` (handshake state machine + connection dispatcher). The starter code compiles and imports cleanly but must fail at least 3 integration tests due to cross-file bugs... | [
"core.py",
"store.py",
"service.py"
] | test_integration.py | {"core.py": "\"\"\"Binary TLV framing and HMAC helpers (defensive parser).\"\"\"\n\nimport hashlib\nimport hmac\nimport secrets\n\nMSG_HELLO = 1\nMSG_CHALLENGE = 2\nMSG_AUTH = 3\nMSG_OK = 4\nMSG_RECORD = 5\nMSG_ERR = 6\n\nHEADER_LEN = 3\nMAX_LEN = 0xFFFF\n\n\nclass TLVError(Exception):\n \"\"\"Raised on malformed TL... | {"core.py": "\"\"\"Binary TLV framing and HMAC helpers (defensive parser).\"\"\"\n\nimport hashlib\nimport hmac\nimport secrets\n\nMSG_HELLO = 1\nMSG_CHALLENGE = 2\nMSG_AUTH = 3\nMSG_OK = 4\nMSG_RECORD = 5\nMSG_ERR = 6\n\nHEADER_LEN = 3\nMAX_LEN = 0xFFFF\n\n\nclass TLVError(Exception):\n \"\"\"Raised on malformed TL... | import unittest
import core
import service
from store import ReplayWindow, SessionStore
TENANT_A = b"a" * 16
TENANT_B = b"b" * 16
LONG_TENANT = b"x" * 2048
SECRETS = {
TENANT_A: b"seca" * 8,
TENANT_B: b"secb" * 8,
LONG_TENANT: b"secL" * 8,
}
class TestTLV(unittest.TestCase):
def test_encode_decode_r... |
cyber_lh_012_tlv_proto_python_v4 | cyber_lh | tlv_proto | python | hard | Binary TLV Protocol Parser + Session Handshake + Replay Window Guard (cross-module contract mismatch, canonicalization & strict validation) | Implement and audit a small 3-file Python 3.14 stdlib-only defensive security service: a Binary TLV protocol with a handshake, an HMAC-authenticated message path, and a sliding-window replay guard. Focus on cross-module contract mismatches, canonicalization, and strict validation. Fix the starter so every test passes. | [
"core.py",
"store.py",
"service.py"
] | test_integration.py | {"core.py": "\"\"\"Length-prefixed TLV frame codec (magic, count, 3-byte TLVs).\"\"\"\nimport struct\nfrom typing import Dict\n\nMAGIC = b\"TLV1\"\nHEADER = struct.Struct(\">4sH\")\nTLV_HDR = struct.Struct(\">BH\")\n\nT_HELLO = 0x01\nT_NONCE = 0x02\nT_SUITE = 0x03\nT_SEQ = 0x04\nT_BODY = 0x05\nT_MAC = 0x06\n\n\nclass T... | {"core.py": "\"\"\"Length-prefixed TLV frame codec (magic, count, 3-byte TLVs).\n\nCanonical rules:\n * ``dumps`` emits tags in ascending order (canonical form).\n * ``loads`` accepts any tag order, rejects duplicates and trailing bytes,\n and validates every declared length against the remaining buffer.\n\"\"\"\n... | import hashlib
import hmac
import unittest
import core
import service
import store
SECRET = b"\x42" * 32
NONCE = b"\x07" * 16
def _dump_raw(pairs):
out = bytearray(core.MAGIC)
out += len(pairs).to_bytes(2, "big")
for tag, val in pairs:
out += bytes([tag])
out += len(val).to_bytes(2, "big... |
cyber_lh_014_tlv_proto_cpp_v6 | cyber_lh | tlv_proto | cpp | hard | Binary TLV Protocol Parser + Session Handshake + Replay Window Guard (nested transaction / multi-tenant isolation & strict error propagation) | # cyber_lh_014_tlv_proto_cpp_v6
**Binary TLV Protocol Parser + Session Handshake + Replay Window Guard** (nested transaction / multi-tenant isolation & strict error propagation)
Defensive-scope C++20 header-only benchmark. No malware, no exploits — only invariants, memory safety, input validation and tenant isolation... | [
"core.hpp",
"store.hpp",
"service.hpp"
] | test_integration.cpp | {"core.hpp": "#pragma once\n\n#include <cstddef>\n#include <cstdint>\n#include <cstring>\n#include <optional>\n#include <span>\n#include <string>\n#include <string_view>\n#include <vector>\n\nnamespace tlv {\n\nenum class Err : uint8_t {\n Ok = 0,\n Truncated,\n BadType,\n BadLength,\n NoTx,\n Replay,... | {"core.hpp": "#pragma once\n\n#include <cstddef>\n#include <cstdint>\n#include <cstring>\n#include <optional>\n#include <span>\n#include <string>\n#include <string_view>\n#include <vector>\n\nnamespace tlv {\n\nenum class Err : uint8_t {\n Ok = 0,\n Truncated,\n BadType,\n BadLength,\n NoTx,\n Replay,... | #include "core.hpp"
#include "store.hpp"
#include "service.hpp"
#include <cstdint>
#include <cstdio>
#include <initializer_list>
#include <string>
#include <string_view>
#include <vector>
using namespace tlv;
static int g_pass = 0;
static int g_fail = 0;
#define CHECK(cond) ... |
cyber_lh_015_tlv_proto_node_v7 | cyber_lh | tlv_proto | node | expert | "Binary TLV Protocol Parser + Session Handshake + Replay Window Guard (streaming chunk boundaries, p(...TRUNCATED) | "Build a defensive Security Audit benchmark for a Node.js v24 ESM (stdlib-only) 3-file node architec(...TRUNCATED) | [
"core.mjs",
"store.mjs",
"service.mjs"
] | test_integration.mjs | "{\"core.mjs\": \"export const HEADER_SIZE = 5;\\nexport const MAX_FRAME_BYTES = 16 * 1024 * 1024;\\(...TRUNCATED) | "{\"core.mjs\": \"export const HEADER_SIZE = 5;\\nexport const MAX_FRAME_BYTES = 16 * 1024 * 1024;\\(...TRUNCATED) | "import test from 'node:test';\nimport assert from 'node:assert/strict';\nimport { encodeFrame, HEAD(...TRUNCATED) |
cyber_lh_016_tlv_proto_python_v8 | cyber_lh | tlv_proto | python | hard | "Binary TLV Protocol Parser + Session Handshake + Replay Window Guard (version skew, schema/key rota(...TRUNCATED) | "Design and audit a 3-file defensive Python service implementing a binary TLV protocol, session hand(...TRUNCATED) | [
"core.py",
"store.py",
"service.py"
] | test_integration.py | "{\"core.py\": \"\\\"\\\"\\\"Defensive binary TLV parser, MAC, replay window primitives.\\\"\\\"\\\"(...TRUNCATED) | "{\"core.py\": \"\\\"\\\"\\\"Defensive binary TLV parser, MAC, replay window primitives.\\\"\\\"\\\"(...TRUNCATED) | "import unittest\n\nfrom core import (\n TLVError,\n SUPPORTED_VERSIONS,\n ReplayWindow,\n (...TRUNCATED) |
1955 tasks)
Every single problem passed double-sided execution verification:
starter compiles cleanly and MUST FAIL the deterministic test suite (or trigger AddressSanitizer / UndefinedBehaviorSanitizer in C++20).solution MUST PASS 100% of the exact same test suite with zero ASan/UBSan findings.| Config | Rows | Languages | Scope |
|---|---|---|---|
swe |
1078 train / 84 test |
Python 3.14, C++20 (ASan+UBSan), Node 24 | Concurrency, parsers, storage/SQL, distributed systems, memory/perf, multi-file patches |
defensive_cyber |
733 train / 60 test |
Python 3.14, C++20 (ASan+UBSan), Node 24 | Strictly defensive memory/parser/crypto/API/supply-chain hardening & remediation |
swe_3file_long_horizon & cyber_3file_long_horizon)
89 double-sided sandbox-verified 3-file cross-module SWE repos (64 train / 25 test) and 91 3-file multi-vulnerability defensive security audit repos (66 train / 25 test) across Python 3.14, C++20 (-fsanitize=address,undefined), and Node 24 ESM.