Skip to content

Complete native security engines and scoped policy enforcement - #5

Merged
senamakel merged 87 commits into
mainfrom
security-complete-7328
Oct 11, 2026
Merged

senamakel merged 87 commits into
mainfrom
security-complete-7328

Conversation

@senamakel

@senamakel senamakel commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Implements the remaining native TinySecurity engines for tinyhumansai/openhuman#7328 and TinySecurity #1, following the merged immutable path scopes in #4. OpenHuman integration remains in tinyhumansai/openhuman#7331.

Implemented and independently reviewed:

  • Immutable command policies, POSIX/PowerShell/cmd parsing, unconditional credential protections, distinct harness-gated and allowlisted execution rules, and atomic raw-command hourly accounting. Full scoped tool rules and parked/resumed reservation deduplication remain part of the pending policy composition.

  • One native redaction registry with init-only literal credentials, explicit legacy and structured/endpoint modes, bounded secret/PII handling, and real prompt/tool-definition scanning integrated into conservative policy decisions. Regressions cover primitive JSON credentials, normalized URL and key collisions, retained endpoint tokens, and credential-transfer instructions. Scanner findings never grant authorization.

  • Native scoped URL/privacy decisions with DNS candidate validation, stricter Sensitive inspection, request-bound expiring one-time transport authorizations, and real HTTP/TLS pinning fixtures. Consuming these authorizations in production transport owners remains pending; fixtures demonstrate the contract rather than claim current OpenHuman rebinding protection.

This is the single cumulative owner PR. It remains a draft while final audit integration tests, scoped policy composition, durable approvals, auto-approval/Jev, sandbox planning, and crypto/keyring/pairing are completed and reviewed. Authenticated incoming TinyBus context is implemented in tinyhumansai/tinybus#46; that prerequisite remains independently reviewable. It must not merge until the full implementation and platform checks pass. The description will be rewritten around the final change before marking ready.

At egress checkpoint 87d909f, all local gates pass: formatting, strict all-target/all-feature Clippy, default and all-feature tests, all-target builds, MSRV 1.88, warning-denying rustdoc, dependency checks, per-source-file coverage above 90%, and actual Linux native module loading/dispatch from two working directories. Hosted Linux, macOS and Windows native CI, MSRV, docs and supply-chain checks also pass (runs 38089097165 and 38089100777). Later engines and the final cumulative revision require fresh checks.

Audit checkpoint 94b0d31 implements authenticated native ingress, exact V2 receipts, required versus optional failure handling, original-request-bound audited permission calls, and bounded journal sinks. Unix uses descriptor-relative protected files. Windows requires a preprovisioned protected NTFS namespace and journal; actual-handle ACL checks and retained share-enforced directory handles reject unsafe ancestors and replacement. Views are reconstructable; the synced journal determines commitment and exact retry. Capacity limits fail closed, and an indeterminate timeout never claims rollback.

The exact 94b0d31 native matrix passes Linux, macOS and Windows (run 38097091889). Windows executes 11 focused ACL/path/rotation/recovery tests and three subprocess lock/crash/retry tests. Required directory pinning has genuine native RED-to-GREEN evidence, as do protected inheritance flags and rotation denial. These tests prove process recovery; they do not claim power-loss namespace guarantees. Later loaded-module real-sink permission and ordinary-account checks are still being completed and require their own exact-head CI. The previous lint and coverage failures are resolved; final cumulative gates and independent audit review remain required before readiness.

senamakel and others added 2 commits October 10, 2026 22:55
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 144 billable files and costs up to $36.00.

View limit details

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 15494cc6-7052-41a5-8e81-fea60d79d767

📥 Commits

Reviewing files that changed from the base of the PR and between b6394ad and 03d5e36.


⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock

