Skip to content

cog-build: drop misleading web_search claim + honor security profile sandbox - #306

Merged
FMXExpress merged 1 commit into
mainfrom
claude/cog-build-honor-profile-sandbox
Jun 18, 2026
Merged

FMXExpress merged 1 commit into
mainfrom
claude/cog-build-honor-profile-sandbox

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Summary

Addresses both Codex P2 findings on PR #304.

Finding 1 — predict.py:295-296 — misleading web_search claim

The profile input description said max-build enables web_search. The flag is in max-build's patch, but tool registration is gated on HasConfiguredWebSearchProvider(Cfg) in NewBuiltinRegistry. The cog only writes LLM provider entries — no web_search.provider block — so the tool never registers. A caller following the default would see no web_search despite the description.

Fix: rewrite the description to call out web_fetch as the available tool and explicitly note that web_search needs an out-of-band search-provider config the cog doesn't supply. Same edit in the README's "Profile defaults" section.

Finding 2 — predict.py:455-463 — sandbox override defeats profile=security

The seeded config_data set permissive sandbox values explicitly. LoadConfig applies the profile first, then the config file overrides — so my explicit fields stomped security's hardening. Operators picking profile=security silently got the permissive cog sandbox.

Fix: drop the sandbox block from config_data entirely. PasClaw's TConfig defaults

RestrictToWorkspace       := False
AllowReadOutsideWorkspace := False
ShellDenyEnabled          := True
BlockPrivateNetworks      := True

are already appropriate for a cloud container — two of the cog's original fields (AllowReadOutsideWorkspace=True, BlockPrivateNetworks=False) were more permissive than the stock defaults without strong motivation. Result table:

Profile Effective sandbox
max-build (default) / baseline / low-token / all-on TConfig defaults (shell deny on, internal-IP block on, workspace-only reads)
security Profile's hardening (workspace restriction + allow_read_outside_workspace=False + private-network block + …) takes effect as advertised
(empty) TConfig defaults

A comment block above config_data names the Codex P2 finding + PR #304 so the override doesn't get "cleaned up" later. README "Profile defaults" subsection documents the no-sandbox-seed choice and enumerates the inherited values.

Files

cog-build/predict.py    # ~20 LOC delta
cog-build/README.md     # description sentences updated

Test plan

  • python3 -c "import ast; ast.parse(...)" — syntax OK
  • cog push with profile=security and verify pasclaw status (or a quick fs_read /etc/hostname attempt) actually fails per the security profile.
  • cog push with profile=max-build and confirm sandbox is permissive (RestrictToWorkspace=False).

No Pascal-side changes.


Generated by Claude Code

…y sandbox

Codex P2 review on PR #304, both findings legit:

FINDING 1 -- predict.py:295-296: the profile input description
claimed `max-build` enables web_search. The flag IS in the
max-build profile, but tool registration is gated on
HasConfiguredWebSearchProvider in NewBuiltinRegistry. The cog
only writes LLM provider entries, no web_search.provider block,
so the tool never registers. A caller following the default
sees no web_search even though the description advertises it.

Fix: rewrite the description to call out web_fetch as the real
available tool, and explicitly note that web_search needs an
out-of-band search-provider config which the cog doesn't supply.
Same edit in cog-build/README.md's "Profile defaults" section.

FINDING 2 -- predict.py:455-463: the seeded config_data explicitly
set sandbox.restrict_to_workspace=False, allow_read_outside_
workspace=True, block_private_networks=False. PasClaw's LoadConfig
applies the profile BEFORE the config file, so these fields
overrode whatever the profile chose -- including security's
hardening. profile=security operators got the permissive cog
sandbox, not the advertised hardened one.

Fix: drop the sandbox block from config_data entirely. PasClaw's
TConfig defaults

  RestrictToWorkspace       := False
  AllowReadOutsideWorkspace := False
  ShellDenyEnabled          := True
  BlockPrivateNetworks      := True

are already appropriate for a cloud container -- two cog fields
were even more permissive than the defaults
(AllowReadOutsideWorkspace + BlockPrivateNetworks), which weren't
strongly motivated to begin with. With the block gone:

  * profile=max-build / baseline / low-token / all-on: inherit
    TConfig defaults (sandbox permissive enough to operate, shell
    deny on, internal-IP block on).
  * profile=security: profile's hardening (restrict_to_workspace=
    True, allow_read_outside_workspace=False, block_private_
    networks=True, etc.) wins as intended.
  * profile="" (skip): TConfig defaults.

Comment block above config_data names Codex P2 PR #304 so a
future contributor doesn't "clean up" and re-introduce the
override. README "Profile defaults" subsection also explicitly
documents the no-sandbox-seed choice + names the inherited
TConfig values for clarity.

No Pascal-side changes.
@FMXExpress
FMXExpress merged commit d2cf52e into main Jun 18, 2026
khongten001 pushed a commit to khongten001/PasClaw that referenced this pull request Jul 13, 2026
The README + docs/changelog.md last entry was 2026-06-13 (FMXExpress#244). Five
substantial PRs (FMXExpress#314 FMXExpress#315 FMXExpress#316 FMXExpress#317 FMXExpress#318) and ten more feature PRs
between them and that entry shipped without changelog entries. This
brings both files current through today.

Twenty new entries (newest first, matching the existing style):

  2026-06-21
    FMXExpress#318  Relay pull-worker provider (queue + provider + /v1/relay/* HTTP)

  2026-06-20
    FMXExpress#317  pasclaw plan + build PLAN.md pickup + build --goal + cog mode
    FMXExpress#316  Cloudflare AI Gateway provider catalog rows
    FMXExpress#315  MCP progressive disclosure + tool_search
    FMXExpress#314  Stock defaults adopt lean-edit shape; fs_grep split-gate

  2026-06-18
    FMXExpress#312  Web UI workspace.zip export + import
    FMXExpress#310  Model-callable cron tool
    FMXExpress#309  FTS5 snippet window widened 24 -> 60
    FMXExpress#307  Windows cmd.exe quoting fix

  2026-06-17
    FMXExpress#306  cog-build honours profile=security sandbox
    FMXExpress#304  cog-build default profile = max-build
    FMXExpress#303  cog-build list[Path] outputs + Secret inputs + -q

  2026-06-16
    FMXExpress#302  cog-build optional workspace_in
    FMXExpress#300  pasclaw build cmd + cog-build/ predictor (parent feature)
    FMXExpress#299  Checkpoints zpaq backend + /redo
    FMXExpress#298  AGENTS.md + pasclaw init + /init
    FMXExpress#297  tool_choice force-a-specific-tool form
    FMXExpress#296  Delphi ExtraEnv injection fix
    FMXExpress#295  KB native PDF ingest

  2026-06-15
    FMXExpress#292  pasclaw profile diff + bench

Skipped per the changelog's stated convention ("Bug fixes and review
follow-ups are in the full git log"):

  FMXExpress#293  cmd/profile dcc64 fix
  FMXExpress#294  skills_manage gemini empty-enum fix
  FMXExpress#301  cmd.build dcc64 fix
  FMXExpress#311  cron dcc64 fix

Files updated identically (the docs/changelog.md note at the top says
"This file mirrors the changelog section at the top of the root
README.md"):

  M README.md           20 entries + 20 link refs added
  M docs/changelog.md   same

The link-ref block at the bottom of each file gained 20 [#NNN] entries
keeping the existing one-per-line / sorted-numerically format.
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