fix(compliance-audit): handle boolean false in settings checks#133
fix(compliance-audit): handle boolean false in settings checks#133
Conversation
The jq alternative operator (//) treats boolean false as falsy, causing settings like has_wiki: false to be reported as null instead of false. This means the has_wiki check (and any other boolean-false check) always fires even when the repository setting is correctly set to false. Fix: use '| tostring' with an explicit null guard instead of //. Closes petry-projects/bmad-bgreat-suite#89
|
@don-petry please review and merge — this fixes the false-positive compliance finding for |
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 26 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
There was a problem hiding this comment.
Pull request overview
Fixes false-positive findings in the compliance audit’s repository settings checks by ensuring jq distinguishes between null and boolean false when extracting settings values.
Changes:
- Replace
jq’s// "null"fallback with an explicitnullguard plustostring, sofalseis preserved as"false"instead of being treated like missing data.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Merge PR #133 from main (same jq boolean fix) - Apply printf instead of echo for JSON piping (safer) - Use jq --arg for key interpolation (prevents injection) Agent-Logs-Url: https://github.com/petry-projects/.github/sessions/bc09d7ce-9add-488c-a416-223d826cc900 Co-authored-by: don-petry <36422719+don-petry@users.noreply.github.com>



Summary
The jq alternative operator (
//) treats booleanfalseas falsy, sojq -r '.$key // "null"'returns"null"when the setting value isfalse. This causes any boolean-false check (e.g.has_wiki: false) to always fire as a finding, even when the repository setting is correctly set.Before:
actual=$(echo "$settings" | jq -r ".$key // \"null\"")After:
actual=$(echo "$settings" | jq -r ".$key | if . == null then \"null\" else tostring end")This uses an explicit null guard and
tostringconversion, so booleanfalse→"false"and booleantrue→"true", whilenullstill maps to"null".Impact
has_wiki: falseno longer generates a false-positive finding for repos that already have wiki disabledexpected: falsechecks will work correctly)Test plan
bmad-bgreat-suiteshould no longer reporthas_wikias a finding since its wiki is already disabledCloses petry-projects/bmad-bgreat-suite#89
Generated with Claude Code