Skip to content

Soft security guards: raw-meta-key warning + TTY publish confirm (v3.8.1)#10

Merged
BenKalsky merged 1 commit into
mainfrom
security/soft-guards-3.8.1
Jun 9, 2026
Merged

Soft security guards: raw-meta-key warning + TTY publish confirm (v3.8.1)#10
BenKalsky merged 1 commit into
mainfrom
security/soft-guards-3.8.1

Conversation

@BenKalsky

Copy link
Copy Markdown
Member

Non-breaking follow-up to the audit hardening. Adds the soft variants of the two findings we skipped as hard gates.

Changes

  • Raw meta keys: seo_meta.py now warns (stderr) when writing a non-allowlisted postmeta key — still writes it. Set WP_REQUIRE_ALLOWLIST=1 to refuse instead. ACF/JetEngine untouched — arbitrary custom keys are their intended API. Refactored key-mapping into a pure _map_meta_keys() helper (testable without HTTP). requests is now lazy-imported inside the three network functions so the helper is importable in stdlib-only test environments.
  • Publish confirm: create_post.py / update_post.py prompt before --status publish only on a TTY; --yes/-y bypasses. Non-interactive/agent runs are byte-for-byte unchanged → no break.
  • Version 3.8.0 → 3.8.1; 9 new unit tests (29 total, all green).

Non-breaking guarantee

should_confirm_publish("publish", False, False)False. Agent/CI runs proceed without any prompt.

Test approach

Used approach (a): extracted _map_meta_keys(meta_dict, plugin, env) as a pure helper in seo_meta.py. Tests call it directly — no HTTP, no requests needed. Coverage: allowlisted key → silent mapping; raw key → warning entry + still in payload; WP_REQUIRE_ALLOWLIST=1ValueError.

🤖 Generated with Claude Code

…3.8.1)

Non-breaking follow-up to the audit hardening. seo_meta warns on
non-allowlisted raw keys (WP_REQUIRE_ALLOWLIST=1 to refuse); create_post/
update_post confirm before --status publish on a TTY (--yes bypass,
non-interactive unchanged). Lazy-imports requests so _map_meta_keys is
testable without the optional dependency.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@BenKalsky BenKalsky merged commit a832e90 into main Jun 9, 2026
3 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: 6bcc4ae556

ℹ️ 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".

warn_insecure_wp_url(a.url)
if should_confirm_publish(a.status, a.yes, sys.stdin.isatty()):
print("About to PUBLISH live content to %s. Type 'PUBLISH' to confirm:" % a.url, file=sys.stderr)
if input("> ").strip() != "PUBLISH":

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 Keep publish prompt off JSON stdout

When stdin is a TTY but stdout is being consumed by another tool or redirected (for example, running this interactively with > result.json), input("> ") writes the prompt to stdout before the JSON response. These scripts otherwise reserve stdout for machine-readable JSON, so confirming a publish can corrupt the caller's output; the same pattern was added in update_post.py, and the prompt should be emitted on stderr while reading from stdin.

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