Skip to content

feat: improve Guard approval flow#68

Closed
kantorcodes wants to merge 12 commits intomainfrom
codex/guard-approval-center
Closed

feat: improve Guard approval flow#68
kantorcodes wants to merge 12 commits intomainfrom
codex/guard-approval-center

Conversation

@kantorcodes
Copy link
Copy Markdown
Member

Summary

  • add a localhost approval center and queue-backed approval flow
  • let non-interactive Guard runs wait for approval and resume cleanly
  • document and test the approval-center UX

Verification

  • uv run --with pytest pytest -q tests/test_guard_approvals.py tests/test_guard_runtime.py
  • uv run --with pytest pytest -q tests/test_guard_cli.py tests/test_guard_product_flow.py
  • uv run --with ruff ruff check src tests
  • uv run --with ruff ruff format --check src tests
  • uv run --with build python -m build

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a local approval center for HOL Guard, enabling the resolution of blocked artifact changes through a daemon-served HTML interface or the new approvals CLI command. This system supports non-interactive environments by queuing requests and optionally waiting for user decisions. Review feedback identified critical security improvements, including CSRF protection via Origin header verification and request size limits to prevent DoS attacks. Additionally, suggestions were made to optimize receipt lookups in the database and enhance the approval form's user experience by pre-selecting recommended scopes.

@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot bot commented Apr 11, 2026

Code Review Summary

Status: No New Issues | Recommendation: Merge

Latest Changes (commit b3cee1a)

This commit contains only formatting/style changes - no security or logic modifications:

File Change Type
approvals.py Simplified conditional expression Style
commands.py Simplified list comprehension Style
server.py Added blank line Style
protect.py Simplified if statement Style

Review Summary

This PR has been thoroughly reviewed across multiple incremental commits:

Commit Key Changes
719ed1f Initial approval center implementation
047a6a6 CSRF origin check, DoS body limit
57bc952 Runner persist logic fix
e42ebf2 Origin spoof bypass fix (urlparse)
b71a024 Dashboard redesign (React/Vite)
46ebf00 Major feature expansion (protect, risk, incidents)
201a6f2 Rebase with GPG signature
2ca49d6 New /v1/receipts/latest endpoint
4ab9ac0 Scope validation, workspace path fix, timestamp fix
1678f68 Unlimited query support (advisories, approvals)
b3cee1a Formatting cleanup

Security Issues Addressed

  • CSRF protection with proper origin validation
  • DoS protection with body size limits
  • Path traversal protection
  • Origin spoof bypass prevention
  • Workspace scope matching fix (sibling directories)
  • Unlimited query support for protect/resolution

Recommendation: Merge


Reviewed by minimax-m2.5-20260211 · 497,241 tokens

Copy link
Copy Markdown

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

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: 719ed1f162

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown

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

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: 047a6a67aa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown

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

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: e42ebf2c07

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…center

# Conflicts:
#	src/codex_plugin_scanner/guard/approvals.py
#	src/codex_plugin_scanner/guard/cli/commands.py
#	src/codex_plugin_scanner/guard/daemon/server.py
#	src/codex_plugin_scanner/guard/runtime/runner.py
#	src/codex_plugin_scanner/guard/store.py
#	tests/test_guard_approvals.py
#	tests/test_guard_runtime.py
Copy link
Copy Markdown

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

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: c6c8de2f89

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown

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

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: b71a024c9c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@kantorcodes kantorcodes force-pushed the codex/guard-approval-center branch from 46ebf00 to 201a6f2 Compare April 11, 2026 22:20
Copy link
Copy Markdown

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

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: 201a6f2e7e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@kantorcodes kantorcodes force-pushed the codex/guard-approval-center branch from 201a6f2 to 2ca49d6 Compare April 11, 2026 22:29
Copy link
Copy Markdown

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

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: 2ca49d6ec1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@kantorcodes kantorcodes force-pushed the codex/guard-approval-center branch 3 times, most recently from 1678f68 to b3cee1a Compare April 11, 2026 22:51
Copy link
Copy Markdown

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

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: b3cee1afa8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Signed-off-by: Michael Kantor <[email protected]>
@kantorcodes kantorcodes force-pushed the codex/guard-approval-center branch from b3cee1a to e0b8d9b Compare April 11, 2026 23:25
Copy link
Copy Markdown

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

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: e0b8d9b365

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

select scope, action, artifact_hash from policy_decisions
where harness = ? and (
(scope = 'artifact' and artifact_id = ?)
(scope = 'artifact' and artifact_id = ? and (? is null or artifact_hash = ? or artifact_hash is null))
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 Require hash match for hash-scoped artifact policies

The artifact predicate in resolve_policy treats a missing incoming hash as a wildcard (? is null), so hash-pinned artifact decisions can still match when callers do not provide artifact_hash. In practice, the hook flow can call policy resolution with no hash, which turns an "exact version" decision into an artifact-wide decision for that path and weakens reapproval guarantees. Tighten this branch so hash-scoped rows are ignored when the incoming hash is absent.

Useful? React with 👍 / 👎.

advisories = store.list_cached_advisories(limit=None)
verdict = evaluate_protect_request(request, advisories)
receipt = _build_install_receipt(request, verdict)
store.add_receipt(receipt)
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 Defer protect receipt persistence until command execution

build_protect_payload persists a receipt/event before running the wrapped command. If subprocess.run then raises (for example FileNotFoundError on a missing executable or TimeoutExpired from the fixed timeout), the command fails but Guard has already stored a successful-looking protect record, which pollutes audit/history data. Persist after execution (or record an explicit execution-failed state) to keep stored outcomes accurate.

Useful? React with 👍 / 👎.

@kantorcodes kantorcodes deleted the codex/guard-approval-center branch April 11, 2026 23:34
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