Commit Graph

35 Commits

Author SHA1 Message Date
Ollama
436696b11b Add workflow to auto-update issue templates with releases
Adds a GitHub Actions workflow that automatically updates the
OpensourcePOS Version dropdown in bug report and feature request
templates when new releases are published.

Fixes #4317
2026-03-10 22:26:49 +01:00
jekkos
ca6a1b35af Add row-level authorization to password change endpoints (#4401)
* fix(security): add row-level authorization to password change endpoints

- Prevents non-admin users from viewing other users' password forms
- Prevents non-admin users from changing other users' passwords
- Uses can_modify_employee() check consistent with Employees controller fix
- Addresses BOLA vulnerability in Home controller (GHSA-q58g-gg7v-f9rf)

* test(security): add BOLA authorization tests for Home controller

- Test non-admin cannot view/change admin password
- Test user can view/change own password
- Test admin can view/change any password
- Test default employee_id uses current user
- Add JUnit test result upload to CI workflow

* refactor: apply PSR-12 naming and add DEFAULT_EMPLOYEE_ID constant

- Add DEFAULT_EMPLOYEE_ID constant to Constants.php
- Rename variables to follow PSR-12 camelCase convention
- Use ternary for default employee ID assignment

* refactor: use NEW_ENTRY constant instead of adding DEFAULT_EMPLOYEE_ID

Reuse existing NEW_ENTRY constant for default employee ID parameter.
Avoids adding redundant constants to Constants.php with same value (-1).

---------

Co-authored-by: jekkos <jeroen@steganos.dev>
2026-03-06 17:08:36 +01:00
jekkos
690f43578d Use Content-Type application/json for AJAX responses (#4357)
Complete Content-Type application/json fix for all AJAX responses

- Add missing return statements to all ->response->setJSON() calls
- Fix Items.php method calls from JSON() to setJSON()
- Convert echo statements to proper JSON responses
- Ensure consistent Content-Type headers across all controllers
- Fix 46+ instances across 12 controller files
- Change Config.php methods to : ResponseInterface (all return setJSON only):
  - postSaveRewards(), postSaveBarcode(), postSaveReceipt()
  - postSaveInvoice(), postRemoveLogo()
  - Update PHPDoc @return tags

- Change Receivings.php _reload() to : string (only returns view)
- Change Receivings.php methods to : string (all return _reload()):
  - getIndex(), postSelectSupplier(), postChangeMode(), postAdd()
  - postEditItem(), getDeleteItem(), getRemoveSupplier()
  - postComplete(), postRequisitionComplete(), getReceipt(), postCancelReceiving()
- Change postSave() to : ResponseInterface (returns setJSON)
- Update all PHPDoc @return tags

Fix XSS vulnerabilities in sales templates, login, and config pages

This commit addresses 5 XSS vulnerabilities by adding proper escaping
to all user-controlled configuration values in HTML contexts.

Fixed Files:
- app/Views/sales/invoice.php: Escaped company_logo (URL context) and company (HTML)
- app/Views/sales/work_order.php: Escaped company_logo (URL context)
- app/Views/sales/receipt_email.php: Added file path validation and escaping for logo
- app/Views/login.php: Escaped all config values in title, logo src, and alt
- app/Views/configs/info_config.php: Escaped company_logo (URL context)

Security Impact:
- Prevents stored XSS attacks if configuration is compromised
- Defense-in-depth principle applied to administrative interfaces
- Follows OWASP best practices for output encoding

Testing:
- Verified no script execution with XSS payloads in config values
- Confirmed proper escaping in HTML, URL, and file contexts
- All templates render correctly with valid configuration

Severity: High (4 files), Medium-High (1 file)
CVSS Score: ~6.1
CWE: CWE-79 (Improper Neutralization of Input During Web Page Generation)

Fix critical password validation bypass and add unit tests

This commit addresses a critical security vulnerability where the password
minimum length check was performed on the HASHED password (always 60
characters for bcrypt) instead of the actual password before hashing.

Vulnerability Details:
- Original code: strlen($employee_data['password']) >= 8
- This compared the hash length (always 60) instead of raw password
- Impact: Users could set 1-character passwords like "a"
- Severity: Critical (enables brute force attacks on weak passwords)
- CVE-like issue: CWE-307 (Improper Restriction of Excessive Authentication Attempts)

Fix Applied:
- Validate password length BEFORE hashing
- Clear error message when password is too short
- Added unit tests to verify minimum length enforcement
- Regression test to prevent future vulnerability re-introduction

Test Coverage:
- testPasswordMinLength_Rejects7Characters: Verify 7 chars rejected
- testPasswordMinLength_Accepts8Characters: Verify 8 chars accepted
- testPasswordMinLength_RejectsEmptyString: Verify empty rejected
- testPasswordMinLength_RejectsWhitespaceOnly: Verify whitespace rejected
- testPasswordMinLength_AcceptsSpecialCharacters: Verify special chars OK
- testPasswordMinLength_RejectsPreviousBehavior: Regression test for bug

Files Modified:
- app/Controllers/Home.php: Fixed password validation logic
- tests/Controllers/HomeTest.php: Added comprehensive unit tests

Security Impact:
- Enforces 8-character minimum password policy
- Prevents extremely weak passwords that facilitate brute-force attacks
- Critical for credential security and user account protection

Breaking Changes:
- Users with passwords < 8 characters will need to reset their password
- This is the intended security improvement

Severity: Critical
CVSS Score: ~7.5
CWE: CWE-305 (Authentication Bypass by Primary Weakness), CWE-307

Add GitHub Actions workflow to run PHPUnit tests

Move business logic from views to controllers for better separation of concerns

- Move logo URL computation from info_config view to Config::getIndex()
- Move image base64 encoding from receipt_email view to Sales controller
- Improves separation of concerns by keeping business logic in controllers
- Simplifies view templates to only handle presentation

Fix XSS vulnerabilities in report views - escape user-controllable summary data and labels

Fix base64 encoding URL issue in delete payment - properly URL encode base64 string

Fix remaining return type declarations for Sales controller

Fixed additional methods that call _reload():
- postAdd() - returns _reload($data)
- postAddPayment() - returns _reload($data)
- postEditItem() - returns _reload($data)
- postSuspend() - returns _reload($data)
- postSetPaymentType() - returns _reload()

All methods now return ResponseInterface|string to match _reload() signature.
This resolves PHP TypeError errors.
2026-03-04 21:42:35 +01:00
jekkos
26a398f7d2 Add recent releases to issue template (#4317) 2025-11-21 23:55:24 +01:00
jekkos
8833420917 Upgrade github workflow (#3708) (#4280)
Co-authored-by: El_Coloso <diegoramosp@gmail.com>
2025-07-11 23:13:44 +02:00
objecttothis
09530c1609 Feature bump ci to 4.6.0 (#4197)
* Replace tabs with spaces

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Composer package bumps

- Bump codeigniter4/framework to 4.6.0
- Bump codeIgniter/coding-standard to ^1.8
- Bump codeigniter4/devkit to ^1.3
- Updated framework files required by CI4.6.0
- Removed Deprecated variables
- Added new file in the repo from framework

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Reflect PHP 8.4 support
Updates for PHP 8.4 support introduced with the upgrade to CodeIgniter 4.6.x

* Update INSTALL.md

- Revert PHP 8.4 support for now.
- Removed extra space before comma

---------

Signed-off-by: objecttothis <objecttothis@gmail.com>
Co-authored-by: BudsieBuds <bas_hubers@hotmail.com>
2025-04-03 14:16:06 +04:00
jekkos
e1e3a30fc0 Add CI4 coding standards linter (#3708) (#4198) 2025-03-31 11:39:44 +04:00
jekkos
ac90c07c90 Remove support for PHP7.4 for now 2025-01-13 01:13:28 +01:00
jekkos
5bee124965 Add php linter (#3708) 2025-01-10 19:15:38 +01:00
jekkos
0f3175bc19 Add delete unstable release after push (#4136) 2024-12-27 00:23:32 +01:00
jekkos
154fe9f9e3 Temporarily remove linter (#3708) 2024-06-15 17:19:15 +02:00
jekkos
46009b2062 Remove admin folder from linter (#3708) 2024-06-15 17:19:15 +02:00
jekkos
24772f856f Remove action for userguide (#3708) 2024-06-15 17:19:15 +02:00
jekkos
857ef96724 Add workflow to test coding standards 2024-06-15 17:19:15 +02:00
jekkos
3690296766 Add CI4 coding standards linter 2024-06-15 17:19:15 +02:00
objecttothis
83a0ca4a5b Update bug report.yml (#3950)
* Update bug report.yml

Changed order of bug report

* Update bug report.yml

Converted values into placeholders
2024-03-20 17:17:52 +04:00
objecttothis
698f9bb3d7 Update bug report.yml (#3946)
Add option to select a development build
2024-03-12 20:42:27 +04:00
jekkos
2618772f20 Update issue templates (#3895) (#3936)
Co-authored-by: odiea <oagnew@aim.com>
2024-02-29 00:16:07 +04:00
jekkos
0618ff47fd Update ISSUE_TEMPLATE.md 2021-11-16 22:08:49 +01:00
BudsieBuds
33cb3fa3f9 Text improvements
Improved some of the non-trivial files.
2021-10-20 22:32:02 +02:00
BudsieBuds
ba8cb0ef86 Create codeql-analysis.yml 2021-07-14 08:35:04 +02:00
jekkos
fa9f0ade55 Don't close bug tickets direclty 2020-02-15 01:04:00 +01:00
jekkos
0bbb6adaba Add stale bot configuration 2020-02-15 01:00:37 +01:00
FrancescoUK
87317b00bd Update ISSUE_TEMPLATE.md 2018-04-06 14:01:14 +01:00
FrancescoUK
8c6ff0ceb1 ISSUE_TEMPLATE.md minor amendment 2017-12-03 12:06:22 +00:00
FrancescoUK
0f352abcaa Simplified ISSUE_TEMPLATE.md 2017-12-03 12:03:25 +00:00
FrancescoUK
c57679cac1 Fix Enhancement typo in ISSUE_TEMPLATE.md 2017-08-18 19:52:39 +01:00
FrancescoUK
f3a08eab3b Update ISSUE_TEMPLATE.md 2017-07-07 21:23:10 +01:00
FrancescoUK
2f44a9d5c2 Update ISSUE_TEMPLATE.md 2017-07-02 09:00:34 +01:00
FrancescoUK
d28e95208b Update TEMPLATE_ISSUES.md to reflect the latest 2017-07-01 10:06:05 +01:00
FrancescoUK
4678764a03 Improved FAQ and issue reporting template. Bumped OSPOS version in few more files 2016-10-31 17:16:30 +00:00
FrancescoUK
a5f16abbd5 Updated ISSUE_TEMPLATE.md and README.md 2016-09-06 08:31:54 +01:00
FrancescoUK
e1f796cf99 Further refinement of ISSUE_TEMPLATE.md (#779) 2016-08-07 19:10:31 +01:00
FrancescoUK
7602e77071 Refined ISSUE_TEMPLATE.md (#779) 2016-08-06 12:31:54 +01:00
FrancescoUK
bd7dd4741d Added a issue report template (#779) 2016-08-06 12:25:30 +01:00