Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughCard, board, and block property payloads now receive server-side validation before patching or persistence. API and integration tests cover malformed requests. Frontend helpers normalize invalid property names and values before rendering and editing. ChangesCard property integrity
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant Model
participant Storage
Client->>API: Submit card, board, or block patch
API->>Model: Validate patch and properties
alt Invalid payload
Model-->>API: Validation error
API-->>Client: 400 Bad Request
else Valid payload
Model-->>API: Valid patch
API->>Storage: Apply patch
Storage-->>API: Updated state
API-->>Client: Success response
end
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
server/model/block.go (1)
203-207: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winValidate property values on full block validation.
This path only verifies the outer map type. Unlike
BlockPatch, it can still persist{"properties":{"prop":{}}}through full block creation/update validation. CallValidateCardPropertyValuesafter the type assertion.Proposed fix
if propsIface, present := b.Fields[BlockFieldProperties]; present { - if _, ok := propsIface.(map[string]interface{}); !ok { + props, ok := propsIface.(map[string]interface{}) + if !ok { return ErrBlockPropertiesInvalidType } + if err := ValidateCardPropertyValues(props); err != nil { + return err + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@server/model/block.go` around lines 203 - 207, Update full block validation in the block validation method containing the BlockFieldProperties type check to call ValidateCardPropertyValues after the properties map type assertion succeeds. Preserve ErrBlockPropertiesInvalidType for invalid outer values, and reject invalid nested property values before full block creation or update proceeds.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/api/cards.go`:
- Around line 300-303: In the handler flow before calling patch.CheckValid,
detect when the unmarshaled patch is nil, including a JSON null body, and return
a 400 Bad Request through a.errorResponse. Keep the existing validation and
error handling unchanged for non-nil patches.
In `@webapp/src/properties/url/url.tsx`:
- Around line 29-30: Initialize the URL editor’s value from the sanitized
propertyValue rather than the raw card property, ensuring Editable always
receives a string. Update the relevant URL editor state initialization near
safePropertyString, and add a regression test covering edit mode with a
malformed persisted URL object or array.
---
Outside diff comments:
In `@server/model/block.go`:
- Around line 203-207: Update full block validation in the block validation
method containing the BlockFieldProperties type check to call
ValidateCardPropertyValues after the properties map type assertion succeeds.
Preserve ErrBlockPropertiesInvalidType for invalid outer values, and reject
invalid nested property values before full block creation or update proceeds.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 3c3949e1-5f7d-4140-9cf5-072e5c700a49
📒 Files selected for processing (14)
server/api/cards.goserver/integrationtests/board_test.goserver/integrationtests/cards_test.goserver/model/block.goserver/model/board.goserver/model/card.goserver/model/card_property.goserver/model/card_property_test.gowebapp/src/blocks/board.test.tswebapp/src/blocks/board.tswebapp/src/components/cardDetail/cardDetailProperties.tsxwebapp/src/components/propertyValueElement.tsxwebapp/src/components/table/tableHeaders.tsxwebapp/src/properties/url/url.tsx
|
This pull request introduces a low-severity vulnerability where the Code Policy: Safe Recursive Functions Handling User Input (drs_8132b6a4)
mattermost-plugin-boards/server/model/block.go Lines 279 to 295 in c10954f Comment to provide feedback on these findings.Report false positive: Example: All finding details can be found in the DryRun Security Dashboard. |
avasconcelos114
left a comment
There was a problem hiding this comment.
LGTM! Nicely done with the last commit moving the validation checks onto PatchBlocksAndNotify :D
Summary
Card property templates and values were accepted and persisted without checking that they matched the shape the clients expect. This adds a shared validator, used across the board, card and block create and patch paths, so data that does not match the expected type is rejected with a 400 rather than stored. The webapp side coerces card property names and values before rendering them, so any existing record that does not match the expected shape degrades gracefully instead of breaking the view it appears in.
Ticket Link
https://mattermost.atlassian.net/browse/MM-69978
Change Impact: 🟡 Medium
Regression Risk: Shared validation and rendering utilities affect server persistence and webapp display paths. Automated tests cover malformed data, but valid edge cases may regress.
QA Recommendation: Manual QA can be skipped due to comprehensive automated coverage. Targeted smoke testing remains optional.
Generated by CodeRabbitAI