Skip to content

mass asignment対策 - #14

Merged
UnABC merged 1 commit into
mainfrom
fix/mass-asignment
Aug 21, 2026
Merged

mass asignment対策#14
UnABC merged 1 commit into
mainfrom
fix/mass-asignment

Conversation

@pdpd22

@pdpd22 pdpd22 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

resolve #5

@pdpd22 pdpd22 self-assigned this Aug 21, 2026
@pdpd22
pdpd22 requested a lite review from Copilot August 21, 2026 06:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #5 by preventing mass assignment in the PATCH /api/videos/{id} endpoint, ensuring clients can only update intended editable fields rather than arbitrarily overwriting video metadata.

Changes:

  • Added strict request-body validation and an allowlist for updatable fields (title, description) in patchVideo.
  • Updated OpenAPI schema to disallow empty bodies and unknown properties for the patch request.
  • Added regression tests to verify protected fields cannot be modified and invalid payloads are rejected.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
controllers/api_videos.cpp Replaces updateByJson with explicit allowlisted updates and validates patch request JSON shape/types.
docs/openapi.yml Tightens PATCH request schema (minProperties: 1, additionalProperties: false) to match new server-side validation.
test/controllers.cpp Adds tests covering mass-assignment attempts and invalid PATCH bodies/types returning 400 and not mutating stored data.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@pdpd22
pdpd22 requested a review from UnABC August 21, 2026 06:10

@UnABC UnABC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@UnABC
UnABC merged commit e4bb2ee into main Aug 21, 2026
6 checks passed
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.

mass asignment対策

3 participants