business
I added allfiles
8 months ago
10
final-project-submission-template.docx
assignment-submission-3-by-monique-may1.docx
secure-coding-practices-examples-with-python-example-1.pdf
- assignment-3-instructions1.pdf
final-project-submission-template.docx
Final Project Report Template
1. Screenshot of your username input from keyboard
[attach your screenshot of the code (where it shows you haven't hardcoded the credentials) & an example of you typing in the credentials (7 points)]
2. Screenshot of your count_rows() method with Error Handling and Logging
[attach your screenshot of the code(the whole method) & an example of your logfile (7 points)]
3. Use at least 100 words to explain how the Error Handling, Logging and User input account info and password to make the app more secure
(3 points)
4. Screenshot of the Bandit running command and report for the whole project
This screenshot must show the number of lines in your final project in the Bandit results (3 points)
assignment-submission-3-by-monique-may1.docx
Assignment Submission 3 – Monique May
Step 3.1 add user “test_yourname”, and check if you successfully added.
[attach your screenshot to approve you have successfully added user “test”] (1 points)
Step 3.2. Make your is_admin() method safe
[attach your screenshot of your is_admin() method] (2 points)
[attach your screenshot of your result for is_admin('test') and is_admin( "'; select true; --"] (2 points)
Step 3.3. Create a secure count_rows() method
Step 3.3.1 [attach your screenshot of your necessary imported library, only the imported in your code] (1 point)
Step 3.3.2 [attach your screenshot of count_rows() method] (2 point)
Step 3.3.3 [attach your screenshot for the quires result:
count_rows('users', 1)
count_rows('users', 10)
count_rows("(select 1) as foo; update users set admin = true where name = 'test'; --", 1)
] (2 points)
image4.png
image5.png
image6.png
image7.png
image8.png
image1.png
image2.png
image3.png
secure-coding-practices-examples-with-python-example-1.pdf
1. Input Validation Risk – How Can It Happen?
All program inputs are a potential source of problems. If external data is not validated to ensure that it contains the right type of information, the right amount of information, and the right structure of information, it can cause problems. Drawing used by permission of Dominik Joswig
Real-world Examples:
In December 2005, a Japanese securities trader made a $1 billion typing error, when he mistakenly sold 600,000 shares of stock at 1 yen each instead of selling one share for 600,000 yen. A few lines of code may have averted this error. Fat fingered typing costs a trader’s bosses £128m, The Times Online, December 09, 2005 Web applications are highly vulnerable to input validation errors. Inputting the invalid entry “!@#$%^&*()” on a vulnerable e-commerce site may cause performance issues, or “denial of service”, on a vulnerable system, or invalid passwords such as “pwd’” or “1=1— ” may result in unauthorized access. http://www.processor.com/editorial/article.asp? article=articles%2Fp3112%2F32p12%2F32p12%2F32p12.asp&guid=&searchtype=&WordList=&bJumpTo=True A Norwegian woman mistyped her account number on an internet banking system. Instead of typing her 11-digit account number, she accidentally typed an extra digit, for a total of 12 numbers. The system discarded the extra digit, and transferred $100,000 to the (incorrect) account. A simple dialog box informing her that she had typed too many digits would have helped avoid this expensive error. Olsen, Kai. “The $100,000 Keying error” IEEE Computer, August 2008 The site xssed.com lists nearly 13,000 vulnerable Web pages, including sites such as yahoo.com, google.com, msn.com, facebook.com, craigslist.com and cnn.com
Example in code:
testScore = int(input('Enter test score: ')) if testScore >= 90: print('Your grade is A') elif testScore >= 80: print('Your grade is B') elif testScore >= 70: print('Your grade is C') elif testScore >= 60: print('Your grade is D') else: print('Your grade is F')
This code fails to check for negative test scores or for test scores above 100.
Code Responsibly– How Can I Properly Validate Input?
Check all input: Below is a partial list of some checks to include:
Range check: check numbers to ensure they are within a range of possible values, e.g., the value for month should lie between 1 and 12. Reasonable check: check values for their reasonableness, e.g. (age > 16) && (age < 100) Arithmetic check: check variables for values that might cause problems such as division by zero. Format check: check that the data is in a specified format (template), e.g., dates have to be in the format DD/MM/YYYY.
The following function shows input validation for a test score:
def check_input(min, max): prompt = "Enter an integer number between %d and %d: " % (min, max) value = int(input(prompt)) while (value < min or value > max): value = int(input(prompt)) return value
2. Cryptographic Practices Encrypt Data in Python First, we need to install the cryptography library:
pip3 install cryptography
4/19/24, 3:50 PM Secure Coding Practices Examples with Python.html
file:///C:/Users/Momo/AppData/Local/Temp/228e057a-90c7-47bd-aecd-f904a21f3362_Secure Coding Practices Examples with Python.html.zip.362/S… 1/5
- Economics Excel Problems
- competition
- **KIM WOODS** Participation and Login Posts
- e-activity
- Respond
- In academic affiliation with STAFFORDSHIRE UNIVERSITY GULF COLLEGE GULF COLLEGE - MUSCAT - SULTANATE OF OMAN UNDERGRADUATE BUSINESS PROGRAMME Academic Year: 2016 2017 First Semester ASSIGNMENT Module Title: Strategic Finance and Decision Making
- Corporate Social Responsibility (CSR) and Global Citizenship" Please respond to the following:
- I need excellent organic chemistry tutor
- "A" WORK PLAGIARISM FREE
- EDU 512 WK 5