QBCore Frameworkqbcore.netCommunity docs
On this page

Updated 2026-10-02 ยท 4 min read

๐Ÿ”’ Security Best Practices

Review the actions a client can request and the authority required to perform them. A hidden button, an obscure event name, or a client-side check is not authorization. The Cfx.re event-security guide explains why server handlers must validate requests independently.

Security Overview

Separate three concerns: gameplay rules, staff permissions, and access to the host or database. A job grade may authorize a gameplay action; it does not automatically make that character a server administrator.

Security Framework

Start with safe server events and the server-authority checklist. Review the entire path from incoming request to persistent change, including dependency calls and failure handling.

OperationReview questions
Give an item or moneyWho is authorized? Does the server calculate the reward? Can the same request be replayed?
Charge a playerDoes the server own the price and validate the quantity? What happens when payment or delivery fails?
Use a job actionDoes the server check the current job, grade, duty state, and any required proximity?
Run a staff actionWhich explicit server-side permission authorizes it? Are both allowed and denied users tested?
Change a database rowAre parameters bound? Is the caller authorized to change that particular record?
Call a webhookIs the endpoint stored server-side? Are message size and request rate bounded?

Immediate Security Actions

Critical Security Checklist

Keep credentials out of shared scripts, client bundles, screenshots, and public logs. Review who can access txAdmin, the host, the database, and deployment systems. Remove permissions that are no longer needed and keep a tested backup separate from the running server.

Quick Hardening Steps

Do not paste a generic firewall or SSH script into a remote host. Before changing access rules, identify the actual management ports, confirm a working key-based login in a second session, and ensure that the provider's recovery console is available. Validate the configuration and test a new connection before closing the original session.

Restrict database access to the systems that need it. Test software and resource updates on staging, including any schema changes, before applying them to a live server.

Common Security Vulnerabilities

Resource-Level Vulnerabilities

Look for unchecked network-event arguments, client-selected prices or rewards, missing ownership checks, concatenated SQL, unrestricted file paths, and unbounded logging. Review the installed inventory resource's interface rather than assuming an item method belongs to qb-core.

Example Vulnerable Code

An authorization check such as player.PlayerData.job.name == 'admin' confuses character employment with staff access. Use an explicit server-side permission appropriate to the operation. Cfx.re documents ACE entries and principal inheritance; verify the resulting permissions with an allowed and a denied account.

Do not expose a network event that accepts a client-provided severity and then bans or kicks based on it. Treat client reports as untrusted input, not an authoritative security decision.

Security Architecture

Keep server-only operations server-only. Avoid adding network access to an internal event merely to make it easier to call. When reviewing a third-party resource, inspect its manifest, server scripts, external requests, permissions, and database changes before giving it access to production data.

Security Monitoring

Log decisions made by the server: the action, a bounded reason code, the result, and the relevant resource revision. Limit event volume and retention. Do not send arbitrary client tables directly to Discord or keep an ever-growing in-memory event list.

A rejected request is evidence of a rejected request, not by itself proof that a player should be banned. Preserve enough context for investigation without collecting secrets or unrelated player data.

Security Best Practices

Test unauthorized users, missing players, malformed payloads, repeated requests, and dependency failures. Verify that rejected requests leave money, items, and persistent state unchanged. For operations with several side effects, test recovery from failure between those effects.

This technical guide is not a privacy or legal-compliance assessment. Document what player data you collect, why you collect it, who can access it, and how it is removed. Get appropriate advice for obligations that apply to your operation rather than treating a security checklist as proof of compliance.

Security Tools and Resources

Safe server events provides a bounded example and a test matrix. Use resource debugging to reproduce failures, and support to report a documentation error with secrets removed.

Found an issue in this guide?

Send the page URL, the affected example, and a source or reproduction to the site maintainer. For a server or resource problem, use the support guide.

On this page

Leonida RP server website built with RPWebsite
RPWebsite

Advertisement ยท RPWebsite

Want a website for your server?

Launch a site with live player status, rules, and a join button in minutes.

Build your website