Add testing infrastructure, CI/CD, and security fixes #1

Open
deco wants to merge 7 commits from feature/testing-ci-improvements into main
Owner

Summary

  • Add PHPUnit test infrastructure with unit tests for helper functions and API class
  • Add Forgejo Actions CI/CD workflows (lint, test, security, release)
  • Fix security issues identified in code review
  • Add project documentation index

Changes

  • Security: Cryptographically secure credential generation, XSS prevention, sensitive data redaction in logs
  • Bug fix: Add missing editUser() method, fix curl error handling
  • Refactor: Extract resolveUserId() helper to eliminate code duplication
  • CI/CD: Automated testing on push, release packaging on tags
  • Docs: PROJECT_INDEX.md for quick onboarding

Test plan

  • CI workflow passes (lint, test, security jobs)
  • Manual test in WHMCS environment
  • Verify release workflow creates valid package
## Summary - Add PHPUnit test infrastructure with unit tests for helper functions and API class - Add Forgejo Actions CI/CD workflows (lint, test, security, release) - Fix security issues identified in code review - Add project documentation index ## Changes - **Security**: Cryptographically secure credential generation, XSS prevention, sensitive data redaction in logs - **Bug fix**: Add missing `editUser()` method, fix curl error handling - **Refactor**: Extract `resolveUserId()` helper to eliminate code duplication - **CI/CD**: Automated testing on push, release packaging on tags - **Docs**: PROJECT_INDEX.md for quick onboarding ## Test plan - [ ] CI workflow passes (lint, test, security jobs) - [ ] Manual test in WHMCS environment - [ ] Verify release workflow creates valid package
- Add missing editUser() method that was causing fatal errors
- Replace insecure rand() with cryptographically secure random_int()
- Extract duplicated user lookup logic to resolveUserId() helper
- Add htmlentities escaping to form inputs in manage.tpl (XSS fix)
- Change private methods to protected for testability
- Add composer.json with PHPUnit dev dependency
- Add phpunit.xml configuration
- Add test bootstrap with WHMCS mocks
- Add HelperFunctionsTest for credential generation and package ID logic
- Add XtreamUIAPITest for API class parsing methods
- Add CI workflow with lint, test, and security jobs
  - Triggers on main, feature/*, fix/*, hotfix/* branches
  - Triggers on PRs to main
- Add release workflow for automated packaging on version tags
- Update .gitignore for composer, phpunit, and local tooling files
- Add PROJECT_INDEX.md with human-readable project overview
- Add PROJECT_INDEX.json with machine-readable metadata
- Documents project structure, API methods, and config options
fix: Address code review findings
Some checks failed
CI / Security Checks (push) Successful in 13s
CI / PHP Syntax Check (push) Failing after 14s
CI / PHPUnit Tests (push) Has been skipped
CI / PHP Syntax Check (pull_request) Failing after 12s
CI / PHPUnit Tests (pull_request) Has been skipped
CI / Security Checks (pull_request) Successful in 11s
c6492d736b
Security fixes:
- Redact sensitive data (passwords, MAC) before logging
- Escape exception messages in admin HTML to prevent XSS
- Handle curl_exec returning false before strlen()

CI/CD fixes:
- Create subdirectories before cp -r in release workflow
- Use composer.json instead of gitignored composer.lock for cache key
ci: Add setup-php action for self-hosted runners
Some checks failed
CI / Security Checks (pull_request) Successful in 12s
CI / Security Checks (push) Successful in 19s
CI / PHPUnit Tests (push) Has been cancelled
CI / PHP Syntax Check (push) Has been cancelled
CI / PHP Syntax Check (pull_request) Failing after 3h10m12s
CI / PHPUnit Tests (pull_request) Has been cancelled
6f2c828246
ci: Remove setup-php action, expect PHP on runner
Some checks failed
CI / Security Checks (push) Successful in 11s
CI / PHP Syntax Check (push) Failing after 11s
CI / PHP Syntax Check (pull_request) Failing after 11s
CI / PHPUnit Tests (push) Has been skipped
CI / PHPUnit Tests (pull_request) Has been skipped
CI / Security Checks (pull_request) Successful in 12s
41f46dd714
Some checks failed
CI / Security Checks (push) Successful in 11s
CI / PHP Syntax Check (push) Failing after 11s
CI / PHP Syntax Check (pull_request) Failing after 11s
CI / PHPUnit Tests (push) Has been skipped
CI / PHPUnit Tests (pull_request) Has been skipped
CI / Security Checks (pull_request) Successful in 12s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feature/testing-ci-improvements:feature/testing-ci-improvements
git switch feature/testing-ci-improvements

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff feature/testing-ci-improvements
git switch feature/testing-ci-improvements
git rebase main
git switch main
git merge --ff-only feature/testing-ci-improvements
git switch feature/testing-ci-improvements
git rebase main
git switch main
git merge --no-ff feature/testing-ci-improvements
git switch main
git merge --squash feature/testing-ci-improvements
git switch main
git merge --ff-only feature/testing-ci-improvements
git switch main
git merge feature/testing-ci-improvements
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deco/xtreamui_direct!1
No description provided.