📒 Files selected for processing (144)
  • .github/scripts/check-native-coverage.py
  • .github/scripts/check-native-coverage_tests.py
  • .github/workflows/ci.yml
  • .gitmodules
  • Cargo.toml
  • MODULE.md
  • README.md
  • crates/tinysecurity-approval/Cargo.toml
  • crates/tinysecurity-approval/README.md
  • crates/tinysecurity-approval/src/automatic_tests.rs
  • crates/tinysecurity-approval/src/binding.rs
  • crates/tinysecurity-approval/src/engine.rs
  • crates/tinysecurity-approval/src/engine_tests.rs
  • crates/tinysecurity-approval/src/error/mod.rs
  • crates/tinysecurity-approval/src/lib.rs
  • crates/tinysecurity-approval/src/reply.rs
  • crates/tinysecurity-approval/src/reply_tests.rs
  • crates/tinysecurity-audit/Cargo.toml
  • crates/tinysecurity-audit/README.md
  • crates/tinysecurity-audit/fixtures/audit_process.rs
  • crates/tinysecurity-audit/src/error/mod.rs
  • crates/tinysecurity-audit/src/event.rs
  • crates/tinysecurity-audit/src/event_tests.rs
  • crates/tinysecurity-audit/src/journal.rs
  • crates/tinysecurity-audit/src/journal_tests.rs
  • crates/tinysecurity-audit/src/lib.rs
  • crates/tinysecurity-audit/src/rotation.rs
  • crates/tinysecurity-audit/src/sink.rs
  • crates/tinysecurity-audit/src/sink_tests.rs
  • crates/tinysecurity-audit/src/sink_windows_negative_tests.rs
  • crates/tinysecurity-audit/src/sink_windows_tests.rs
  • crates/tinysecurity-audit/src/windows.rs
  • crates/tinysecurity-audit/src/windows_acl.rs
  • crates/tinysecurity-audit/src/windows_acl_tests.rs
  • crates/tinysecurity-audit/src/windows_tests.rs
  • crates/tinysecurity-audit/tests/process_contract.rs
  • crates/tinysecurity-audit/tests/support/windows_namespace.rs
  • crates/tinysecurity-auto/Cargo.toml
  • crates/tinysecurity-auto/README.md
  • crates/tinysecurity-auto/src/budget.rs
  • crates/tinysecurity-auto/src/budget_tests.rs
  • crates/tinysecurity-auto/src/cache.rs
  • crates/tinysecurity-auto/src/cache_tests.rs
  • crates/tinysecurity-auto/src/error/mod.rs
  • crates/tinysecurity-auto/src/judge.rs
  • crates/tinysecurity-auto/src/judge_tests.rs
  • crates/tinysecurity-auto/src/lib.rs
  • crates/tinysecurity-auto/src/rules.rs
  • crates/tinysecurity-auto/src/rules_tests.rs
  • crates/tinysecurity-bus/src/approval.rs
  • crates/tinysecurity-bus/src/approval_tests.rs
  • crates/tinysecurity-bus/src/audit.rs
  • crates/tinysecurity-bus/src/audit_tests.rs
  • crates/tinysecurity-bus/src/audited.rs
  • crates/tinysecurity-bus/src/audited_tests.rs
  • crates/tinysecurity-bus/src/callbacks.rs
  • crates/tinysecurity-bus/src/callbacks_tests.rs
  • crates/tinysecurity-bus/src/command_policy.rs
  • crates/tinysecurity-bus/src/egress.rs
  • crates/tinysecurity-bus/src/egress_tests.rs
  • crates/tinysecurity-bus/src/future.rs
  • crates/tinysecurity-bus/src/judge.rs
  • crates/tinysecurity-bus/src/judge_tests.rs
  • crates/tinysecurity-bus/src/lib.rs
  • crates/tinysecurity-bus/src/names.rs
  • crates/tinysecurity-bus/src/policy.rs
  • crates/tinysecurity-bus/src/prompt.rs
  • crates/tinysecurity-bus/src/prompt_tests.rs
  • crates/tinysecurity-bus/src/redact.rs
  • crates/tinysecurity-bus/tests/command_wire.rs
  • crates/tinysecurity-bus/tests/egress_wire.rs
  • crates/tinysecurity-bus/tests/fixtures/v1.json
  • crates/tinysecurity-bus/tests/fixtures/v1_4.json
  • crates/tinysecurity-bus/tests/wire.rs
  • crates/tinysecurity-egress/Cargo.toml
  • crates/tinysecurity-egress/src/fixtures/cert.der
  • crates/tinysecurity-egress/src/fixtures/key.der
  • crates/tinysecurity-egress/src/lib.rs
  • crates/tinysecurity-egress/src/privacy.rs
  • crates/tinysecurity-egress/src/registry.rs
  • crates/tinysecurity-egress/src/registry_tests.rs
  • crates/tinysecurity-egress/src/resolver.rs
  • crates/tinysecurity-egress/src/resolver_tests.rs
  • crates/tinysecurity-egress/src/transport_tests.rs
  • crates/tinysecurity-egress/src/url_guard.rs
  • crates/tinysecurity-egress/src/url_guard_tests.rs
  • crates/tinysecurity-module/Cargo.toml
  • crates/tinysecurity-module/examples/approval_native_contract.rs
  • crates/tinysecurity-module/examples/approval_native_contract/callback.rs
  • crates/tinysecurity-module/examples/approval_native_contract/namespace.rs
  • crates/tinysecurity-module/examples/approval_native_contract/namespace_tests.rs
  • crates/tinysecurity-module/examples/approval_native_contract/store.rs
  • crates/tinysecurity-module/examples/audit_native_contract.rs
  • crates/tinysecurity-module/examples/audit_native_contract/manifest.rs
  • crates/tinysecurity-module/examples/audit_native_contract/native.rs
  • crates/tinysecurity-module/examples/audit_native_contract/native_tests.rs
  • crates/tinysecurity-module/examples/judge_native_contract.rs
  • crates/tinysecurity-module/examples/judge_native_contract/stub.rs
  • crates/tinysecurity-module/examples/verify_module.rs
  • crates/tinysecurity-module/src/adapter.rs
  • crates/tinysecurity-module/src/adapter_approval_tests.rs
  • crates/tinysecurity-module/src/adapter_tests.rs
  • crates/tinysecurity-module/src/approval_callbacks.rs
  • crates/tinysecurity-module/src/approval_callbacks_tests.rs
  • crates/tinysecurity-module/src/callbacks.rs
  • crates/tinysecurity-module/src/callbacks_tests.rs
  • crates/tinysecurity-module/src/lib.rs
  • crates/tinysecurity-policy/Cargo.toml
  • crates/tinysecurity-policy/src/command_registry.rs
  • crates/tinysecurity-policy/src/command_registry_tests.rs
  • crates/tinysecurity-policy/src/command_scope.rs
  • crates/tinysecurity-policy/src/command_scope_tests.rs
  • crates/tinysecurity-policy/src/command_shell.rs
  • crates/tinysecurity-policy/src/command_shell/classify.rs
  • crates/tinysecurity-policy/src/command_shell/env_guard.rs
  • crates/tinysecurity-policy/src/command_shell/executor.rs
  • crates/tinysecurity-policy/src/command_shell/scan.rs
  • crates/tinysecurity-policy/src/command_shell_classify_tests.rs
  • crates/tinysecurity-policy/src/command_shell_scan_tests.rs
  • crates/tinysecurity-policy/src/engine.rs
  • crates/tinysecurity-policy/src/engine_tests.rs
  • crates/tinysecurity-policy/src/lib.rs
  • crates/tinysecurity-policy/src/path.rs
  • crates/tinysecurity-policy/tests/content_scans.rs
  • crates/tinysecurity-policy/tests/policy.rs
  • crates/tinysecurity-redact/Cargo.toml
  • crates/tinysecurity-redact/README.md
  • crates/tinysecurity-redact/src/lib.rs
  • crates/tinysecurity-redact/src/lib_tests.rs
  • crates/tinysecurity-redact/src/patterns.rs
  • crates/tinysecurity-redact/src/patterns_tests.rs
  • crates/tinysecurity-redact/src/prompt.rs
  • crates/tinysecurity-redact/src/prompt_tests.rs
  • crates/tinysecurity-redact/src/structured.rs
  • crates/tinysecurity-redact/src/structured_tests.rs
  • crates/tinysecurity-redact/tests/acceptance.rs
  • crates/tinysecurity-redact/tests/fixtures/security-redaction-corpus.json
  • crates/tinysecurity-redact/tests/review_regressions.rs
  • crates/tinysecurity/Cargo.toml
  • crates/tinysecurity/src/lib.rs
  • docs/egress.md
  • docs/specs/security-module.md
  • vendor/tinybus
  • vendor/tinyinference

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

