Download the PHP package mnb/mnb-secure-core without Composer
On this page you can find all versions of the php package mnb/mnb-secure-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mnb/mnb-secure-core
More information about mnb/mnb-secure-core
Files in mnb/mnb-secure-core
Package mnb-secure-core
Short Description mnb-secure-core reusable no-framework PHP security core for custom applications.
License MIT
Informations about the package mnb-secure-core
MNB Secure Core
Package: mnb/mnb-secure-core
Version: v1.0.1
Type: reusable no-framework PHP security library
PHP: 8.1+
License: MIT
Author: Nagendra babu Macharla (www.linkedin.com/in/nagendra-babu-macharla-55b703152)
MNB Secure Core is a reusable PHP security foundation for custom applications that do not depend on a framework. It is designed for admin panels, APIs, school/ERP systems, CRM tools, billing platforms, file tools, reporting dashboards, and other PHP applications that need production-grade security building blocks without adopting Laravel/Symfony/Slim as a hard dependency.
The current v1.0.1 release line includes request security, authentication, authorization, data protection, file safety, database governance, runtime command safety, outbound network/SSRF protection, security verification, safe errors, memory safety, throughput/capacity governance, origin protection, async queues, token/session control, XSS enforcement, and final production readiness tooling.
Why use MNB Secure Core
MNB Secure Core helps PHP teams add serious application security without rebuilding the same controls again and again for every project. The library is especially useful for no-framework apps, shared-hosting projects, custom admin panels, API backends, ERP/CRM systems, education platforms, file tools, and internal business applications.
Key advantages:
| Advantage | Benefit |
|---|---|
| No-framework design | Works with plain PHP projects and can also be integrated into existing frameworks. |
| Central security kernel | Gives one consistent entry point for request, auth, database, files, logs, queues, sessions, and production checks. |
| Security-by-policy approach | High-risk actions such as SQL, schema changes, command execution, outbound HTTP, queues, and sessions are controlled by explicit policies. |
| Faster secure development | Reduces the need to manually build CSRF, rate limits, data masking, upload validation, audit logs, safe errors, token revocation, and production checks. |
| Safer production defaults | Encourages deny-by-default behavior, allow-lists, secret redaction, private storage, safe headers, and release-gate checks. |
| Tenant and role awareness | Helps protect multi-tenant systems by connecting trust zones, authorization, database policies, cache keys, files, sessions, and audit events. |
| Full lifecycle protection | Covers incoming requests, business operations, background jobs, outbound integrations, runtime execution, monitoring, verification, and release readiness. |
| Built-in diagnostics | Provides CLI checks, demos, vulnerability reports, readiness checks, coverage reports, and release build planning. |
| Safer logs and evidence | Keeps frontend responses clean while preserving redacted technical logs, audit records, pentest evidence, and incident response context. |
| Composer installation | Installs cleanly from Packagist with composer require mnb/mnb-secure-core. |
For more detailed feature documentation and code examples, refer to the
docs/directory. For runnable usage samples, refer to theexamples/anddemos/directories.
Current release status
Latest local validation from the current v1.0.1 upgrade line:
| Check | Result |
|---|---|
| PHP lint | Passed |
| Test suite | 398 passed, 0 failed |
| Demo suite | Passed |
| Config validation | Passed |
| Vulnerability score | 99.05 |
| Vulnerability grade | A+ |
Production
doctor/readiness results still depend on your real.env, secrets, HTTPS, CDN/proxy, storage paths, database user, and deployment firewall settings.
What this package protects
MNB Secure Core is organized as security engines. Each engine can be used independently, or through Mnb\SecurityCore\Core\SecurityKernel.
| Area | Main protection |
|---|---|
| Trust zones | Request, tenant, user, role, data-class, and resource boundary checks |
| Request receiving | Trusted hosts/proxies, HTTPS, request size, method/content checks, JSON parsing, suspicious request detection |
| Authentication | Bearer/API/session/webhook/internal authentication strategies |
| Authorization | Permissions, scopes, roles, ownership, tenant isolation, field-level filtering |
| Data protection | Encryption, masking, search hashes, redaction, export protection |
| Web security | Escaping, HTML sanitization, CSP/security headers, safe redirects, signed URLs, secure cookies |
| API/rate limiting | Token scopes, rate policies, abuse throttling |
| File security | Upload validation, private storage, malware scanner hooks, protected downloads, retention cleanup |
| Cache strategy | Tenant-aware keys, TTLs, encryption for sensitive cache policies, invalidation, stampede guard |
| Secrets | .env loading, secret inventory, redaction, scanning, rotation reports |
| Logging/audit/monitoring | JSONL logs, tamper-evident audit, metrics, alerts, retention |
| Backup/recovery/incident | Encrypted/signed backups, restore dry-runs, playbooks, evidence collection |
| Vulnerability matrix | OWASP/CWE-style vulnerability coverage mapping, gaps, recommendations |
| Database governance | Policy-based CRUD/search/alter, tenant scoping, query limits, schema plans, result masking |
| Runtime/network | Safe process runner, command allow-listing, outbound HTTP guard, SSRF/DNS/redirect protections |
| Verification/remediation | Pentest checklist, evidence bundles, SLA plans, retest gates, release gates |
| Safe errors | Safe public responses, hidden technical logs, problem+JSON, log redaction, error fingerprinting |
| Memory/resource safety | Operation memory profiles, stream guards, bounded buffers, temp file budgets, worker leak checks |
| Throughput/capacity | Latency budgets, concurrency limiting, adaptive throttling, queue pressure, SLO and capacity gates |
| Origin protection | Direct IP Host blocking, trusted proxy validation, fingerprint stripping, leak scanning, firewall guidance |
| Queue/background jobs | Async dispatch, 202 responses, idempotency, retries, dead-letter queue, worker supervision |
| Token/session control | Token revocation, refresh rotation, session registry, forced logout, remember-me safety |
| Final readiness/XSS | Safe template rendering, unsafe output scan, production checklist, release build planning |
Requirements
Required:
- PHP 8.1 or higher
opensslfileinfojsonpdo- Writable private storage outside the public web root
Recommended/optional:
zipfor ZIP backup/archive workflowsredisfor distributed cache, rate limiting, tokens, and queues- ClamAV for production malware scanning
- HTTPS in production
- CDN/reverse proxy + firewall when origin IP hiding is required
Check your PHP environment:
Installation
Option A: direct library placement
Recommended for no-framework apps and shared hosting:
Bootstrap:
Option B: Composer / Packagist
Install from Packagist:
Composer bootstrap:
For local path development only:
First setup
Copy config and environment files. For Composer installs, the package lives under vendor/mnb/mnb-secure-core:
For direct library placement, use:
Create private storage:
Generate keys and validate:
For direct library placement, replace vendor/mnb/mnb-secure-core with libraries/mnb-secure-core.
Recommended production .env values:
Never commit real .env secrets.
Recommended middleware order
Use this general order for web/API entrypoints:
For easier setup, use the Secure Request Receiving profiles:
Common profiles include:
Common usage patterns
API token and rate limit
CSRF for browser forms
Authorization and tenant safety
Data protection
Secure database search
File upload and protected download
Runtime command safety and outbound SSRF protection
Safe errors
Public responses stay clean while technical details go to hidden, redacted logs with request IDs.
XSS-safe rendering
Use TemplateSafeValue only for content that was explicitly sanitized or generated by trusted code.
Async queue dispatch
Token revocation and session control
CLI reference
Run commands from the package root, or prefix with the library path from your app.
Core
Vulnerability matrix
Database
Runtime and outbound network
Verification and release gates
Errors
Memory/resources
Throughput/capacity
Origin protection
Queue/background jobs
Token/session
Final readiness and XSS
Demos
Run all demos:
Run the browser demo:
Open:
Important demo files:
| Demo | File |
|---|---|
| Vulnerability Matrix | demos/13-vulnerability-blocking-matrix.php |
| Secure Database | demos/14-secure-database-connect-retrieval-update-delete-search-alter.php |
| Pentest / Verification | demos/15-penetration-testing-security-verification.php |
| Safe Errors | demos/16-error-handling-custom-errors-logs-hidden-frontend.php |
| Memory Safety | demos/17-memory-management-resource-safety.php |
| Throughput Capacity | demos/18-throughput-performance-capacity-management.php |
| Secure Request Strategy | demos/20-secure-request-receiving-strategy.php |
| Runtime / Outbound Network | demos/31-runtime-execution-outbound-network-security-engine.php |
| Database Governance | demos/32-secure-database-governance-query-lifecycle-engine.php |
| Verification / Remediation | demos/33-security-verification-remediation-evidence-automation-engine.php |
| Safe Error / Technical Logs | demos/34-safe-error-response-technical-log-isolation-engine.php |
| Memory Governance | demos/35-memory-governance-resource-safety-engine.php |
| Throughput Governance | demos/36-throughput-governance-performance-capacity-engine.php |
| Origin Protection | demos/37-origin-identity-protection-exposure-hardening-engine.php |
| Queue / Background Jobs | demos/38-async-request-response-queue-background-job-engine.php |
| Token / Session Control | demos/39-token-revocation-session-control-engine.php |
| Final Readiness / XSS / Release | demos/40-final-production-readiness-xss-release-consolidation-patch.php |
v1.0.1 upgrade consolidation
This release line keeps all upgrades under v1.0.1.
| Upgrade | Engine |
|---|---|
| 27 | Runtime Execution and Outbound Network Security Engine |
| 28 | Secure Database Governance and Query Lifecycle Engine |
| 29 | Security Verification, Remediation, and Evidence Automation Engine |
| 30 | Safe Error Response and Technical Log Isolation Engine |
| 31 | Memory Governance and Resource Safety Engine |
| 32 | Throughput Governance and Performance Capacity Engine |
| 33 | Origin Identity Protection and Exposure Hardening Engine |
| 34 | Async Request, Response Queue, and Background Job Orchestration Engine |
| 35 | Token Revocation and Session Control Engine |
| 36 | Final Production Readiness, XSS Enforcement, and Release Consolidation Patch |
Patch ZIPs from upgrades 29–36 are intended to be applied in order. For public distribution, create one clean merged release archive instead of shipping many patch ZIPs.
Production checklist
Before deployment, confirm:
APP_ENV=productionAPP_DEBUG=false- HTTPS enabled
- HSTS enabled only after HTTPS is stable
- Trusted hosts configured
- Trusted proxies configured when behind a proxy/CDN
- Direct IP Host requests blocked
- CDN/reverse proxy enabled when origin hiding is required
- Firewall allows HTTP/HTTPS only from trusted proxy/CDN ranges
- Real app, encryption, search hash, signed URL, JWT/token, and webhook secrets configured
- Production
.envis not committed - Private storage outside public root
- Logs, audit files, backups, queue files, and token/session stores outside public root
- Upload execution disabled
- Database user has least privilege
- Public errors hide technical details
- Logs redact secrets, tokens, cookies, and private paths
- XSS output escaping is used in templates
- CSP/security headers configured
- Rate limits enabled
- Audit logging enabled
- Backup and restore tested
- Queue workers supervised
- Token/session revocation hooks connected to password/role/permission/account status changes
- Security verification/retest completed
php bin/mnb-secure final:gatepasses
What PHP code cannot solve alone
Some controls require deployment configuration:
- Full origin IP hiding requires CDN/reverse proxy plus firewall rules.
- HSTS requires working HTTPS.
- Webhook spoofing prevention requires a real shared webhook secret.
- Session/token revocation after role/password changes requires the host app to call the revocation hooks.
- XSS protection requires all templates/views to escape output or use safe renderers.
- Queue durability at scale requires a production-grade queue backend such as Redis/SQS/RabbitMQ or a properly migrated database queue.
Release archive hygiene
Do not ship development/runtime data in public releases.
Exclude:
Keep placeholder .gitkeep files where needed.
A clean release can be created with Git:
Or use the release planning commands:
Public package safety note
MNB Secure Core provides reusable security building blocks. It does not automatically make an application secure unless the application integrates the controls correctly, configures production settings safely, and tests the final deployment.
Use the included demos, CLI diagnostics, release gates, and vulnerability matrix as proof-oriented safety tools, not as a substitute for secure application design, code review, and authorized penetration testing.
Security reporting
Report vulnerabilities privately using SECURITY.md. Do not disclose exploitable details in public GitHub issues.
All versions of mnb-secure-core with dependencies
ext-openssl Version *
ext-fileinfo Version *
ext-json Version *
ext-pdo Version *