Skip to content

Commit 1ee9dd7

Browse files
committed
Update FAQs.
1 parent e19798e commit 1ee9dd7

File tree

1 file changed

+12
-45
lines changed

1 file changed

+12
-45
lines changed

FAQ.txt

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,81 +5,48 @@ A: The linter requires PHP 7.4 or 8.3.
55

66
Q: How do I exclude files from scanning?
77
A: Use the --exclude option with comma-separated paths:
8-
--exclude=vendor,tests,config.php
8+
--exclude storage,tests,config.php
9+
10+
Q: How do I exclude specific security rules?
11+
A: You can exclude specific rules by using the --exclude-rules option in the CLI, followed by a comma-separated list of rule IDs:
12+
--exclude-rules CIS-003,OWASP-002
13+
14+
Q: Which directories are excluded by default?
15+
A: These: vendor,.git,.github,.gitlab,.azure-pipelines,.husky,.circleci,.vscode,.idea,
916

1017
Q: Can I use this in CI pipelines?
1118
A: Yes, the JSON output format (--format=json) works well for CI integration.
1219

13-
Q: How do I add custom rules?
14-
A: Create a php-security-config.json file with your custom rules pattern.
15-
16-
Q: Why isn't it detecting vulnerability X?
20+
Q: Why isn't it detecting vulnerability X? or how do I contribute new rules?
1721
A: Check if the rule exists in our documentation. You can submit new rule requests via Issues section.
1822

1923
Q: How do I update the ruleset?
20-
A: Update to the latest version via Composer:
24+
A: Update to the latest version of package via Composer:
2125
composer update yousha/php-security-linter
2226

2327
Q: Can I scan single files?
2428
A: Yes, provide the file path instead of directory:
25-
--path=src/file.php
29+
--path src/file.php
2630

2731
Q: How do I interpret the severity levels?
2832
* Critical: Immediate security risk
2933
* High: Significant vulnerability
3034
* Medium: Security best practice violation
3135
* Low: Informational notice
3236

33-
Q: Where can I see all available rules?
34-
A: Run with --verbose flag or check the RULES.md documentation.
35-
36-
Q: How do I contribute new rules?
37-
A: Fork the repository and submit a PR with your rule additions to the appropriate ruleset file.
38-
39-
Q: Why does it flag my vendor dependencies?
40-
A: Either exclude the vendor directory (--exclude=vendor) or update vulnerable dependencies.
41-
42-
Q: Can I disable specific rules?
43-
A: Yes, via configuration file by listing rule IDs to exclude.
44-
45-
Q: How can I create custom rule sets for my project's specific needs?
46-
A: Extend the built-in rules by adding a php-security-custom-rules.json file in your project root with patterns like:
47-
{
48-
"CUSTOM-001": {
49-
"pattern": "/\\bmy_unsafe_function\\s*\\(/i",
50-
"message": "Custom unsafe function detected",
51-
"severity": "high"
52-
}
53-
}
54-
5537
Q: Can I integrate this with PHPStan or Psalm for combined analysis?
5638
A: Yes, chain it in your CI pipeline after static analysis tools. For direct integration, use the JSON output as input for custom rules in those tools.
5739

5840
Q: How do I handle false positives?
5941
A: Three approaches:
6042
* Exclude files via --exclude
61-
* Disable specific rules in config:
62-
{"disabledRules": ["OWASP-123", "CIS-456"]}
43+
* Disable specific rules via --exclude-rules
6344

6445
Q: What's the performance impact for large codebases?
6546
A: Benchmarks show:
6647
~50ms per 1,000 lines of code
6748
2-3x faster with OPcache enabled
68-
Use --exclude=vendor,node_modules for best performance
6949

7050
Q: How can I export results to a security dashboard?
7151
A: Pipe JSON output to your monitoring system:
7252
php php-sl.php --format=json | jq '.results' > security-report.json
73-
74-
Q: How does the linter handle obfuscated or dynamically generated code?
75-
A: The static analyzer:
76-
* Detects common obfuscation patterns
77-
* Flags eval()/create_function() usage
78-
* But cannot analyze runtime-generated strings executed as code
79-
80-
Q: How are severity levels determined?
81-
A: Based on:
82-
* OWASP/CIS severity guidelines
83-
* Exploit probability
84-
* Impact scoring (CVSS-like)
85-
* Manual security team review

0 commit comments

Comments
 (0)