This rule helps you prevent unauthorized access to your files. Granting too many permissions can expose your files to malicious activities such as unauthorized modifications, data theft, or even deletion.
The PHP chmod() function is used to change the permissions of a file. It takes two arguments: the file name and the permissions. Permissions are represented as octal numbers, where each digit represents different permissions for the owner, group, and others.
To adhere to this rule, avoid setting permissions higher than 0750. This means the owner can read, write, and execute the file, the group can read and execute, and others have no permissions. For example, chmod("test", 0750);. Be sure to only grant write permissions when necessary and restrict access for others as much as possible to ensure the security of your files.
Non-Compliant Code Examples
<?phpchmod("test",0770);
Compliant Code Examples
<?phpchmod("test",0750);
원활한 통합. Datadog Code Security를 경험해 보세요
Datadog Code Security
이 규칙을 사용해 Datadog Code Security로 코드를 분석하세요
규칙 사용 방법
1
2
rulesets:- php-security # Rules to enforce PHP security.
리포지토리 루트에 위의 내용을 포함하는 static-analysis.datadog.yml을 만듭니다
무료 IDE 플러그인을 사용하거나 CI 파이프라인에 Code Security 검사를 추가합니다