Repository navigation
fix(host-ports): apply TaskConstraints in TaskCommands (ZD-L1) - #145
Merged
Merged
Conversation
TaskCommandsInterface only checked titles, URL length and minutes, so a host passing user input could store javascript:/data: link URLs, free-form colours, more than 20 tags and over-long comments, notes, labels and external ids that the page forms refuse. TaskCommands now runs the same Validation\TaskConstraints before any write and throws InvalidArgumentException, like its other invalid input. Adds TaskChangedException::CODE (CONFLICT_001) for host conflict mapping (ZD-I5).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Target: 2.30.2 (patch). Not to be merged/tagged by the fixer; owner decides. CHANGELOG entry under
[Unreleased].TaskCommandsInterfaceonly checked the title, link URL length, document title, column name and minutes.TaskCommandsnow runs the sameValidation\TaskConstraintsas the page forms (one source of truth) before anything is written:addLink():linkUrl()(http/https only: refusesjavascript:,data:…),linkLabel(),linkExternalId()createTask()/updateTask():taskTitle(),taskColor()(#rrggbb), at mostTAGS_MAX(20) tags, eachtagName()(non-string tags refused)addComment():commentBody();logTime():timeNote();addHostObjectLink():linkLabel();addColumn():columnColor()InvalidArgumentException, the port's existing invalid-input type (USAGE: map to 422 at an HTTP edge, as the Task API does). The Task API does not go throughTaskCommandsand already validates its fields (422), unchanged.TaskChangedException::CODE = 'CONFLICT_001'; USAGE tells hosts to send it asX-Conflict-Codewith the 409.?ValidatorInterface $validator = null(wired@?validator; a standaloneValidation::createValidator()otherwise). No BC break; no new translation keys (port exception messages are developer-facing English like the existing ones).Worker mode (reset false):
TaskCommandsstaysfinal readonly, the validator is set once in the constructor, no request state. Standard and DDD hosts: same id-based port, no entity in the API.Tests
HostPortsTest::testTheFormsConstraintsAreAppliedBeforeAnyWrite:javascript:anddata:links,red;colour on create and update, 21 tags, 65-char / blank / non-string tags, 5001-char comment, 513-char note, 256-char labels, 129-char external id,red;column colour → all refused, nothing stored; the form limits (20 tags, 255/128/5000/512 chars,http://intranet/...,#123) still pass.TaskChangedException::CODE.TaskCommands100% lines (260/260),TaskChangedException100%. Overall local 99.49% statements, the gap only inTaskBoardExtension(optional-package branches; main's CI gate is green), so the 100% gate is for CI to confirm.tests/Functional/HostPortson MySQL 8.4 OK (31 tests, 2264 assertions) and PostgreSQL 16 OK (31 tests, 1 skipped).🤖 Generated with Claude Code