Skip to content

fix: [examples] Standardise on MISP_VERIFYCERT env var name - #14

Draft
elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:fix/examples-envvar
Draft

elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:fix/examples-envvar

Conversation

@elhoim

@elhoim elhoim commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

BLUF — Eight examples read MISP_SSL_VERIFY while tests and CI use MISP_VERIFYCERT.

  • Problem — examples/basic_event.rs and seven siblings read MISP_SSL_VERIFY, while tests/integration_tests.rs and .github/workflows/ci.yml use MISP_VERIFYCERT, so copying the documented env vars silently no-ops and leaves verification on.
  • Fix — Renames the variable in all eight examples (comparison logic unchanged), updates TESTING.md, which documented the split as intentional, and adds tests/examples_env_var.rs guarding against the old name.
  • Effect — One env var name works across examples, tests and CI, so examples run against a self-signed instance as documented.
  • CI — Red from a known repo CI bug (an ubuntu-22.04 runner with no php8.3 mod_php, plus a publish-worker race in test_event_crud_lifecycle), fixed in PR fix: [ci] Run integration tests on ubuntu-24.04 to match php8.3 #53 and unrelated to this PR.

Finding

examples read MISP_SSL_VERIFY while tests and CI use MISP_VERIFYCERT
Affects basic_event.rs and 6 sibling examples. Copying the documented env vars from the test header silently no-ops and leaves verification on.

Change

Confirmed all 8 examples (basic_event.rs and 7 siblings) read env var MISP_SSL_VERIFY while tests/integration_tests.rs and CI both use MISP_VERIFYCERT. Renamed the env var in all 8 examples to MISP_VERIFYCERT (comparison logic left unchanged), updated TESTING.md which previously documented the two names as an intentional split, and added a regression test that scans the example sources and fails if the old name reappears or the new name is missing.

Upstream evidence

Not applicable — this is a pure client-side env-var naming defect, not a MISP wire-protocol issue, so no MISP controller/PyMISP citation is relevant. In-repo evidence: tests/integration_tests.rs:15,34 and .github/workflows/ci.yml:290 use MISP_VERIFYCERT; before the fix, examples/basic_event.rs:18 and 6 siblings (examples/feed_operations.rs:16, examples/galaxy_operations.rs:21, examples/manage_tags.rs:20, examples/search_attributes.rs:20, examples/sharing_groups.rs:16, examples/sightings.rs:21, examples/user_management.rs:16) used MISP_SSL_VERIFY.

Verified against MISP core 843b6744 and PyMISP e7debb4f.

Tests

  • examples_use_misp_verifycert_env_var (tests/examples_env_var.rs) - scans all example .rs files for MISP_URL usage, asserts none contain MISP_SSL_VERIFY and all contain MISP_VERIFYCERT; fails against the pre-fix examples, passes after

Verified locally: cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings, cargo test --all-features --lib, --test integration_tests --no-run, and cargo check --examples, each in an isolated target directory.

🤖 Generated with Claude Code

All 8 examples (basic_event.rs and 7 siblings) read MISP_SSL_VERIFY to
control TLS certificate verification, but tests/integration_tests.rs
(tests/integration_tests.rs:15,34) and CI (.github/workflows/ci.yml:290)
both use MISP_VERIFYCERT. A user who copies the documented
MISP_VERIFYCERT=false from the test/CI instructions into an example run
gets no error and no warning - the examples silently ignore it, fall
back to their `unwrap_or(true)`, and TLS verification stays on.

Renamed the env var read in all 8 examples from MISP_SSL_VERIFY to
MISP_VERIFYCERT (comparison logic unchanged) and updated TESTING.md,
which previously documented the two names as intentionally different.
Added tests/examples_env_var.rs, a regression test that scans the
example sources and fails if MISP_SSL_VERIFY reappears or
MISP_VERIFYCERT is missing; it fails on the pre-fix sources and passes
after.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JoSButbVaWEtGMXwTx73BZ
@elhoim
elhoim marked this pull request as draft September 3, 2026 05:05
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