Skip to content

add secure coding AI review guides#5572

Open
Copilot wants to merge 34 commits into
mainfrom
copilot/create-ai-review-guide-wled
Open

add secure coding AI review guides#5572
Copilot wants to merge 34 commits into
mainfrom
copilot/create-ai-review-guide-wled

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

this PR is adding security-aware review checklists (for coderabbit PR reviews) that should be relevant for WLED.
The lists are based on the OWASP "top 10" from https://github.com/github/awesome-copilot/blob/main/instructions/security-and-owasp.instructions.md, and on lessons learned from past reviews.


This PR now includes:

  • corrected docs filename spelling to match existing docs/*.instructions.md naming pattern:
    • docs/securecode.instructions.md
    • docs/secure-short.instructions.md
  • follow-up adjustments to both guides based on review feedback, including:
    • explicit WLED threat-model assumptions (typical firewall/DMZ/VPN deployment)
    • removal of any mandatory TLS/HTTPS baseline expectation
    • clarification that protocol-defined unauthenticated UDP multicast/broadcast paths should not be flagged solely for lacking auth
    • OTA integrity guidance framed as checksum/hash/signature verification without requiring TLS
    • wording consistency and clarity improvements across both files
  • additional verification against the suggested rule set from issuecomment-4393037994, with missing coverage added to docs/securecode.instructions.md, including concrete pattern guidance for:
    • UDP packet bounds and protocol range clamping
    • explicit JSON parse-error handling patterns
    • OTA integrity checks in Update.* paths
    • FreeRTOS stack/recursion safety checks
    • mDNS/hostname sanitization constraints
    • outbound URL validation (without HTTPS requirement)
    • optional unicast UDP source filtering (advisory)
    • CSRF Origin/Referer advisory checks for non-internet-exposed deployments
    • credential exposure checks in API/config serialization
    • security-event logging coverage
    • workflow action pinning and permission hardening specifics

Summary by CodeRabbit

  • Documentation
    • Added security review guidelines and a 24-rule checklist covering critical security areas including buffer safety, input validation, authentication, secure defaults, and protection against common vulnerabilities.
    • Refined rule wording and priorities to better fit WLED’s technical constraints and realistic deployment model.

Summary by CodeRabbit

  • Documentation

    • Added WLED-focused security and hardening guides: severity-prioritized checklists, low-noise reviewer workflow, AI-review guidance, firmware and Web UI security rules, secrets/logging standards, and CI/CD/supply-chain recommendations; updated agent guidance to reference the new security material.
  • Chores

    • Expanded automated review configuration to cover firmware, Web UI, and usermods; refined trust-boundary/ingress rules and added path-scoped secret-scanning rules with explicit flagging and exemptions.

Review Change Stack

Agent-Logs-Url: https://github.com/wled/WLED/sessions/82b5d757-7791-4aa3-8f77-96b25e52b6d5

Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
Agent-Logs-Url: https://github.com/wled/WLED/sessions/dc60e89a-6f5e-4441-8b4d-a70d61c1bf5c

Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
@softhack007 softhack007 changed the title Add WLED secure coding AI review instruction guides WIP (experiment DO NOT MERGE) Add WLED secure coding AI review instruction guides May 6, 2026
@softhack007

This comment was marked as outdated.

@coderabbitai

This comment was marked as outdated.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7488c845-9490-42a8-9268-f097b29dfc04

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)

Walkthrough

Adds two WLED security guidance documents (hardening + securecode) and updates .coderabbit.yaml to reference them, applying path-scoped security rules for firmware, WebUI, and usermods plus secrets/supply-chain scanning.

Changes

Security Review Standards and CodeRabbit Configuration

Layer / File(s) Summary
Hardening Rules, Trust-Boundary Model, and Output Format
docs/hardening.instructions.md
Hardening instructions establish WLED threat-boundary ingress model, define CRITICAL and IMPORTANT hardening rules for firmware/WebUI/memory/auth/logging/workflow, and specify standardized reviewer output format requiring severity, exact file/line, and concrete fix direction.
Comprehensive Threat-Model Assumptions and Security Checklists
docs/securecode.instructions.md
Securecode instructions add WLED-specific threat-model constraints and trust-boundary definitions, then provide categorized checklists: FW1–FW14 for firmware memory/validation/auth/OTA/FreeRTOS issues; WEB1–WEB7 for WebUI XSS/dynamic-code/postMessage/navigation; SEC1–SEC6 for secrets/logging; SC1–SC3 for supply-chain/CI; plus consolidated reviewer and AI behavior guidance.
CodeRabbit Path-Scoped Review Rules and Secrets Scanning Configuration
.coderabbit.yaml
Updates references to the new docs, adds path-scoped review rules for firmware (wled00/**/*.{cpp,h,hpp,ino}), WebUI assets (wled00/data/**), and usermods (usermods/**/*.{cpp,h,hpp}), removes an obsolete disabled comment, and introduces secrets/sensitive-info scanning rules and exclusions for templates/placeholders.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • wled/WLED#5480: Both PRs modify .coderabbit.yaml to rework CodeRabbit reviews.path_instructions for firmware/WebUI/usermods; related guidance updates overlap.

