Skip to content

Claude/secure defaults ci linting e9h53#11

Merged
hyperpolymath merged 3 commits into
mainfrom
claude/secure-defaults-ci-linting-e9h53
Dec 27, 2025
Merged

Claude/secure defaults ci linting e9h53#11
hyperpolymath merged 3 commits into
mainfrom
claude/secure-defaults-ci-linting-e9h53

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

No description provided.

claude and others added 3 commits December 27, 2025 14:18
- Add SECURE_DEFAULTS.md with comprehensive security checklist covering:
  - PHP configuration best practices
  - Input validation patterns with php-aegis Validator
  - Output sanitization with php-aegis Sanitizer
  - HTTP security headers configuration
  - Authentication, database, file, and crypto guidelines
  - CI/CD and dependency management practices

- Add phpstan.neon with maximum strictness (level 9)
  - Enable all strict type checks
  - Check for implicit mixed types
  - Report maybes in method signatures

- Add .php-cs-fixer.dist.php with PSR-12 and security rules
  - Enforce strict_types declaration
  - Enable strict comparisons
  - Warn on eval() usage
  - Migrate to secure random functions

- Add php-lint.yml CI workflow with comprehensive checks:
  - PHP syntax validation
  - PHP-CS-Fixer code style enforcement
  - PHPStan level 9 static analysis
  - SPDX license header verification
  - strict_types declaration check
  - Security pattern detection (dangerous functions, weak crypto)
  - Composer dependency audit
  - PHP 8.1-8.4 compatibility matrix

- Update .gitignore for PHP tooling cache files
OWASP Mapping:
- Add detailed OWASP Top 10 2021 mapping section to SECURE_DEFAULTS.md
- Document php-aegis coverage for each vulnerability category:
  - A01: Broken Access Control (Headers)
  - A02: Cryptographic Failures (Validator, Headers)
  - A03: Injection (Validator, Sanitizer, TurtleEscaper)
  - A05: Security Misconfiguration (Headers)
  - A10: SSRF (Validator)
- Include code examples and checklists for each category
- Add OWASP coverage summary matrix

Test Suite:
- Add ValidatorTest with 100+ test cases for:
  - Email, URL, HTTPS URL validation
  - IP address (v4, v6) validation
  - UUID, slug, domain, hostname validation
  - Null byte and safe filename checks
  - JSON, integer, semver, ISO 8601, hex color validation

- Add SanitizerTest with XSS prevention tests:
  - HTML, attribute, JavaScript, CSS, URL escaping
  - Common XSS attack vector prevention
  - Null byte removal and filename sanitization

- Add HeadersTest with security header validation:
  - Frame options, CSP, HSTS, referrer policy
  - Cross-origin policies (COEP, COOP, CORP)
  - Permissions policy configuration

- Add TurtleEscaperTest for RDF injection prevention:
  - String and IRI escaping per W3C Turtle spec
  - Language tag validation (BCP 47)
  - Literal and triple building
  - Injection attack prevention

CI Updates:
- Add PHPUnit test job with xdebug coverage
- Add coverage threshold checking (70% warning)
- Add phpunit.xml configuration
- Update workflow summary to include test results
@hyperpolymath
hyperpolymath merged commit 2b42050 into main Dec 27, 2025
13 of 16 checks passed
@hyperpolymath
hyperpolymath deleted the claude/secure-defaults-ci-linting-e9h53 branch December 27, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants