Skip to content

Commit 0c70f3a

Browse files
committed
Module 1
Introduce the overall application - both the serverside components and the CLI utility to interact with it. This module focuses on illustrating proper environment configuration (rather than relying on the system environment or tools like phpdotenv). Your task is to relocate a hard-coded user identification string to a safe location within the system environment that won't otherwise be accessible to visitors or potentially leaked if the system encounters a crash.
1 parent 52c80b3 commit 0c70f3a

480 files changed

Lines changed: 53052 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,64 @@
1-
# notes-tutorial
1+
# PHP Security Tutorial - Notes
2+
3+
This is an iterative workshop/tutorial explaining PHP security. It's divided into multiple _modules_, each of which is a standalone lesson as part of a three-hour workshop documented through [these slides] [slides].
4+
5+
Each module is broken into two directories:
6+
- `/server` - The actual PHP server, runnable through `php -S localhost:8888 -t module-N/server`
7+
- `/client` - A command line client, also written in PHP, which interacts with the server component.
8+
9+
10+
## Installation
11+
12+
Composer dependencies are bundled in the repository to make it easier to clone and get started with this project. If for any reason you want to _update_ your dependencies, merely do so with `composer update`.
13+
14+
The first step is to install Composer dependencies by running `composer install` in the root directory of the tutorial.
15+
16+
The modules themselves are self-contained and share their dependencies.
17+
18+
## Understanding the Lessons
19+
20+
Each lesson is built to cover a specific topic regarding PHP security. As such, there are several placeholder @TODOs throughout the code that are meant for you to complete. Each is documented explaining what's expected from you to complete the task.
21+
22+
The lessons are structured into the following modules:
23+
24+
### 1. Credentials Management
25+
26+
`module-1`
27+
28+
- `.env` files
29+
- Flat configuration files
30+
31+
### 2. Authentication
32+
33+
`module-2`
34+
35+
- Password management
36+
- Password storage
37+
- Password hashing
38+
39+
### 3. Session Management
40+
41+
`module-3`
42+
43+
- PHP session configuration
44+
45+
### 4. Data - Validation & Sanitization
46+
47+
`module-4`
48+
49+
- Input validation
50+
- Output sanitization
51+
52+
### 5. Encryption
53+
54+
`module-5`
55+
56+
- File encryption
57+
- Database encryption
58+
- Blind indicies
59+
60+
## In Addition
61+
62+
Attendees of a live workshop presentation will note the sections on "Environment" and "Server Hardening" from [the workshop slide deck] [slides]. This is an intentional omission. Environment configuration is baked into this project directly and is something we'll discuss in person. Server hardening is also a _production_ configuration topic and is not easily worked through in a workshop environment.
63+
64+
[slides]: TODO

composer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "ericmann/notes-tutorial",
3+
"description": "Iterative tutorial illustrating PHP security.",
4+
"type": "project",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Eric Mann",
9+
"email": "eric@eamann.com"
10+
}
11+
],
12+
"minimum-stability": "stable",
13+
"require": {
14+
"league/route": "^4.3",
15+
"zendframework/zend-diactoros": "^2.2",
16+
"zendframework/zend-httphandlerrunner": "^1.1",
17+
"ramsey/uuid": "^3.9",
18+
"splitbrain/php-cli": "^1.1",
19+
"guzzlehttp/guzzle": "^6.5"
20+
},
21+
"autoload": {
22+
"psr-4": {
23+
"Notes\\Module1\\": "module-1/server/"
24+
},
25+
"files": [
26+
"util/Database.php",
27+
"util/types/BaseNote.php",
28+
"util/types/BaseUser.php",
29+
"util/types/Note.php",
30+
"util/types/User.php"
31+
]
32+
}
33+
}

0 commit comments

Comments
 (0)