-
Notifications
You must be signed in to change notification settings - Fork 6
[test] PR #668 scenario B — bot-only CR (should be ignored) #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Test scenario B: bot-only CR should not trigger stale pipeline. | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,35 @@ | ||||||||||||
| """Intentionally bad code for bot reviewers to flag.""" | ||||||||||||
|
|
||||||||||||
| import os | ||||||||||||
| import subprocess | ||||||||||||
|
|
||||||||||||
| # Hardcoded credentials — should trigger a security flag. | ||||||||||||
| API_KEY = "sk_live_4242424242424242" | ||||||||||||
| DATABASE_PASSWORD = "admin123" | ||||||||||||
|
Comment on lines
+6
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove committed secrets from source control. This adds a Stripe-like live key and a plaintext database password to the repository. Move both to injected runtime configuration, and if either value was ever real, rotate it immediately. 🔐 Minimal fix-# Hardcoded credentials — should trigger a security flag.
-API_KEY = "sk_live_4242424242424242"
-DATABASE_PASSWORD = "admin123"
+# Inject secrets at runtime instead of committing them.
+API_KEY = os.environ["API_KEY"]
+DATABASE_PASSWORD = os.environ["DATABASE_PASSWORD"]🧰 Tools🪛 Betterleaks (1.2.0)[high] 7-7: Found a Stripe Access Token, posing a risk to payment processing services and sensitive financial data. (stripe-access-token) 🤖 Prompt for AI Agents |
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def run_user_command(user_input): | ||||||||||||
| # Command injection — passing user input to shell with shell=True. | ||||||||||||
| return subprocess.check_output(user_input, shell=True) | ||||||||||||
|
Comment on lines
+11
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not execute raw user input via a shell. Passing untrusted input to 🛡️ Safer shape+ALLOWED_COMMANDS = {
+ "list_tmp": ["ls", "/tmp"],
+}
+
-def run_user_command(user_input):
- # Command injection — passing user input to shell with shell=True.
- return subprocess.check_output(user_input, shell=True)
+def run_user_command(command_name):
+ return subprocess.check_output(ALLOWED_COMMANDS[command_name], shell=False)🤖 Prompt for AI Agents |
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def fetch_user(user_id): | ||||||||||||
| # SQL injection — string concatenation into a query. | ||||||||||||
| query = "SELECT * FROM users WHERE id = " + str(user_id) | ||||||||||||
| return query | ||||||||||||
|
Comment on lines
+16
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stop building tainted SQL strings. Any caller that executes this returned query inherits SQL injection. Keep user data out of the SQL text and use bound parameters through the database driver instead of concatenation. 🤖 Prompt for AI Agents |
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def parse_config(data): | ||||||||||||
| # eval on untrusted input. | ||||||||||||
| return eval(data) | ||||||||||||
|
Comment on lines
+22
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace
Also applies to: 34-35 🤖 Prompt for AI Agents |
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def bare_except(): | ||||||||||||
| try: | ||||||||||||
| os.remove("/etc/passwd") | ||||||||||||
| except: | ||||||||||||
| pass | ||||||||||||
|
Comment on lines
+27
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete the destructive This helper attempts to remove a system file and then suppresses every failure. If it ever runs with elevated privileges, it can damage the host while hiding the incident from logs and callers. 🧹 Simplest fix-def bare_except():
- try:
- os.remove("/etc/passwd")
- except:
- pass📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| if __name__ == "__main__": | ||||||||||||
| parse_config(input("config: ")) | ||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use an H1 heading for the first line.
Line 1 should be a top-level markdown heading to satisfy MD041 and keep docs consistent.
Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 1-1: First line in a file should be a top-level heading
(MD041, first-line-heading, first-line-h1)
🤖 Prompt for AI Agents