Suggested reviewers

  • netmindz
  • DedeHai
  • willmmiles
  • Aircoookie
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title 'add secure coding AI review guides' clearly and accurately summarizes the main change: adding three new documentation files (securecode.instructions.md, hardening.instructions.md) and updating .coderabbit.yaml to configure AI-assisted security review guidance for the WLED project.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added enhancement discussion AI Partly generated by an AI. Make sure that the contributor fully understands the code! labels May 6, 2026
coderabbitai[bot]

This comment was marked as resolved.

Comment thread docs/securecode.instructions.md Outdated
@softhack007

This comment was marked as resolved.

@coderabbitai

This comment was marked as outdated.

@softhack007

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@softhack007

This comment was marked as outdated.

Copilot AI and others added 2 commits May 7, 2026 00:05
Agent-Logs-Url: https://github.com/wled/WLED/sessions/73d38e00-6610-47e7-a7de-4a926fe0cc68

Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
Agent-Logs-Url: https://github.com/wled/WLED/sessions/73d38e00-6610-47e7-a7de-4a926fe0cc68

Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>

This comment was marked as outdated.

Copilot AI requested a review from softhack007 May 7, 2026 00:06
@softhack007 softhack007 requested a review from Aircoookie May 24, 2026 17:04
* require access to /edit for uploading
* JSON validation improvements are tracked in #5484 / #5482.
coderabbitai[bot]

This comment was marked as resolved.

avoid false-flag alerts from other security scanners
@softhack007

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

config-derived => ingress-derived
* strlcmp does not exist in the C standard library, nor in POSIX
* Backtick artifacts in .coderabbit.yaml YAML strings
coderabbitai[bot]

This comment was marked as resolved.

Avoid credential-shaped URL examples that possibly retrigger secret scanners.
coderabbitai[bot]

This comment was marked as resolved.

AI asked for clearer wording, so we clarify wording.
@softhack007 softhack007 changed the title add secure coding AI review instruction guides add secure coding AI review guides May 24, 2026
@softhack007 softhack007 removed the AI Partly generated by an AI. Make sure that the contributor fully understands the code! label May 25, 2026
@coderabbitai coderabbitai Bot added the AI Partly generated by an AI. Make sure that the contributor fully understands the code! label May 25, 2026
Rules are applied when source buffer or copy size are derived from untrusted values.
Add guidance for handling trusted internal values in FW1.
@softhack007

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Comment thread docs/securecode.instructions.md
Comment thread docs/securecode.instructions.md Outdated
coderabbitai[bot]

This comment was marked as resolved.

softhack007 and others added 2 commits May 26, 2026 11:40
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Partly generated by an AI. Make sure that the contributor fully understands the code! discussion enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants