Skip to content

Release 3.1.3#137

Merged
GaryJones merged 46 commits intomainfrom
release/3.1.3
Oct 7, 2025
Merged

Release 3.1.3#137
GaryJones merged 46 commits intomainfrom
release/3.1.3

Conversation

@GaryJones
Copy link
Copy Markdown
Contributor

@GaryJones GaryJones commented Oct 1, 2025

Although primarily a security fix release, this release also addresses a handful of other bugs.

There were some improvements for strings and i18n/l10n too:

And a handful of development/contributing items for the repository as well:

Once this PR is approved and merged into main, then the merge commit on main can be tagged with 3.1.3.

A new PR that then merges main into develop (to capture the changes made on this release branch) is also needed afterwards.

GaryJones and others added 30 commits September 23, 2025 17:01
…cessibility

- Standardize headings in issue and pull request templates.
- Remove unnecessary comments and streamline instructions for better user experience.
- Removed the `makepot` task from Gruntfile.js as it is no longer needed.
- Updated the `build:i18n` script in package.json to use WP-CLI for generating translation files.
- Added text domain and domain path in polldaddy.php for better localization support.
- Updated the locale/polldaddy.pot file with new headers and translation strings.
Changed the domain path from `/locale` to `/languages` to match the default path. There's no reason to deviate from this.
Eliminated the call to `load_plugin_textdomain()` as it is no longer necessary after WP 4.6. WP core will now load plugin text domains just in time.
- Add composer.json with Yoast WP Test Utils for WordPress testing
- Add phpunit.xml configuration for unit and integration test suites
- Add phpunit-unit.xml for standalone testing without WordPress
- Add tests/bootstrap.php for WordPress test environment
- Add tests/TestCase.php base class with PSR-4 namespace
- Add SampleTest.php to verify framework functionality
- Include PHPUnit test scripts and coverage reporting

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add trailing newline to tests/bootstrap.php
- Ensures all test files follow proper file ending conventions
- Addresses Gary's review feedback on PR #133

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Merge PHPCS configuration from PR #132 with PHPUnit testing setup
- Combine both testing and coding standards dependencies
- Remove unnecessary dealerdirect/phpcodesniffer-composer-installer dependency
- Add phpcs.xml configuration for WordPress coding standards
- Update .gitignore for PHPCS cache
- Fix support URLs to use correct repository paths

This resolves the potential conflict between PR #132 (PHPCS) and PR #133 (PHPUnit)
by combining both functionalities into a single comprehensive configuration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove duplicate phpunit-unit.xml file (only need one config)
- Rename phpunit.xml to phpunit.xml.dist for distributed version
- Update PHPUnit schema from 9.5 to 9.6
- Remove test:standalone script that referenced deleted config
- Update .gitignore to ignore phpunit.xml (allows custom local configs)

Addresses Gary's review feedback on PR #133 about PHPUnit configuration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Co-authored-by: Gary Jones <gary.jones@automattic.com>
- Add declare(strict_types = 1) to all test files
- Add namespace to tests/bootstrap.php
- Implement conditional WordPress loading (only for integration tests)
- Use modern PHP syntax with closures and proper typing
- Bootstrap now checks for --testsuite integration argument
- Unit tests run without WordPress dependency

Addresses Gary's review feedback about separating unit tests from WordPress
and using modern PHP practices with strict typing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add PHP CodeSniffer with WordPress coding standards to improve code quality and ensure consistent coding practices across the project.

Changes:
- Add composer.json with WPCS dependencies and scripts
- Add phpcs.xml with WordPress-Extra rules and project-specific configuration
- Update .gitignore to exclude PHPCS cache files

The configuration includes:
- WordPress-Extra coding standards (includes WordPress-Core)
- PHP 5.6+ compatibility
- Text domain validation for 'polldaddy'
- Proper prefixes for global functions/variables
- Parallel processing for faster execution
- Caching for improved performance

Usage:
- composer install    # Install dependencies
- composer phpcs      # Check coding standards
- composer phpcbf     # Fix auto-fixable issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…y.com

- Applied core fix from PR 109: static.polldaddy.com → secure.polldaddy.com
- Added poll.fm URL example as requested
- Fixed both shortcode and URL-based poll conversion
- Removed static domain references from JavaScript validation
- Simple focused fix without version bumps or test complexity

Fixes poll shortcode 404 JavaScript errors by using the working domain.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
GaryJones and others added 6 commits October 1, 2025 11:05
This commit provides a comprehensive fix for the CSRF vulnerability (CVE-2024-43338),
implementing multi-layered security measures to prevent unauthorized access to
media upload functionality.

Security Issues Addressed:
- CVE-2024-43338: CSRF vulnerability in polls media upload functionality
- Unauthorized Filter Registration: Prevents malicious registration of media upload filters
- Cross-User Attack Prevention: User-specific nonces prevent cross-user CSRF attacks

Changes Made:

Frontend Security (js/polldaddy.js):
- Minimal nonce integration preserving original minified structure
- Only 3 vulnerable URL constructions modified
- Graceful degradation if pollsMediaSecurity.nonce is unavailable
- Proper encoding using encodeURIComponent()

Backend Security (popups.php):
- Admin context verification with is_admin()
- User capability checks requiring edit_posts capability
- User-specific nonce verification using helper function
- Early return pattern for secure failure handling

Helper Function (polldaddy.php):
- Added get_polls_media_nonce() helper for consistent nonce action generation
- User-specific nonces generated per user to prevent cross-user attacks
- Scoped generation only for poll edit/create pages
- JavaScript localization via pollsMediaSecurity object

Test Coverage (tests/Unit/CSRFSecurityTest.php):
- Comprehensive test suite with 9 test methods
- Security validation for all failure conditions
- Attack simulation and CSRF attack prevention tests
- User-specific nonce generation and consistency tests

Security Design:
1. Admin Context Check: is_admin() verification
2. Capability Check: current_user_can('edit_posts') verification
3. CSRF Protection: User-specific nonce verification
4. Parameter Validation: Required parameter presence checks

This fix prevents:
- CSRF Attacks: User-specific nonces prevent cross-site request forgery
- Unauthorized Access: Capability checks ensure only authorized users can access
- Cross-User Attacks: User-bound nonces prevent attacks between authenticated users
- Non-Admin Context Abuse: Admin context verification prevents frontend exploitation
Address Gary's feedback:
- Move CSRFSecurityTest from Unit to Integration directory (PSR-4 aligned)
- Add declare(strict_types=1) to test file
- Add proper namespace (Automattic\Crowdsignal\Tests\Integration)
- Add return type declarations to all test methods
- Create bin/install-wp-tests.sh for pulling down WP core and test suite

These are integration tests as they use WordPress testing functions like
set_current_screen() and wp_set_current_user() which come from the WP
testing package.
… tests

- Updated phpunit.xml.dist to include the 'partials' directory for test exclusions. This stops code coverage HTML from leaking into the CLI output.
- Refactored tests/bootstrap.php to improve integration test handling, including checks for the `--testsuite` argument.
- Moved integration TestCase into tests/Integration directory.
- Updated Composer test script to run both testsuites.

Tests can be run with:

`wp-env start --xdeub=coverage`

`wp-env run tests-cli --env-cwd=wp-content/plugins/crowdsignal-plugin composer test`
@GaryJones GaryJones added this to the 3.1.3 milestone Oct 1, 2025
@GaryJones GaryJones requested a review from donnchawp October 1, 2025 15:46
@GaryJones GaryJones self-assigned this Oct 1, 2025
@GaryJones GaryJones marked this pull request as draft October 3, 2025 13:48
ovidiul and others added 5 commits October 3, 2025 18:08
…vascript-404-clean"

This reverts commit 0dd27a1, reversing
changes made to 6473bb9.
- Introduced a new CONTRIBUTING.md file to provide clear guidelines for contributors, including setup instructions, development workflow, code standards, testing procedures, and pull request submission guidelines.
- Removed the outdated DEVELOPMENT.md file to streamline documentation and avoid redundancy.
- Update out of date info in package.json.
@GaryJones GaryJones marked this pull request as ready for review October 3, 2025 16:15
Copy link
Copy Markdown
Contributor

@donnchawp donnchawp left a comment

Choose a reason for hiding this comment

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

Since there's a security fix in this we should get it out ASAP but Plugin Check is still showing issues, especially with translation issues.
I only tested that the website loaded when I tried this branch. I expect all the separate PRs were tested properly.

- Removed the outdated phpcs.ruleset.xml file and replaced it with phpcs.xml.dist to follow best practices.
- Updated Gruntfile.js to exclude the new phpcs.xml.dist file from processing.
@GaryJones GaryJones merged commit b373dd4 into main Oct 7, 2025
@GaryJones GaryJones deleted the release/3.1.3 branch October 7, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants