Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the CodeIgniter security-related settings

Shulou Source: shulou.com Published: 2022-06-03 09:08:54 11月15日 Update

This article focuses on "what are the CodeIgniter security-related settings", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the CodeIgniter security-related settings"?

The CodeIgniter framework itself provides some security settings, such as protection against XSS and CSRF attacks, defense against SQL injection attacks and so on.

As far as the profile is concerned:

In application/config/config.php

$config ['encryption_key'] =''; / / this must be set to encrypt your own cookie, etc. $config ['cookie_secure'] = TRUE / / set to TRUE/* |-| Global XSS Filtering global XSS filtering is set to TRUE | -| | Determines whether the XSS filter is always active when GET | POST or | COOKIE data is encountered | * / $config ['global_xss_filtering'] = TRUE / / prevent csrf attacks $config ['csrf_protection'] = TRUE;$config [' csrf_token_name'] = 'mall_tooken';$config [' csrf_cookie_name'] = 'mall_cookie';$config [' csrf_expire'] = 7200 / set the appropriate time

Open system/core/Input.php

Set the $xss_clean in the get and post methods to true. Of course, if your site is secure, don't set it or explicitly set it when you call get or post to get the parameters.

You need to pay attention to:

1. Use

$this- > input- > get ('name', true)

Instead of using $_ GET ['name']

two。 Use

$this- > input- > post ('name', true)

Instead of using $_ POST ['name']

3. Use ActiveRecord query statements instead of statements such as select

At this point, I believe you have a deeper understanding of "what are the CodeIgniter security-related settings"? you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Security attack content method statement learning query practical deeper appropriate indifferent no global interest parameter practical practical simple operation file time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Linux Shulou Information Huawei OPPO Reno