ProfessionalWiki / ProfessionalWiki/NeoWiki

Determine if we need backend validation for PropertyDefinition Attributes

Open
#545 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

product
Dominant language
PHP
Stars
23
Forks
5
Avg merge
20h 47m
Merged PRs (30d)
107

Description

This is a product question. The below described problem might not be a problem. We should determine what we want.

Relates to

Problem

PropertyDefinition Attributes (like precision, minimum, maximum for Number properties; minLength, maxLength for Text properties) are validated on the frontend only. The backend stores whatever values are provided without any validation.

For example, a negative precision value will be rejected by the frontend Number property editor (PR #469), but the backend NumberProperty class blindly accepts it. The backend deserializes these attributes from JSON (NumberProperty::fromPropertyArray) and stores them without checking constraints like:

  • Precision must be non-negative
  • Minimum must be less than maximum
  • minLength must be non-negative and less than maxLength

Since schemas are saved via MediaWiki's standard page save API, any client that bypasses the frontend (API calls, bots, imports) can create schemas with invalid attribute values.

Origin

Originally discussed in issue #461 (Jan 2026). Jeroen noted:

"This issue is a specific case of a more general 'problem': we did not implement validation for PropertyDefinition Attributes yet, or even think about how to go about it."

Morne noted:

"the backend would still allow saving a negative number, because we use MediaWiki's standard page save API"

Verified on 2025-02-05 that no attribute validation exists in the backend. NumberProperty (and other property types) have no validation logic for their attributes, and no PropertyDefinitionAttributeValidator or similar class exists.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read docs/adr/012_Backend_Validation.md and docs/planning/Validation.md, then inspect NumberProperty::fromPropertyArray and the related property classes. Review issue #461 and PR #469 for the existing frontend behavior. Done means reaching and documenting a decision about backend validation scope and constraints, rather than implementing an unspecified change.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.