|
| 1 | +# PHP Security Policies and Process |
| 2 | + |
| 3 | +> [!IMPORTANT] |
| 4 | +> This is a meta document discussing PHP security policies and processes. For the actual |
| 5 | +> PHP security policy, see the PHP [Vulnerability Disclosure Policy][] document. |
| 6 | +
|
| 7 | +## PHP.net security.txt file |
| 8 | + |
| 9 | +PHP.net includes a [security.txt][] file that complements the |
| 10 | +[Vulnerability Disclosure Policy][], aiding security vulnerability disclosure. |
| 11 | +This file implements the standard defined in [RFC 9116][], and more information |
| 12 | +is available at <https://securitytxt.org>. |
| 13 | + |
| 14 | +RFC 9116 requires an `Expires` field in `security.txt`, and its recommendation |
| 15 | +is for the `Expires` field to be less than a year in the future. This provides |
| 16 | +security researchers with confidence they are using our most up-to-date |
| 17 | +reporting policies. To facilitate yearly updates to the `Expires` field and |
| 18 | +ensure freshness of the information in `security.txt`, the PHP release managers |
| 19 | +[update the `Expires` field as part of the X.Y.0 GA release][expires-update]. |
| 20 | + |
| 21 | +From time-to-time, we may update `security.txt` with new information, outside |
| 22 | +of the yearly changes to the `Expires` field. |
| 23 | + |
| 24 | +### Making changes to security.txt |
| 25 | + |
| 26 | +All changes to `security.txt` must be signed by a PHP release manager for a |
| 27 | +[currently supported version of PHP][supported-versions] (at the time of the |
| 28 | +changes). Release managers are the most logical choice for signing this file, |
| 29 | +since we already [publish their PGP keys][rm-pgp-keys]. |
| 30 | + |
| 31 | +To make changes to `security.txt`: |
| 32 | + |
| 33 | +1. Go to your local clone of [web-php][]. |
| 34 | + |
| 35 | + ```bash |
| 36 | + cd /path/to/web-php/.well-known |
| 37 | + ``` |
| 38 | + |
| 39 | +2. Remove the PGP signature that wraps the body of `security.txt`: |
| 40 | + |
| 41 | + ```bash |
| 42 | + gpg --decrypt --output security.txt security.txt |
| 43 | + ``` |
| 44 | + |
| 45 | + > [!NOTE] |
| 46 | + > To "decrypt" `security.txt`, you will need the public key of the release |
| 47 | + > manager who last signed it in your GPG keychain. |
| 48 | +
|
| 49 | +3. Make and save your changes to this file, e.g., update the `Expires` timestamp. |
| 50 | + |
| 51 | + There should be a "Signed by" comment in the file that looks similar to this: |
| 52 | + |
| 53 | + ``` |
| 54 | + # Signed by Ben Ramsey <ramsey@php.net> on 2023-09-28. |
| 55 | + ``` |
| 56 | + |
| 57 | + Update this line with your name, the email address associated with the key |
| 58 | + you're using to sign the file, and the current date. |
| 59 | + |
| 60 | +4. Sign your changes: |
| 61 | + |
| 62 | + ```bash |
| 63 | + gpg --clearsign --local-user YOU@php.net --output security.txt.asc security.txt |
| 64 | + ``` |
| 65 | + |
| 66 | + > [!WARNING] |
| 67 | + > You cannot use `--output` to output the signature to the same file as the |
| 68 | + > input file or `gpg` will result in a signature wrapped around empty content. |
| 69 | +
|
| 70 | +5. Last, replace `security.txt` with `security.txt.asc` and commit your changes: |
| 71 | + |
| 72 | + ```bash |
| 73 | + mv security.txt.asc security.txt |
| 74 | + git commit security.txt |
| 75 | + ``` |
| 76 | + |
| 77 | +> [!NOTE] |
| 78 | +> You may verify the signature with the following command: |
| 79 | +> |
| 80 | +> ```bash |
| 81 | +> gpg --verify security.txt |
| 82 | +> ``` |
| 83 | +
|
| 84 | +[security.txt]: https://www.php.net/.well-known/security.txt |
| 85 | +[vulnerability disclosure policy]: https://github.com/php/php-src/security/policy |
| 86 | +[rfc 9116]: https://www.rfc-editor.org/rfc/rfc9116 |
| 87 | +[expires-update]: release-process.md#preparing-for-the-initial-stable-version-php-xy0 |
| 88 | +[supported-versions]: https://www.php.net/supported-versions.php |
| 89 | +[rm-pgp-keys]: https://www.php.net/gpg-keys.php |
| 90 | +[web-php]: https://github.com/php/web-php |
0 commit comments