Skip to content

fix: メールフィールド名にMySQL予約語を登録した場合のバリデーション追加 (#4332)#2

Closed
teratai3 wants to merge 1 commit into
5.1.xfrom
dev-#4332
Closed

fix: メールフィールド名にMySQL予約語を登録した場合のバリデーション追加 (#4332)#2
teratai3 wants to merge 1 commit into
5.1.xfrom
dev-#4332

Conversation

@teratai3

@teratai3 teratai3 commented Mar 21, 2026

Copy link
Copy Markdown
Owner

MailFieldsTable::validationDefault() に BcValidation::reserved() による 予約語チェックを追加。CustomFieldsTable と同様のバリデーションパターンを適用。

  • field_name に reserved バリデーションルールを追加
  • BcValidation プロバイダー (bc) を登録
  • ユニットテストを追加(select, insert, update などの予約語をテスト)

Note

Low Risk
Adds an additional validation rule on MailFieldsTable that can block previously-accepted field_name values (e.g., select, insert, update), but the change is localized to input validation and covered by new unit tests.

Overview
Prevents registering mail field field_name values that are database/system reserved words by wiring BaserCore\Model\Validation\BcValidation::reserved() into MailFieldsTable::validationDefault() (including registering the bc validator provider).

Adds unit coverage to ensure reserved words like select/insert/update are rejected with the new error message, while normal names still pass.

Written by Cursor Bugbot for commit 9e049af. This will update automatically on new commits. Configure here.

MailFieldsTable::validationDefault() に BcValidation::reserved() による
予約語チェックを追加。CustomFieldsTable と同様のバリデーションパターンを適用。

- field_name に reserved バリデーションルールを追加
- BcValidation プロバイダー (bc) を登録
- ユニットテストを追加(select, insert, update などの予約語をテスト)

Co-authored-by: tera <teratai3@users.noreply.github.com>
@teratai3

Copy link
Copy Markdown
Owner Author

@cursor review

@cursor cursor Bot 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@teratai3

Copy link
Copy Markdown
Owner Author

@cursor review

  • 現在のプロジェクト、reservedのテストコードは入ってないので、今回の修正でも必要ない可能性
  • デフォルトバリデーションプロバイダーで起動時に呼出されているので、今回の修正では明示する必要がない可能性

*/
public function validationDefault(Validator $validator): Validator
{
$validator->setProvider('bc', 'BaserCore\Model\Validation\BcValidation');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant provider registration already set at bootstrap

Low Severity

The setProvider('bc', 'BaserCore\Model\Validation\BcValidation') call is redundant — the bc provider is already registered as a default provider via Validator::addDefaultProvider('bc', ...) in plugins/baser-core/config/bootstrap.php. Notably, the CustomFieldsTable that this PR says it's modeled after does not include this explicit setProvider call yet uses 'provider' => 'bc' for its reserved rule without issue. This inconsistency with the stated reference implementation adds unnecessary code.

Fix in Cursor Fix in Web

@teratai3

Copy link
Copy Markdown
Owner Author

@cursor review

  • 現在のプロジェクト、reservedのテストコードは入ってないので、今回の修正で、厳格にテストコードを実装する必要ない可能性を考えてください

@cursor cursor Bot 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.

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

@teratai3 teratai3 closed this Mar 21, 2026
@teratai3

Copy link
Copy Markdown
Owner Author

@cursor review

デフォルトバリデーションプロバイダーで起動時に呼出されているので、今回の修正では明示する必要がない可能性を考えてください

@cursor

cursor Bot commented Mar 21, 2026

Copy link
Copy Markdown

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@teratai3 teratai3 reopened this Mar 21, 2026
@teratai3 teratai3 closed this Mar 22, 2026
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