payload-plugin-newsletter 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.1] - 2025-06-15
9
+
10
+ ### Security
11
+ - **CRITICAL**: Fixed access control vulnerability where any authenticated user could read, update, or delete any subscriber
12
+ - **CRITICAL**: Fixed access control vulnerability where any authenticated user could modify newsletter settings
13
+ - Added proper admin role checking with support for multiple admin patterns
14
+ - Added configurable admin check function for custom authentication setups
15
+
16
+ ### Added
17
+ - New `access.isAdmin` configuration option for custom admin authentication
18
+ - Flexible admin detection supporting common patterns (roles, isAdmin, role, admin)
19
+ - Access control utility functions for consistent security
20
+
21
+ ### Changed
22
+ - All collection access controls now properly validate admin status
23
+ - Improved security documentation with custom admin configuration examples
24
+
8
25
  ## [0.3.0] - 2025-06-15
9
26
 
10
27
  ### Added
@@ -73,6 +90,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
73
90
  - Domain restriction options
74
91
  - Input validation and sanitization
75
92
 
93
+ [0.3.1]: https://github.com/aniketpanjwani/payload-plugin-email-newsletter/releases/tag/v0.3.1
76
94
  [0.3.0]: https://github.com/aniketpanjwani/payload-plugin-email-newsletter/releases/tag/v0.3.0
77
95
  [0.2.0]: https://github.com/aniketpanjwani/payload-plugin-email-newsletter/releases/tag/v0.2.0
78
96
  [0.1.1]: https://github.com/aniketpanjwani/payload-plugin-email-newsletter/releases/tag/v0.1.1
package/README.md CHANGED
@@ -424,6 +424,28 @@ Starting from v0.3.0, the plugin implements proper access control for all operat
424
424
  - **Newsletter settings**: Only admin users can modify email provider settings and configurations
425
425
  - **API endpoints**: All endpoints respect Payload's access control rules
426
426
 
427
+ #### Custom Admin Check
428
+
429
+ The plugin supports multiple admin authentication patterns out of the box:
430
+ - `user.roles.includes('admin')` - Role-based
431
+ - `user.isAdmin === true` - Boolean field
432
+ - `user.role === 'admin'` - Single role field
433
+ - `user.admin === true` - Admin boolean
434
+
435
+ If your setup uses a different pattern, configure a custom admin check:
436
+
437
+ ```typescript
438
+ newsletterPlugin({
439
+ access: {
440
+ isAdmin: (user) => {
441
+ // Your custom logic
442
+ return user.customAdminField === true
443
+ }
444
+ },
445
+ // ... other config
446
+ })
447
+ ```
448
+
427
449
  ### Best Practices
428
450
 
429
451
  - Always use environment variables for sensitive data (API keys, JWT secrets)