Skip to content

Harden manifest endpoints, hook paths, cleanup, linked dirs and regex graders - #98

Merged
jothimani-rajendran merged 3 commits into
mainfrom
sr-2c-hardening
Oct 25, 2026
Merged

jothimani-rajendran merged 3 commits into
mainfrom
sr-2c-hardening

Conversation

@jothimani-rajendran

@jothimani-rajendran jothimani-rajendran commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Input-hardening for values a run or producer takes from a manifest or a subject (plan item SR-2c).

  • openai-compatible models: https required except to a loopback host; apiKeyEnv must be named like a provider key (^[A-Z][A-Z0-9_]*_KEY$); a stderr notice naming the host before the first request to a non-default host. Enforced in the backend constructor and at manifest load.
  • Plugin manifest hooks path must resolve inside the plugin.
  • Reachability measurement removes only the scratch directory it created.
  • A subject containing a link that resolves outside it is refused (digest_path), so digest and rows read the same bytes. verify reports it as a clean error.
  • Regex graders run in a child process with a 5 s deadline; a timeout ends the run with a RunError.

Spec

spec/run/v0.1/README.md and schema.json (and the packaged copy src/context_report/data/run-v0.1.schema.json) state the baseUrl and apiKeyEnv rules; the schema now rejects an apiKeyEnv outside the convention.

Tests

Each change has a test that failed before it (tests/test_hardening.py, tests/efficacy/test_openai_endpoint_hardening.py). ruff check and ruff format --check clean; CI green.

Notes

  • CHANGELOG entry under Unreleased / Security.

… graders

- openai-compatible: require https except to loopback, constrain the key
  variable name, and print the host and variable before the first request
  to a non-default host.
- discover: a plugin manifest's hooks path must resolve inside the plugin.
- reachability: remove only the scratch directory the measurement created.
- statement: refuse a subject holding a link that resolves outside it, so
  the digest and the producers read the same bytes.
- fastjudge: stop a regex grader after a time bound and end the run with a
  clear error instead of hanging.

Each change has a test that failed before it.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
Comment thread src/context_report/efficacy/openai_backend.py Fixed
Comment thread tests/test_hardening.py Fixed
- Name only the host in the first-request notice.
- Test the regex deadline with an injected slow worker instead of a
  backtracking pattern literal.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
- schema: apiKeyEnv gets a name pattern and a description of the rule;
  baseUrl says https is required except for a loopback host.
- spec README: the openai-compatible entry states both rules and the
  first-request notice.
- A test checks the schema itself rejects a key variable outside the
  convention.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
@jothimani-rajendran
jothimani-rajendran marked this pull request as ready for review October 25, 2026 14:11
@jothimani-rajendran
jothimani-rajendran merged commit cee3331 into main Oct 25, 2026
15 checks passed
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.

2 participants