test: validate QWED Security v1.1 scanner across all engines#214
test: validate QWED Security v1.1 scanner across all engines#214Rahul Dass (rahuldass19) wants to merge 4 commits into
Conversation
Adds three files to exercise engine pipeline: - examples/qwed_security_test.py — tests pattern_scan, python_ast, taint_analysis, DEMO_CODE context - .qwed.yml — tests policy_config engine - examples/demo_widget.js — tests js_patterns engine with clean code
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe changes update QWED scanning configuration, add Python security demonstrations, and add a JavaScript ChangesSecurity example configuration
Widget display example
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Greptile SummaryThis PR adds fixtures for validating the QWED Security scanner pipeline. The main changes are:
Confidence Score: 5/5No additional blocking issue was found in this review.
Important Files Changed
Reviews (4): Last reviewed commit: "test: bump version for v1.4 re-check" | Re-trigger Greptile |
| treat_unknown_as_block: true | ||
| ignore_patterns_in_tests: true |
There was a problem hiding this comment.
⚠️ Security: New .qwed.yml disables pattern scanning in test files
ignore_patterns_in_tests: true instructs the security scanner to skip pattern-based scans for files considered tests. In a security-verification product this is a meaningful regression: secrets, dangerous sinks, or malicious code placed in any file matching a test path would evade detection. Note the accompanying test file is named qwed_security_test.py, which would fall under this exclusion. Recommend removing this key (or scoping it very narrowly) so scanning stays fail-closed for all paths.
Was this helpful? React with 👍 / 👎
| treat_unknown_as_block: true | ||
| ignore_patterns_in_tests: true |
There was a problem hiding this comment.
💡 Quality: Unknown config keys in .qwed.yml are not consumed by codebase
Neither treat_unknown_as_block nor ignore_patterns_in_tests appears anywhere in the repository's source (config loaders, validators, or models). As written these keys are silently ignored by this repo's code, so the file either has no effect here or is intended to be interpreted only by an external tool. Confirm the intended consumer and the exact schema; a typo'd or unrecognized key gives a false sense that a policy is in force when it is not.
Was this helpful? React with 👍 / 👎
| @@ -0,0 +1,2 @@ | |||
| treat_unknown_as_block: true | |||
| ignore_patterns_in_tests: true | |||
There was a problem hiding this comment.
Validation Fixture May Be Ignored
If test-file detection uses the *_test.py naming convention, this setting suppresses pattern findings for examples/qwed_security_test.py. The expected credential advisory would then never be produced, so the fixture would not validate the claimed pattern-scan behavior.
| @@ -0,0 +1,8 @@ | |||
| """Demonstrates QWED Security scanning capabilities.""" | |||
There was a problem hiding this comment.
Scanner Outcome Is Not Asserted
This file is outside the configured tests/ discovery path and contains no scanner invocation or expected-result assertion. A scanner regression can therefore leave CI green while this file produces no advisory, so the change does not provide automated validation of the stated engine behavior.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| def run_tainted(): | ||
| expression = input("Enter expression: ") | ||
| result = eval(expression) | ||
| print(f"Result: {result}") |
There was a problem hiding this comment.
🚨 Security: eval() on untrusted input() enables arbitrary code execution
run_tainted passes raw input() directly into eval(), allowing an attacker to execute arbitrary Python (e.g. __import__('os').system(...)). This is a real taint source→sink code-injection path, contradicting the PR description's claim of "no dangerous sinks". Replace eval with a safe parser such as ast.literal_eval, or validate/whitelist the input before evaluation.
Use ast.literal_eval to safely evaluate literals instead of executing arbitrary code.:
import ast
def run_tainted():
expression = input("Enter expression: ")
result = ast.literal_eval(expression)
print(f"Result: {result}")
- Apply fix
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎
|
|
||
| def run_tainted(): | ||
| expression = input("Enter expression: ") | ||
| result = eval(expression) |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@examples/qwed_security_test.py`:
- Line 3: Replace the credential-shaped API_KEY value in the test fixture with a
clearly non-credential marker, or move the scenario into a dedicated scanner
fixture with an explicit test contract. Preserve deterministic, fail-closed
global scanning and do not weaken its enforcement.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 05ec5fb9-faa4-4bb1-bb0b-d80dc73e3d58
📒 Files selected for processing (3)
.qwed.ymlexamples/demo_widget.jsexamples/qwed_security_test.py
| @@ -0,0 +1,14 @@ | |||
| """Demonstrates QWED Security v1.2 scanning capabilities.""" | |||
|
|
|||
| API_KEY = "QWED_TEST_DEMO_VALUE" | |||
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Remove the credential-shaped test constant.
Line 3 is classified as hardcoded credential-like material, and the QWED pipeline blocks it rather than emitting the expected advisory. Use a clearly non-credential test marker or move this case into a dedicated scanner fixture with an explicit test contract; do not weaken global scanning.
As per path instructions, enforcement must remain deterministic and fail-closed.
🧰 Tools
🪛 GitHub Check: QWED Security
[error] 3-3: QWED Blocked finding: Hardcoded credential-like material detected (context: TEST_CODE).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@examples/qwed_security_test.py` at line 3, Replace the credential-shaped
API_KEY value in the test fixture with a clearly non-credential marker, or move
the scenario into a dedicated scanner fixture with an explicit test contract.
Preserve deterministic, fail-closed global scanning and do not weaken its
enforcement.
Sources: Path instructions, Linters/SAST tools, Pipeline failures
|
Code Review 🚫 Blocked 0 resolved / 3 findingsAdds validation test files for QWED Security v1.1, but includes a critical vulnerability where 🚨 Security: eval() on untrusted input() enables arbitrary code execution📄 examples/qwed_security_test.py:11-14
Use ast.literal_eval to safely evaluate literals instead of executing arbitrary code.
|
| Auto-apply | Compact |
|
|
Important
Your trial ends in 4 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.
Was this helpful? React with 👍 / 👎 | Gitar
|
This PR is a living validation fixture for QWED Security. It exists to:
Known findings that are intentional:
No real credentials, no production code, no merge intended. This PR stays open/draft as a permanent smoke test for QWED Security. |



This PR adds three test files to exercise QWED Security's v1.1 engine pipeline. All content is intentionally benign — no real credentials, no dangerous sinks, no bypass techniques.
examples/qwed_security_test.pyAPI_KEYname triggers credential scan, butDEMO_CODEcontext +QWED_TEST_DEMO_VALUEmarker should downgrade to WARNING.qwed.ymlexamples/demo_widget.jsThis is purely a validation PR. No real vulnerabilities are introduced, no bypass information is exposed. The test credential (
QWED_TEST_DEMO_VALUE) contains an explicitDEMOmarker — it will never be mistaken for a real secret even if the file were moved outsideexamples/.Security note on your question: This PR does not give attackers any way to bypass QWED Security. All patterns shown are either:
No bypass techniques, no edge-case exploits, no suppression mechanics, and no config loopholes are demonstrated.
QWED Security GitHub App
Summary by Gitar
run_taintedfunction inexamples/qwed_security_test.pyto test taint analysis sinks.eval()usage as a controlled taint sink for v1.2 engine validation.This will update automatically on new commits.
Summary by CodeRabbit