Skip to content

fix(portainer): validate HTTP opt-in after boolean coercion - #1474

Closed
IARI wants to merge 1 commit into
CodesWhat:dev/v1.8from
IARI:fix/portainer-http-env-opt-in
Closed

IARI wants to merge 1 commit into
CodesWhat:dev/v1.8from
IARI:fix/portainer-http-env-opt-in

Conversation

@IARI

@IARI IARI commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

An environment-configured Portainer action with ALLOWHTTP=true currently fails to register with "url" contains an invalid value. The URL custom validator checks the sibling opt-in before Joi converts the environment string "true" to a boolean.

Use a Joi conditional referencing allowHttp to select the permitted URI schemes after validating the opt-in. HTTPS remains the default; HTTP still requires explicit opt-in, and the runtime HTTP guard is unchanged. Both the allowHttp key and environment-derived allowhttp alias are covered.

Closes #1473.

Validation:

  • Confirmed both new environment-string regression cases fail against the original code.
  • All 154 Portainer provider tests pass with the fix, including absent/false/invalid HTTP opt-ins and HTTPS with opt-in disabled.
  • Backend build (npm run build in app/) passes.
  • Biome checks for both changed TypeScript files and git diff --check pass.

Changelog

  • 🐛 Fixed HTTP URL validation when allowHttp is supplied as the environment string "true". The URL schema selects allowed schemes after validating the opt-in.
  • ✨ Added regression tests for allowHttp and the allowhttp alias, including cases where HTTP must be rejected.
  • 🔧 Preserved HTTPS as the default and left the runtime HTTP guard unchanged.

Concerns

  • None identified.

@vercel

vercel Bot commented Oct 24, 2026

Copy link
Copy Markdown

@IARI is attempting to deploy a commit to the CodesWhat Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 99e0c9b and ff7c852.

Files ignored due to path filters: 1
  • CHANGELOG.md is excluded by !CHANGELOG.md
Files selected for processing: 2
  • app/triggers/providers/portainer/Portainer.test.ts
  • app/triggers/providers/portainer/Portainer.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The Portainer URL schema now selects accepted schemes based on allowHttp. Added tests verify that the string 'true' permits HTTP URLs for both key spellings, while false, missing, empty, and invalid values reject HTTP. Tests also verify that HTTPS remains valid when allowHttp is 'false'.

Priority: Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to ff7c8

The Portainer validation change has no identified merge-blocking risk.

Pre-merge checks: Passed 2
Check name Status Explanation
Linked Issues check Passed Issue [#1473] requires HTTP URLs to validate when allowHttp is enabled through the environment, while HTTP remains rejected when the setting is absent, false, or invalid. Portainer.ts now uses a J…
Out of Scope Changes check Passed The changes are limited to Portainer URL validation and focused regression tests. The schema change implements [#1473], and the tests verify its required environment and opt-in behavior. No unrelated …
Full details: Linked Issues check

Explanation

Issue [#1473] requires HTTP URLs to validate when allowHttp is enabled through the environment, while HTTP remains rejected when the setting is absent, false, or invalid. Portainer.ts now uses a Joi conditional on allowHttp to select http and https only after opt-in validation. Portainer.test.ts covers allowHttp and allowhttp string values and rejection cases. The reported provider tests and build pass.

Full details: Out of Scope Changes check

Explanation

The changes are limited to Portainer URL validation and focused regression tests. The schema change implements [#1473], and the tests verify its required environment and opt-in behavior. No unrelated implementation change is shown.

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

scttbnsn added a commit that referenced this pull request Oct 24, 2026
fix(mqtt): restore valid Home Assistant discovery topics
fix(portainer): validate HTTP opt-in after boolean coercion
fix(actions): decouple automatic updates from notification rules
build(deps): clear the October 24 security advisories
chore(release): prepare v1.8.0-rc.7

References #1472, #1473, #1281 and contributor PR #1474. Issues remain open for reporter retests after the candidate is published.

Co-authored-by: Julian Jarecki <[email protected]>
@scttbnsn

Copy link
Copy Markdown
Contributor

Included your fix in #1475 with your author credit preserved in the squash commit. Both new regression cases failed before the fix, and all 154 Portainer tests pass with it. Closing this PR since the change is now on dev/v1.8. Thanks for the reproduction and fix.

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