senamakel and others added 12 commits October 10, 2026 23:19
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
senamakel and others added 14 commits October 11, 2026 01:20
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
senamakel and others added 26 commits October 11, 2026 05:14
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel marked this pull request as ready for review October 11, 2026 06:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T06:44:28.035800Z 03d5e36 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@senamakel
senamakel merged commit 0cda9bc into main Oct 11, 2026
13 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 03d5e36e7a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +352 to +354
/// Deliberately NOT flagged here: plain redirects (`>`, `2>&1`, `2>/dev/null`),
/// `tee`, and `${VAR}` expansion. `classify_command` already lifts a redirect /
/// `tee` to `Write`, so the gate prompts and — once the human approves — the

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Block parameter-expanded find predicates

In POSIX harness-gated scopes, ${...} is deliberately omitted from hidden-execution detection, but parameter expansion can introduce executable find predicates after classification. For example, with UNSET absent, find . -maxdepth 0 ${UNSET:--exec} touch /tmp/pwn '{}' \; is classified as Read because the scanner never sees a literal -exec, then the shell expands it and executes touch; this bypasses ReadOnly and runs without approval. Treat expansion in security-sensitive arguments as hidden execution or fail the classification closed.

AGENTS.md reference: AGENTS.md:L18-L20

Useful? React with 👍 / 👎.

"log",
"diff",
"show",
"remote",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Classify mutating git remote forms as writes

When the command is git remote add, git remote remove, or git remote set-url, checking only the first Git subcommand marks it Read, so a read-only harness scope allows repository configuration changes; the allowlisted path also considers these arguments safe and assigns them low risk. Distinguish the observational git remote/git remote -v forms from its mutating nested subcommands.

AGENTS.md reference: AGENTS.md:L18-L20

Useful? React with 👍 / 👎.

Comment on lines +116 to +117
let mut scoped = audit.clone();
scoped.scope = registration.subject.clone();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Give each approval scope separate native audit storage

When approvals register multiple subjects with audit.native_path set, every per-scope client clones the same path and stream ID and changes only scope. Consequently all clients open one journal, but JsonlSink::append_locked rejects any recovered row whose scope differs (sink.rs:154-156), so after one subject writes an audit event every other subject's required audit—and therefore approval—fails. Partition the native journal/stream per registered scope or make the journal support independent scoped streams.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant