Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ash-full-repository-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
python-version: '3.10'

- name: Install ASH
run: pip install git+https://github.com/awslabs/automated-security-helper.git@v3.0.0
run: pip install git+https://github.com/awslabs/automated-security-helper.git@v3.1.2

- name: Run ASH full repository scan
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ash-security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

- name: Install ASH
if: steps.changed-files.outputs.any_changed == 'true'
run: pip install git+https://github.com/awslabs/automated-security-helper.git@v3.0.0
run: pip install git+https://github.com/awslabs/automated-security-helper.git@v3.1.2

- name: Create temp directory for changed files
if: steps.changed-files.outputs.any_changed == 'true'
Expand Down
48 changes: 48 additions & 0 deletions test_security_issues.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python3
"""
Test file with intentional security issues for ASH testing
"""

import subprocess
import pickle
import os

Check failure on line 8 in test_security_issues.py

View workflow job for this annotation

GitHub Actions / python-lint

Ruff (F401)

test_security_issues.py:8:8: F401 `os` imported but unused

# Hardcoded credentials (security issue)
API_KEY = "sk-1234567890abcdef"
PASSWORD = "admin123"
SECRET_TOKEN = "secret_abc123"

def unsafe_command_execution(user_input):
"""Execute shell command with user input - command injection vulnerability"""
command = f"ls {user_input}"
result = subprocess.call(command, shell=True) # Security issue: shell=True
return result

def unsafe_pickle_load(data):
"""Unsafe deserialization - pickle vulnerability"""
return pickle.loads(data) # Security issue: unsafe deserialization

def sql_injection_example(user_id):
"""SQL injection vulnerability example"""
query = f"SELECT * FROM users WHERE id = {user_id}" # SQL injection
return query

def weak_random_generation():
"""Weak random number generation"""
import random
return random.random() # Security issue: weak PRNG

def path_traversal_vulnerability(filename):
"""Path traversal vulnerability"""
file_path = f"/var/uploads/{filename}"
with open(file_path, 'r') as f: # No path validation
return f.read()

# Hardcoded URL with credentials
DATABASE_URL = "postgresql://admin:password123@localhost:5432/mydb"

if __name__ == "__main__":
# Test the vulnerable functions
unsafe_command_execution("../etc/passwd")
print(f"Using API key: {API_KEY}")
weak_random_generation()
Loading