Skip to content

Commit 1f9055a

Browse files
committed
v5.1.5
1 parent 9775f72 commit 1f9055a

File tree

587 files changed

+57893
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

587 files changed

+57893
-0
lines changed

.bladeignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore email templates
2+
resources/views/emails/**

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml,js,json}]
15+
indent_size = 2

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ phpunit.xml.dist export-ignore
2121
RELEASE.md export-ignore
2222
UPGRADE.md export-ignore
2323
encode.sh export-ignore
24+
encoder.php export-ignore
25+
loader.php export-ignore
2426
comments.txt export-ignore
2527
testbench.yaml export-ignore

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.DS_Store
2+
.thumbs.db
3+
*.bak
4+
*.zip
5+
/vendor
6+
7+
composer.lock
8+
/phpunit.xml
9+
.phpunit.result.cache
10+
example
11+
/backup_*
12+
*.backup
13+
*.backup.*
14+
/encoder

.styleci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
php:
2+
preset: laravel
3+
js: true
4+
css: true

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# coderstm/laravel-core
2+
3+
<p align="center">
4+
<a href="https://github.com/coders-tm/laravel-core/actions"><img src="https://github.com/coders-tm/laravel-core/workflows/tests/badge.svg" alt="Build Status"></a>
5+
<a href="https://packagist.org/packages/coderstm/laravel-core"><img src="https://img.shields.io/packagist/dt/coderstm/laravel-core" alt="Total Downloads"></a>
6+
<a href="https://packagist.org/packages/coderstm/laravel-core"><img src="https://img.shields.io/packagist/v/coderstm/laravel-core" alt="Latest Stable Version"></a>
7+
<a href="https://packagist.org/packages/coderstm/laravel-core"><img src="https://img.shields.io/packagist/l/coderstm/laravel-core" alt="License"></a>
8+
</p>
9+
10+
## Introduction
11+
12+
[Laravel Core](https://laravel.com) package that provides essential core functionalities and utilities for Laravel applications.
13+
14+
## Official Documentation
15+
16+
Documentation for Laravel Core can be found [here](https://laravel-core.netlify.com).
17+
18+
## Security Vulnerabilities
19+
20+
Please review [our security policy](https://github.com/coders-tm/laravel-core/security/policy) on how to report security vulnerabilities.
21+
22+
## License
23+
24+
Laravel Core is open-sourced software licensed under the [MIT license](LICENSE.md).

SECURITY.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# License Security Implementation
2+
3+
## Overview
4+
5+
This implementation provides multiple layers of security to prevent license bypass and ensure system integrity. The security system is designed to be tamper-resistant and difficult to circumvent.
6+
7+
## Security Layers
8+
9+
### 1. Early Boot Validation
10+
- License verification happens during service provider boot, before any other application logic
11+
- The application terminates immediately if license validation fails
12+
- Cannot be bypassed by modifying middleware stack after boot
13+
14+
### 2. Multiple Middleware Registration
15+
- Primary middleware is registered in multiple positions (push and prepend)
16+
- Periodic verification middleware runs additional checks every 5 minutes
17+
- Provides redundancy if one middleware is removed
18+
- Middleware integrity is verified during termination
19+
20+
### 3. Runtime Verification Caching
21+
- Verification results are cached with environment-specific hashes
22+
- Prevents repeated API calls while maintaining security
23+
- Cache is automatically invalidated on environment changes
24+
25+
### 4. Request-Level Security Checks
26+
- Suspicious headers and parameters are detected
27+
- Multiple verification layers per request
28+
- Graceful handling of license violations
29+
30+
### 5. Tamper Detection
31+
- Environment-specific verification hashes
32+
- Basic file existence monitoring
33+
- Runtime security checks
34+
35+
## Implementation Details
36+
37+
### Service Provider Security (`CoderstmServiceProvider`)
38+
39+
1. **Early Boot Enforcement**: `enforceSystemIntegrity()`
40+
- Runs before any other boot operations
41+
- Terminates application on license failure
42+
- Sets verification flags for later checks
43+
44+
2. **Secure Middleware Registration**: `registerSecureMiddleware()`
45+
- Registers middleware in multiple positions
46+
- Adds termination callback for integrity verification
47+
- Cannot be easily bypassed
48+
49+
3. **Middleware Integrity Verification**: `verifyMiddlewareIntegrity()`
50+
- Checks middleware presence during termination
51+
- Detects middleware removal attempts
52+
- Terminates application if middleware is missing
53+
54+
### License Middleware Security (`SystemIntegrityVerifier`)
55+
56+
1. **Enhanced License Verification**: `verifyEnvironment()`
57+
- Caches verification with environment hashes
58+
- Environment-specific verification factors
59+
- Invalidates cache on environment changes
60+
61+
2. **Comprehensive Request Verification**: `performComprehensiveVerification()`
62+
- Multiple verification layers
63+
- Boot verification checks
64+
- Request-level security validation
65+
66+
## Security Features
67+
68+
### Bypass Prevention
69+
- Multiple verification points prevent single-point failures
70+
- Early termination prevents application execution
71+
- Encrypted storage prevents data tampering
72+
- Environment-specific hashing prevents cache transfer
73+
74+
### Tamper Detection
75+
- Basic file existence checks
76+
- Suspicious request detection
77+
- Environment-specific verification hashes
78+
79+
### Graceful Degradation
80+
- Appropriate error responses for different contexts
81+
- License management interface access
82+
- User-friendly error pages
83+
- API-compatible error responses
84+
85+
## Configuration
86+
87+
### License Management Routes
88+
- `/license/manage` - License management interface
89+
- `/license/update` - License update endpoint
90+
91+
### Console Commands
92+
```bash
93+
# Clear application cache
94+
php artisan cache:clear
95+
96+
# Clear configuration cache
97+
php artisan config:clear
98+
```
99+
100+
### Environment Variables
101+
```bash
102+
# Required
103+
APP_LICENSE_KEY=your_license_key_here
104+
CODERSTM_DOMAIN=your_domain_here
105+
INSTALLER_APP_ID=your_app_id_here
106+
107+
# Optional Security Settings
108+
CODERSTM_CHECK_INTERVAL=300
109+
CODERSTM_TAMPER_DETECT=true
110+
```
111+
112+
## Security Best Practices
113+
114+
### For Developers
115+
1. Never comment out license verification code
116+
2. Don't modify the SystemIntegrityVerifier class
117+
3. Keep environment variables secure
118+
4. Monitor system integrity regularly
119+
120+
### For System Administrators
121+
1. Regularly run integrity verification
122+
2. Monitor application logs for tampering attempts
123+
3. Keep license keys secure
124+
4. Update license before expiration
125+
126+
### For End Users
127+
1. Use legitimate license keys only
128+
2. Don't attempt to bypass license checks
129+
3. Contact support for license issues
130+
4. Keep application updated
131+
132+
## Troubleshooting
133+
134+
### Common Issues
135+
1. **License verification failed**: Check license key and domain configuration
136+
2. **File integrity errors**: Verify critical files haven't been modified
137+
3. **Middleware missing**: Check service provider registration
138+
4. **Cache issues**: Clear license cache and re-verify
139+
140+
### Debug Commands
141+
```bash
142+
# Clear license cache
143+
php artisan cache:clear
144+
145+
# Check logs
146+
tail -f storage/logs/laravel.log
147+
```
148+
149+
## Security Limitations
150+
151+
While this implementation provides robust protection, it's important to understand its limitations:
152+
153+
1. **Not cryptographically unbreakable**: Determined attackers with server access can still bypass
154+
2. **Requires server-side verification**: Cannot prevent client-side modifications
155+
3. **Performance overhead**: Multiple verification layers add computational cost
156+
4. **Maintenance required**: System needs updates for new bypass methods
157+
158+
## Conclusion
159+
160+
This multi-layered security approach significantly increases the difficulty of bypassing license validation while maintaining system usability. Regular monitoring and updates are essential for continued effectiveness.

composer.json

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
{
2+
"name": "coderstm/laravel-core",
3+
"description": "Laravel Core package that provides essential core functionalities and utilities for Laravel applications.",
4+
"keywords": [
5+
"laravel",
6+
"sanctum",
7+
"auth",
8+
"enquiry",
9+
"multi auth guard",
10+
"tasks management",
11+
"log",
12+
"subscription"
13+
],
14+
"license": "MIT",
15+
"support": {
16+
"issues": "https://github.com/coders-tm/laravel-core/issues",
17+
"source": "https://github.com/coders-tm/laravel-core"
18+
},
19+
"authors": [
20+
{
21+
"name": "Dipak Sarkar",
22+
"email": "[email protected]"
23+
}
24+
],
25+
"require": {
26+
"php": "^8.2",
27+
"ext-json": "*",
28+
"barryvdh/laravel-dompdf": "^3.1",
29+
"creativeorange/gravatar": "^1.0",
30+
"doctrine/dbal": "^3.4",
31+
"gocardless/gocardless-pro": "^6.6",
32+
"illuminate/console": "^12.0",
33+
"illuminate/contracts": "^12.0",
34+
"illuminate/database": "^12.0",
35+
"illuminate/http": "^12.0",
36+
"illuminate/log": "^12.0",
37+
"illuminate/notifications": "^12.0",
38+
"illuminate/pagination": "^12.0",
39+
"illuminate/routing": "^12.0",
40+
"illuminate/support": "^12.0",
41+
"illuminate/view": "^12.0",
42+
"jenssegers/agent": "^2.6",
43+
"kreait/laravel-firebase": "^6.0",
44+
"laravel-notification-channels/fcm": "^5.0",
45+
"laravel/cashier": "^15.0",
46+
"laravel/sanctum": "^4.0",
47+
"league/csv": "^9.15",
48+
"league/iso3166": "^4.3",
49+
"nesbot/carbon": "^3.0",
50+
"qirolab/laravel-themer": "^2.4",
51+
"razorpay/razorpay": "^2.9",
52+
"simplesoftwareio/simple-qrcode": "^4.2",
53+
"spatie/laravel-sluggable": "^3.7",
54+
"srmklive/paypal": "^3.0",
55+
"stevebauman/location": "^7.2.0",
56+
"symfony/console": "^7.0",
57+
"symfony/http-kernel": "^7.0",
58+
"symfony/polyfill-intl-icu": "^1.22.1",
59+
"twilio/sdk": "^7.16",
60+
"vedmant/laravel-shortcodes": "^1.1"
61+
},
62+
"require-dev": {
63+
"mockery/mockery": "^1.6",
64+
"nunomaduro/collision": "^8.1",
65+
"orchestra/testbench": "^10.0",
66+
"phpstan/phpstan": "^1.10",
67+
"phpunit/phpunit": "^11.5"
68+
},
69+
"suggest": {
70+
"ext-intl": "Allows for more locales besides the default \"en\" when formatting money values.",
71+
"dompdf/dompdf": "Required when generating and downloading invoice PDF's using Dompdf (^2.0)."
72+
},
73+
"autoload": {
74+
"psr-4": {
75+
"Coderstm\\": "src/",
76+
"Coderstm\\Database\\Factories\\": "database/factories/",
77+
"Coderstm\\Database\\Seeders\\": "database/seeders/"
78+
},
79+
"files": [
80+
"lib/helpers.php"
81+
]
82+
},
83+
"autoload-dev": {
84+
"psr-4": {
85+
"Coderstm\\Tests\\": "tests/",
86+
"App\\": "workbench/app/",
87+
"Database\\Factories\\": "workbench/database/factories/",
88+
"Database\\Seeders\\": "workbench/database/seeders/"
89+
}
90+
},
91+
"extra": {
92+
"laravel": {
93+
"providers": [
94+
"Coderstm\\Providers\\ThemeServiceProvider",
95+
"Coderstm\\Providers\\CoderstmServiceProvider",
96+
"Coderstm\\Providers\\CoderstmPermissionsServiceProvider",
97+
"Coderstm\\Providers\\CoderstmEventServiceProvider",
98+
"Coderstm\\Providers\\ShortcodeServiceProvider"
99+
]
100+
}
101+
},
102+
"config": {
103+
"sort-packages": true
104+
},
105+
"minimum-stability": "dev",
106+
"prefer-stable": true,
107+
"scripts": {
108+
"post-autoload-dump": [
109+
"@clear",
110+
"@prepare"
111+
],
112+
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
113+
"prepare": "@php vendor/bin/testbench package:discover --ansi",
114+
"build": "@php vendor/bin/testbench workbench:build --ansi",
115+
"serve": [
116+
"Composer\\Config::disableProcessTimeout",
117+
"@build",
118+
"@php vendor/bin/testbench serve --ansi"
119+
],
120+
"lint": [
121+
"@php vendor/bin/phpstan analyse --verbose --ansi"
122+
],
123+
"test": [
124+
"@php vendor/bin/phpunit"
125+
]
126+
}
127+
}

0 commit comments

Comments
 (0)