diff --git a/.gitignore b/.gitignore index 3ba811c..622bce8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,9 @@ portfolio-private/smtp-config.php *.key *.pem -# Données du conteneur (logs, clés, config) +# Container data (logs with visitor IPs, TLS keys, config) config/ *.log -# CV (contiennent e-mail et téléphone) +# CVs (contain email and phone number) www/docs/*.pdf diff --git a/README.md b/README.md index 45c0e67..692ab7c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ I am an engineering student in Computer Science & Telecom at INP ENSEEIHT (Toulo ## Why this project - **A professional showcase.** Recruiters, tutors and teachers can see my background, my projects and my CV without digging through several platforms. -- **Part of my engineering programme.** At ENSEEIHT, apprenticeship students build an ePortfolio throughout the degree. It follows a set structure (welcome page, projects, career, mobility, passions, civic engagement) and is updated as the years go by, so it shows progress rather than a snapshot. +- **Part of my engineering programme.** At ENSEEIHT, apprenticeship students build an ePortfolio throughout the degree. It follows a set structure (welcome page, projects, career, passions, civic engagement) and is updated as the years go by, so it shows progress rather than a snapshot. - **A real self-hosting project.** It replaces my former WordPress site with a lightweight static site, running on my own server next to my other services (such as this Gitea instance). ## What's on the site @@ -15,13 +15,12 @@ I am an engineering student in Computer Science & Telecom at INP ENSEEIHT (Toulo | Section | Content | |---|---| | **Welcome** | Who I am in a few lines, my path shown as a `traceroute`, a summary of my certifications and my toolbox | -| **Background** | Education and work experience as two timelines | +| **Background** | Education and work experience as two timelines, with a photo and logo for each school and company | | **Certifications** | An interactive timeline of my certifications (Stormshield CSNA, Cisco CCNA and Ethical Hacker, ANSSI SecNumacadémie, TOEIC), each with its details, a link to verify it on Credly when available and a view of the certificate, plus the one I am preparing (HTB CJCA) with its progress | -| **Projects** | Internship and academic projects, each told as context → what I did → result, with links to the code | +| **Projects** | Internship and academic projects, each told as context → what I did → result, illustrated and linked to their code or project site | | **Career** | My CV in English and French, and my LinkedIn profile | -| **Mobility** | Destinations I am considering for my semester abroad | | **Passions** | Self-hosting, offensive security training, photography, geopolitics | -| **Civic engagement** | Volunteering and awareness actions, with hours tracked | +| **Civic engagement** | Volunteering and awareness actions, with hours tracked and links to the events | | **Contact** | A form that sends messages straight to my inbox | ## Design choices diff --git a/portfolio-private/PHPMailer/PHPMailer.php b/portfolio-private/PHPMailer/PHPMailer.php index 2444bcf..5ccf8ff 100644 --- a/portfolio-private/PHPMailer/PHPMailer.php +++ b/portfolio-private/PHPMailer/PHPMailer.php @@ -59,6 +59,7 @@ class PHPMailer const ICAL_METHOD_REFRESH = 'REFRESH'; const ICAL_METHOD_COUNTER = 'COUNTER'; const ICAL_METHOD_DECLINECOUNTER = 'DECLINECOUNTER'; + const RFC822_DATE_FORMAT = 'D, j M Y H:i:s O'; /** * Email priority. @@ -77,7 +78,7 @@ class PHPMailer public $CharSet = self::CHARSET_ISO88591; /** - * The MIME Content-type of the message. + * The MIME Content-Type of the message. * * @var string */ @@ -159,7 +160,7 @@ class PHPMailer public $Ical = ''; /** - * Value-array of "method" in Contenttype header "text/calendar" + * Value-array of "method" in Content-Type header "text/calendar" * * @var string[] */ @@ -561,9 +562,9 @@ class PHPMailer * string $body the email body * string $from email address of sender * string $extra extra information of possible use - * "smtp_transaction_id' => last smtp transaction id + * 'smtp_transaction_id' => last smtp transaction id * - * @var string + * @var callable|callable-string */ public $action_function = ''; @@ -711,7 +712,7 @@ class PHPMailer * * @var array */ - protected $language = []; + protected static $language = []; /** * The number of errors encountered. @@ -768,7 +769,7 @@ class PHPMailer * * @var string */ - const VERSION = '6.10.0'; + const VERSION = '7.1.1'; /** * Error severity: message only, continue processing. @@ -876,6 +877,7 @@ class PHPMailer private function mailPassthru($to, $subject, $body, $header, $params) { //Check overloading of mail function to avoid double-encoding + // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecatedRemoved if ((int)ini_get('mbstring.func_overload') & 1) { $subject = $this->secureHeader($subject); } else { @@ -987,6 +989,54 @@ class PHPMailer $this->Mailer = 'mail'; } + /** + * Extract sendmail path and parse to deal with known parameters. + * + * @param string $sendmailPath The sendmail path as set in php.ini + * + * @return string The sendmail path without the known parameters + */ + private function parseSendmailPath($sendmailPath) + { + $sendmailPath = trim((string)$sendmailPath); + if ($sendmailPath === '') { + return $sendmailPath; + } + + $parts = preg_split('/\s+/', $sendmailPath); + if (empty($parts)) { + return $sendmailPath; + } + + $command = array_shift($parts); + $remainder = []; + + // Parse only -t, -i, -oi and -f parameters. + for ($i = 0; $i < count($parts); ++$i) { + $part = $parts[$i]; + if (preg_match('/^-(i|oi|t)$/', $part, $matches)) { + continue; + } + if (preg_match('/^-f(.*)$/', $part, $matches)) { + $address = $matches[1]; + if ($address === '' && isset($parts[$i + 1]) && strpos($parts[$i + 1], '-') !== 0) { + $address = $parts[++$i]; + } + $this->Sender = $address; + continue; + } + + $remainder[] = $part; + } + + // The params that are not parsed are added back to the command. + if (!empty($remainder)) { + $command .= ' ' . implode(' ', $remainder); + } + + return $command; + } + /** * Send messages using $Sendmail. */ @@ -995,10 +1045,9 @@ class PHPMailer $ini_sendmail_path = ini_get('sendmail_path'); if (false === stripos($ini_sendmail_path, 'sendmail')) { - $this->Sendmail = '/usr/sbin/sendmail'; - } else { - $this->Sendmail = $ini_sendmail_path; + $ini_sendmail_path = '/usr/sbin/sendmail'; } + $this->Sendmail = $this->parseSendmailPath($ini_sendmail_path); $this->Mailer = 'sendmail'; } @@ -1010,10 +1059,9 @@ class PHPMailer $ini_sendmail_path = ini_get('sendmail_path'); if (false === stripos($ini_sendmail_path, 'qmail')) { - $this->Sendmail = '/var/qmail/bin/qmail-inject'; - } else { - $this->Sendmail = $ini_sendmail_path; + $ini_sendmail_path = '/var/qmail/bin/qmail-inject'; } + $this->Sendmail = $this->parseSendmailPath($ini_sendmail_path); $this->Mailer = 'qmail'; } @@ -1102,7 +1150,7 @@ class PHPMailer //At-sign is missing. $error_message = sprintf( '%s (%s): %s', - $this->lang('invalid_address'), + self::lang('invalid_address'), $kind, $address ); @@ -1187,7 +1235,7 @@ class PHPMailer if (!in_array($kind, ['to', 'cc', 'bcc', 'Reply-To'])) { $error_message = sprintf( '%s: %s', - $this->lang('Invalid recipient kind'), + self::lang('Invalid recipient kind'), $kind ); $this->setError($error_message); @@ -1201,7 +1249,7 @@ class PHPMailer if (!static::validateAddress($address)) { $error_message = sprintf( '%s (%s): %s', - $this->lang('invalid_address'), + self::lang('invalid_address'), $kind, $address ); @@ -1220,56 +1268,62 @@ class PHPMailer return true; } - } elseif (!array_key_exists(strtolower($address), $this->ReplyTo)) { - $this->ReplyTo[strtolower($address)] = [$address, $name]; + } else { + foreach ($this->ReplyTo as $replyTo) { + if (0 === strcasecmp($replyTo[0], $address)) { + return false; + } + } + $this->ReplyTo[] = [$address, $name]; return true; } - return false; } /** * Parse and validate a string containing one or more RFC822-style comma-separated email addresses * of the form "display name
" into an array of name/address pairs. - * Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. + * Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available and + * the deprecated $useimap argument is truthy. * Note that quotes in the name part are removed. * + * @deprecated This method will be removed in the next major release of PHPMailer. * @see https://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation * * @param string $addrstr The address list string - * @param bool $useimap Whether to use the IMAP extension to parse the list + * @param bool|null $useimap Deprecated in PHPMailer 6.11.0. + * Truthy values request the deprecated IMAP parser + * and trigger a deprecation warning. * @param string $charset The charset to use when decoding the address list string. * * @return array */ - public static function parseAddresses($addrstr, $useimap = true, $charset = self::CHARSET_ISO88591) + public static function parseAddresses($addrstr, $useimap = null, $charset = self::CHARSET_ISO88591) { + if ($useimap) { + trigger_error(self::lang('deprecated_argument') . '$useimap', E_USER_DEPRECATED); + } $addresses = []; - if ($useimap && function_exists('imap_rfc822_parse_adrlist')) { + if ($useimap !== false && function_exists('imap_rfc822_parse_adrlist')) { //Use this built-in parser if it's available + // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.imap_rfc822_parse_adrlistRemoved -- wrapped in function_exists() $list = imap_rfc822_parse_adrlist($addrstr, ''); // Clear any potential IMAP errors to get rid of notices being thrown at end of script. + // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.imap_errorsRemoved -- wrapped in function_exists() imap_errors(); foreach ($list as $address) { if ( '.SYNTAX-ERROR.' !== $address->host && static::validateAddress($address->mailbox . '@' . $address->host) ) { - //Decode the name part if it's present and encoded + //Decode the name part if it's present and maybe encoded if ( - property_exists($address, 'personal') && - //Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled - defined('MB_CASE_UPPER') && - preg_match('/^=\?.*\?=$/s', $address->personal) + property_exists($address, 'personal') + && is_string($address->personal) + && $address->personal !== '' ) { - $origCharset = mb_internal_encoding(); - mb_internal_encoding($charset); - //Undo any RFC2047-encoded spaces-as-underscores - $address->personal = str_replace('_', '=20', $address->personal); - //Decode the name - $address->personal = mb_decode_mimeheader($address->personal); - mb_internal_encoding($origCharset); + $address->personal = static::decodeHeader($address->personal, $charset); } $addresses[] = [ @@ -1280,40 +1334,51 @@ class PHPMailer } } else { //Use this simpler parser - $list = explode(',', $addrstr); - foreach ($list as $address) { - $address = trim($address); - //Is there a separate name part? - if (strpos($address, '<') === false) { - //No separate name, just use the whole thing - if (static::validateAddress($address)) { - $addresses[] = [ - 'name' => '', - 'address' => $address, - ]; - } - } else { - list($name, $email) = explode('<', $address); - $email = trim(str_replace('>', '', $email)); - $name = trim($name); - if (static::validateAddress($email)) { - //Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled - //If this name is encoded, decode it - if (defined('MB_CASE_UPPER') && preg_match('/^=\?.*\?=$/s', $name)) { - $origCharset = mb_internal_encoding(); - mb_internal_encoding($charset); - //Undo any RFC2047-encoded spaces-as-underscores - $name = str_replace('_', '=20', $name); - //Decode the name - $name = mb_decode_mimeheader($name); - mb_internal_encoding($origCharset); - } - $addresses[] = [ - //Remove any surrounding quotes and spaces from the name - 'name' => trim($name, '\'" '), - 'address' => $email, - ]; - } + $addresses = static::parseSimplerAddresses($addrstr, $charset); + } + + return $addresses; + } + + /** + * Parse a string containing one or more RFC822-style comma-separated email addresses + * with the form "display name
" into an array of name/address pairs. + * Uses a simpler parser that does not require the IMAP extension but doesnt support + * the full RFC822 spec. For full RFC822 support, use the PHP IMAP extension. + * + * @param string $addrstr The address list string + * @param string $charset The charset to use when decoding the address list string. + * + * @return array + */ + protected static function parseSimplerAddresses($addrstr, $charset) + { + // Emit a runtime notice to recommend using the IMAP extension for full RFC822 parsing + trigger_error(self::lang('imap_recommended'), E_USER_NOTICE); + + $addresses = []; + $list = explode(',', $addrstr); + foreach ($list as $address) { + $address = trim($address); + //Is there a separate name part? + if (strpos($address, '<') === false) { + //No separate name, just use the whole thing + if (static::validateAddress($address)) { + $addresses[] = [ + 'name' => '', + 'address' => $address, + ]; + } + } else { + $parsed = static::parseEmailString($address); + $email = $parsed['email']; + if (static::validateAddress($email)) { + $name = static::decodeHeader($parsed['name'], $charset); + $addresses[] = [ + //Remove any surrounding quotes and spaces from the name + 'name' => trim($name, '\'" '), + 'address' => $email, + ]; } } } @@ -1321,6 +1386,42 @@ class PHPMailer return $addresses; } + /** + * Parse a string containing an email address with an optional name + * and divide it into a name and email address. + * + * @param string $input The email with name. + * + * @return array{name: string, email: string} + */ + private static function parseEmailString($input) + { + $input = trim((string)$input); + + if ($input === '') { + return ['name' => '', 'email' => '']; + } + + $pattern = '/^\s*(?:(?:"([^"]*)"|\'([^\']*)\'|([^<]*?))\s*)?<\s*([^>]+)\s*>\s*$/'; + if (preg_match($pattern, $input, $matches)) { + $name = ''; + // Double quotes including special scenarios. + if (isset($matches[1]) && $matches[1] !== '') { + $name = $matches[1]; + // Single quotes including special scenarios. + } elseif (isset($matches[2]) && $matches[2] !== '') { + $name = $matches[2]; + // Simplest scenario, name and email are in the format "Name ". + } elseif (isset($matches[3])) { + $name = trim($matches[3]); + } + + return ['name' => $name, 'email' => trim($matches[4])]; + } + + return ['name' => '', 'email' => $input]; + } + /** * Set the From and FromName properties. * @@ -1334,6 +1435,10 @@ class PHPMailer */ public function setFrom($address, $name = '', $auto = true) { + if (is_null($name)) { + //Helps avoid a deprecation warning in the preg_replace() below + $name = ''; + } $address = trim((string)$address); $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim //Don't validate now addresses with IDN. Will be done in send(). @@ -1345,7 +1450,7 @@ class PHPMailer ) { $error_message = sprintf( '%s (From): %s', - $this->lang('invalid_address'), + self::lang('invalid_address'), $address ); $this->setError($error_message); @@ -1532,9 +1637,11 @@ class PHPMailer ); } elseif (defined('INTL_IDNA_VARIANT_2003')) { //Fall back to this old, deprecated/removed encoding + // phpcs:ignore PHPCompatibility.Constants.RemovedConstants.intl_idna_variant_2003DeprecatedRemoved $punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_2003); } else { //Fall back to a default we don't know about + // phpcs:ignore PHPCompatibility.ParameterValues.NewIDNVariantDefault.NotSet $punycode = idn_to_ascii($domain, $errorcode); } if (false !== $punycode) { @@ -1601,7 +1708,7 @@ class PHPMailer && ini_get('mail.add_x_header') === '1' && stripos(PHP_OS, 'WIN') === 0 ) { - trigger_error($this->lang('buggy_php'), E_USER_WARNING); + trigger_error(self::lang('buggy_php'), E_USER_WARNING); } try { @@ -1631,7 +1738,7 @@ class PHPMailer call_user_func_array([$this, 'addAnAddress'], $params); } if (count($this->to) + count($this->cc) + count($this->bcc) < 1) { - throw new Exception($this->lang('provide_address'), self::STOP_CRITICAL); + throw new Exception(self::lang('provide_address'), self::STOP_CRITICAL); } //Validate From, Sender, and ConfirmReadingTo addresses @@ -1648,7 +1755,7 @@ class PHPMailer if (!static::validateAddress($this->{$address_kind})) { $error_message = sprintf( '%s (%s): %s', - $this->lang('invalid_address'), + self::lang('invalid_address'), $address_kind, $this->{$address_kind} ); @@ -1670,11 +1777,13 @@ class PHPMailer $this->setMessageType(); //Refuse to send an empty message unless we are specifically allowing it if (!$this->AllowEmpty && empty($this->Body)) { - throw new Exception($this->lang('empty_message'), self::STOP_CRITICAL); + throw new Exception(self::lang('empty_message'), self::STOP_CRITICAL); } //Trim subject consistently $this->Subject = trim($this->Subject); + + //Create body before headers in case body makes changes to headers (e.g. altering transfer encoding) $this->MIMEHeader = ''; $this->MIMEBody = $this->createBody(); @@ -1749,7 +1858,7 @@ class PHPMailer return $this->mailSend($this->MIMEHeader, $this->MIMEBody); default: $sendMethod = $this->Mailer . 'Send'; - if (method_exists($this, $sendMethod)) { + if (!empty($this->Mailer) && method_exists($this, $sendMethod)) { return $this->{$sendMethod}($this->MIMEHeader, $this->MIMEBody); } @@ -1802,23 +1911,27 @@ class PHPMailer //PHP config has a sender address we can use $this->Sender = ini_get('sendmail_from'); } - //CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped. + + $sendmailArgs = []; + + // CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped. + // Also don't add the -f automatically unless it has been set either via Sender + // or sendmail_path. Otherwise, it can introduce new problems. + // @see http://github.com/PHPMailer/PHPMailer/issues/2298 if (!empty($this->Sender) && static::validateAddress($this->Sender) && self::isShellSafe($this->Sender)) { - if ($this->Mailer === 'qmail') { - $sendmailFmt = '%s -f%s'; - } else { - $sendmailFmt = '%s -oi -f%s -t'; - } - } else { - //allow sendmail to choose a default envelope sender. It may - //seem preferable to force it to use the From header as with - //SMTP, but that introduces new problems (see - //), and - //it has historically worked this way. - $sendmailFmt = '%s -oi -t'; + $sendmailArgs[] = '-f' . $this->Sender; } - $sendmail = sprintf($sendmailFmt, escapeshellcmd($this->Sendmail), $this->Sender); + // Qmail doesn't accept all the sendmail parameters + // @see https://github.com/PHPMailer/PHPMailer/issues/3189 + if ($this->Mailer !== 'qmail') { + $sendmailArgs[] = '-i'; + $sendmailArgs[] = '-t'; + } + + $resultArgs = (empty($sendmailArgs) ? '' : ' ' . implode(' ', $sendmailArgs)); + + $sendmail = trim(escapeshellcmd($this->Sendmail) . $resultArgs); $this->edebug('Sendmail path: ' . $this->Sendmail); $this->edebug('Sendmail command: ' . $sendmail); $this->edebug('Envelope sender: ' . $this->Sender); @@ -1828,33 +1941,35 @@ class PHPMailer foreach ($this->SingleToArray as $toAddr) { $mail = @popen($sendmail, 'w'); if (!$mail) { - throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + throw new Exception(self::lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } $this->edebug("To: {$toAddr}"); fwrite($mail, 'To: ' . $toAddr . "\n"); fwrite($mail, $header); fwrite($mail, $body); $result = pclose($mail); - $addrinfo = static::parseAddresses($toAddr, true, $this->CharSet); - $this->doCallback( - ($result === 0), - [[$addrinfo['address'], $addrinfo['name']]], - $this->cc, - $this->bcc, - $this->Subject, - $body, - $this->From, - [] - ); + $addrinfo = static::parseAddresses($toAddr, null, $this->CharSet); + foreach ($addrinfo as $addr) { + $this->doCallback( + ($result === 0), + [[$addr['address'], $addr['name']]], + $this->cc, + $this->bcc, + $this->Subject, + $body, + $this->From, + [] + ); + } $this->edebug("Result: " . ($result === 0 ? 'true' : 'false')); if (0 !== $result) { - throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + throw new Exception(self::lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } } } else { $mail = @popen($sendmail, 'w'); if (!$mail) { - throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + throw new Exception(self::lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } fwrite($mail, $header); fwrite($mail, $body); @@ -1871,7 +1986,7 @@ class PHPMailer ); $this->edebug("Result: " . ($result === 0 ? 'true' : 'false')); if (0 !== $result) { - throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL); + throw new Exception(self::lang('execute') . $this->Sendmail, self::STOP_CRITICAL); } } @@ -2000,7 +2115,8 @@ class PHPMailer $this->Sender = ini_get('sendmail_from'); } if (!empty($this->Sender) && static::validateAddress($this->Sender)) { - if (self::isShellSafe($this->Sender)) { + $phpmailer_path = ini_get('sendmail_path'); + if (self::isShellSafe($this->Sender) && strpos($phpmailer_path, ' -f') === false) { $params = sprintf('-f%s', $this->Sender); } $old_from = ini_get('sendmail_from'); @@ -2010,17 +2126,19 @@ class PHPMailer if ($this->SingleTo && count($toArr) > 1) { foreach ($toArr as $toAddr) { $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); - $addrinfo = static::parseAddresses($toAddr, true, $this->CharSet); - $this->doCallback( - $result, - [[$addrinfo['address'], $addrinfo['name']]], - $this->cc, - $this->bcc, - $this->Subject, - $body, - $this->From, - [] - ); + $addrinfo = static::parseAddresses($toAddr, null, $this->CharSet); + foreach ($addrinfo as $addr) { + $this->doCallback( + $result, + [[$addr['address'], $addr['name']]], + $this->cc, + $this->bcc, + $this->Subject, + $body, + $this->From, + [] + ); + } } } else { $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params); @@ -2030,7 +2148,7 @@ class PHPMailer ini_set('sendmail_from', $old_from); } if (!$result) { - throw new Exception($this->lang('instantiate'), self::STOP_CRITICAL); + throw new Exception(self::lang('instantiate'), self::STOP_CRITICAL); } return true; @@ -2116,12 +2234,12 @@ class PHPMailer $header = static::stripTrailingWSP($header) . static::$LE . static::$LE; $bad_rcpt = []; if (!$this->smtpConnect($this->SMTPOptions)) { - throw new Exception($this->lang('smtp_connect_failed'), self::STOP_CRITICAL); + throw new Exception(self::lang('smtp_connect_failed'), self::STOP_CRITICAL); } //If we have recipient addresses that need Unicode support, //but the server doesn't support it, stop here if ($this->UseSMTPUTF8 && !$this->smtp->getServerExt('SMTPUTF8')) { - throw new Exception($this->lang('no_smtputf8'), self::STOP_CRITICAL); + throw new Exception(self::lang('no_smtputf8'), self::STOP_CRITICAL); } //Sender already validated in preSend() if ('' === $this->Sender) { @@ -2133,7 +2251,7 @@ class PHPMailer $this->smtp->xclient($this->SMTPXClient); } if (!$this->smtp->mail($smtp_from)) { - $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError())); + $this->setError(self::lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError())); throw new Exception($this->ErrorInfo, self::STOP_CRITICAL); } @@ -2155,7 +2273,7 @@ class PHPMailer //Only send the DATA command if we have viable recipients if ((count($this->all_recipients) > count($bad_rcpt)) && !$this->smtp->data($header . $body)) { - throw new Exception($this->lang('data_not_accepted'), self::STOP_CRITICAL); + throw new Exception(self::lang('data_not_accepted'), self::STOP_CRITICAL); } $smtp_transaction_id = $this->smtp->getLastTransactionID(); @@ -2186,7 +2304,7 @@ class PHPMailer foreach ($bad_rcpt as $bad) { $errstr .= $bad['to'] . ': ' . $bad['error']; } - throw new Exception($this->lang('recipients_failed') . $errstr, self::STOP_CONTINUE); + throw new Exception(self::lang('recipients_failed') . $errstr, self::STOP_CONTINUE); } return true; @@ -2240,7 +2358,7 @@ class PHPMailer $hostinfo ) ) { - $this->edebug($this->lang('invalid_hostentry') . ' ' . trim($hostentry)); + $this->edebug(self::lang('invalid_hostentry') . ' ' . trim($hostentry)); //Not a valid host entry continue; } @@ -2252,7 +2370,7 @@ class PHPMailer //Check the host name is a valid name or IP address before trying to use it if (!static::isValidHost($hostinfo[2])) { - $this->edebug($this->lang('invalid_host') . ' ' . $hostinfo[2]); + $this->edebug(self::lang('invalid_host') . ' ' . $hostinfo[2]); continue; } $prefix = ''; @@ -2272,7 +2390,7 @@ class PHPMailer if (static::ENCRYPTION_STARTTLS === $secure || static::ENCRYPTION_SMTPS === $secure) { //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled if (!$sslext) { - throw new Exception($this->lang('extension_missing') . 'openssl', self::STOP_CRITICAL); + throw new Exception(self::lang('extension_missing') . 'openssl', self::STOP_CRITICAL); } } $host = $hostinfo[2]; @@ -2324,7 +2442,7 @@ class PHPMailer $this->oauth ) ) { - throw new Exception($this->lang('authenticate')); + throw new Exception(self::lang('authenticate')); } return true; @@ -2374,7 +2492,7 @@ class PHPMailer * * @return bool Returns true if the requested language was loaded, false otherwise. */ - public function setLanguage($langcode = 'en', $lang_path = '') + public static function setLanguage($langcode = 'en', $lang_path = '') { //Backwards compatibility for renamed language codes $renamed_langcodes = [ @@ -2397,7 +2515,7 @@ class PHPMailer 'authenticate' => 'SMTP Error: Could not authenticate.', 'buggy_php' => 'Your version of PHP is affected by a bug that may result in corrupted messages.' . ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' . - ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.', + ' your php.ini, switch to macOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.', 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', 'data_not_accepted' => 'SMTP Error: data not accepted.', 'empty_message' => 'Message body empty', @@ -2423,6 +2541,9 @@ class PHPMailer 'smtp_error' => 'SMTP server error: ', 'variable_set' => 'Cannot set or reset variable: ', 'no_smtputf8' => 'Server does not support SMTPUTF8 needed to send to Unicode addresses', + 'imap_recommended' => 'Using simplified address parser is not recommended. ' . + 'Install the PHP IMAP extension for full RFC822 parsing.', + 'deprecated_argument' => 'Deprecated Argument: ', ]; if (empty($lang_path)) { //Calculate an absolute path so it can work if CWD is not here @@ -2489,7 +2610,7 @@ class PHPMailer } } } - $this->language = $PHPMAILER_LANG; + self::$language = $PHPMAILER_LANG; return $foundlang; //Returns false if language not found } @@ -2501,11 +2622,11 @@ class PHPMailer */ public function getTranslations() { - if (empty($this->language)) { - $this->setLanguage(); // Set the default language. + if (empty(self::$language)) { + self::setLanguage(); // Set the default language. } - return $this->language; + return self::$language; } /** @@ -2526,7 +2647,22 @@ class PHPMailer $addresses[] = $this->addrFormat($address); } - return $type . ': ' . implode(', ', $addresses) . static::$LE; + //Fold between addresses so that no line exceeds the RFC 2822 line length limit + $header = $type . ': ' . array_shift($addresses); + $lineLength = strlen($header); + foreach ($addresses as $address) { + //The address goes after ', ' and must still leave room for the ',' that ends + //the line if the next address gets folded + if ($lineLength + strlen(', ') + strlen($address) + strlen(',') > static::MAX_LINE_LENGTH) { + $header .= ',' . static::$LE . ' ' . $address; + $lineLength = strlen(' ') + strlen($address); + } else { + $header .= ', ' . $address; + $lineLength += strlen(', ') + strlen($address); + } + } + + return $header . static::$LE; } /** @@ -2731,7 +2867,10 @@ class PHPMailer { $result = ''; - $result .= $this->headerLine('Date', '' === $this->MessageDate ? self::rfcDate() : $this->MessageDate); + $result .= $this->headerLine( + 'Date', + self::sanitiseDate($this->MessageDate) + ); //The To header is created automatically by mail(), so needs to be omitted here if ('mail' !== $this->Mailer) { @@ -2800,7 +2939,7 @@ class PHPMailer ); } elseif (is_string($this->XMailer) && trim($this->XMailer) !== '') { //Some string - $result .= $this->headerLine('X-Mailer', trim($this->XMailer)); + $result .= $this->headerLine('X-Mailer', $this->secureHeader(trim($this->XMailer))); } //Other values result in no X-Mailer header if ('' !== $this->ConfirmReadingTo) { @@ -2850,13 +2989,20 @@ class PHPMailer break; default: //Catches case 'plain': and case '': - $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet); + $result .= $this->textLine( + 'Content-Type: ' . + $this->secureHeader($this->ContentType) . + '; charset=' . $this->secureHeader($this->CharSet) + ); $ismultipart = false; break; } + if (!$this->validateEncoding($this->Encoding)) { + throw new Exception(self::lang('encoding') . $this->Encoding); + } //RFC1341 part 5 says 7bit is assumed if not specified if (static::ENCODING_7BIT !== $this->Encoding) { - //RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE + //RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit, or binary CTE if ($ismultipart) { if (static::ENCODING_8BIT === $this->Encoding) { $result .= $this->headerLine('Content-Transfer-Encoding', static::ENCODING_8BIT); @@ -2896,6 +3042,7 @@ class PHPMailer $bytes = ''; if (function_exists('random_bytes')) { try { + // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.random_bytesFound -- Wrapped in function_exists. $bytes = random_bytes($len); } catch (\Exception $e) { //Do nothing @@ -2928,12 +3075,11 @@ class PHPMailer //Create unique IDs and preset boundaries $this->setBoundaries(); - if ($this->sign_key_file) { - $body .= $this->getMailMIME() . static::$LE; - } - $this->setWordWrap(); + if (!$this->validateEncoding($this->Encoding)) { + throw new Exception(self::lang('encoding') . $this->Encoding); + } $bodyEncoding = $this->Encoding; $bodyCharSet = $this->CharSet; //Can we do a 7-bit downgrade? @@ -2963,6 +3109,12 @@ class PHPMailer if (static::ENCODING_BASE64 !== $altBodyEncoding && static::hasLineLongerThanMax($this->AltBody)) { $altBodyEncoding = static::ENCODING_QUOTED_PRINTABLE; } + + if ($this->sign_key_file) { + $this->Encoding = $bodyEncoding; + $body .= $this->getMailMIME() . static::$LE; + } + //Use this as a preamble in all multipart message types $mimepre = ''; switch ($this->message_type) { @@ -3144,12 +3296,12 @@ class PHPMailer if ($this->isError()) { $body = ''; if ($this->exceptions) { - throw new Exception($this->lang('empty_message'), self::STOP_CRITICAL); + throw new Exception(self::lang('empty_message'), self::STOP_CRITICAL); } } elseif ($this->sign_key_file) { try { if (!defined('PKCS7_TEXT')) { - throw new Exception($this->lang('extension_missing') . 'openssl'); + throw new Exception(self::lang('extension_missing') . 'openssl'); } $file = tempnam(sys_get_temp_dir(), 'srcsign'); @@ -3183,11 +3335,12 @@ class PHPMailer @unlink($signed); //The message returned by openssl contains both headers and body, so need to split them up $parts = explode("\n\n", $body, 2); - $this->MIMEHeader .= $parts[0] . static::$LE . static::$LE; - $body = $parts[1]; + //openssl emits bare LF breaks, which SMTP servers may reject + $this->MIMEHeader .= static::normalizeBreaks($parts[0]) . static::$LE . static::$LE; + $body = static::normalizeBreaks($parts[1]); } else { @unlink($signed); - throw new Exception($this->lang('signing') . openssl_error_string()); + throw new Exception(self::lang('signing') . openssl_error_string()); } } catch (Exception $exc) { $body = ''; @@ -3332,7 +3485,7 @@ class PHPMailer ) { try { if (!static::fileIsAccessible($path)) { - throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE); + throw new Exception(self::lang('file_access') . $path, self::STOP_CONTINUE); } //If a MIME type is not specified, try to work it out from the file name @@ -3345,7 +3498,7 @@ class PHPMailer $name = $filename; } if (!$this->validateEncoding($encoding)) { - throw new Exception($this->lang('encoding') . $encoding); + throw new Exception(self::lang('encoding') . $encoding); } $this->attachment[] = [ @@ -3506,11 +3659,11 @@ class PHPMailer { try { if (!static::fileIsAccessible($path)) { - throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE); + throw new Exception(self::lang('file_open') . $path, self::STOP_CONTINUE); } $file_buffer = file_get_contents($path); if (false === $file_buffer) { - throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE); + throw new Exception(self::lang('file_open') . $path, self::STOP_CONTINUE); } $file_buffer = $this->encodeString($file_buffer, $encoding); @@ -3563,9 +3716,9 @@ class PHPMailer $encoded = $this->encodeQP($str); break; default: - $this->setError($this->lang('encoding') . $encoding); + $this->setError(self::lang('encoding') . $encoding); if ($this->exceptions) { - throw new Exception($this->lang('encoding') . $encoding); + throw new Exception(self::lang('encoding') . $encoding); } break; } @@ -3671,6 +3824,42 @@ class PHPMailer return trim(static::normalizeBreaks($encoded)); } + /** + * Decode an RFC2047-encoded header value + * Attempts multiple strategies so it works even when the mbstring extension is disabled. + * + * @param string $value The header value to decode + * @param string $charset The target charset to convert to, defaults to ISO-8859-1 for BC + * + * @return string The decoded header value + */ + public static function decodeHeader($value, $charset = self::CHARSET_ISO88591) + { + if (!is_string($value) || $value === '') { + return ''; + } + // Detect the presence of any RFC2047 encoded-words + $hasEncodedWord = (bool) preg_match('/=\?.*\?=/s', $value); + if ($hasEncodedWord && defined('MB_CASE_UPPER')) { + $origCharset = mb_internal_encoding(); + // Always decode to UTF-8 to provide a consistent, modern output encoding. + mb_internal_encoding($charset); + if (PHP_VERSION_ID < 80300) { + // Undo any RFC2047-encoded spaces-as-underscores. + $value = str_replace('_', '=20', $value); + } else { + // PHP 8.3+ already interprets underscores as spaces. Remove additional + // linear whitespace between adjacent encoded words to avoid double spacing. + $value = preg_replace('/(\?=)\s+(=\?)/', '$1$2', $value); + } + // Decode the header value + $value = mb_decode_mimeheader($value); + mb_internal_encoding($origCharset); + } + + return $value; + } + /** * Check if a string contains multi-byte characters. * @@ -3840,7 +4029,7 @@ class PHPMailer } if (!$this->validateEncoding($encoding)) { - throw new Exception($this->lang('encoding') . $encoding); + throw new Exception(self::lang('encoding') . $encoding); } //Append to $attachment array @@ -3899,7 +4088,7 @@ class PHPMailer ) { try { if (!static::fileIsAccessible($path)) { - throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE); + throw new Exception(self::lang('file_access') . $path, self::STOP_CONTINUE); } //If a MIME type is not specified, try to work it out from the file name @@ -3908,7 +4097,7 @@ class PHPMailer } if (!$this->validateEncoding($encoding)) { - throw new Exception($this->lang('encoding') . $encoding); + throw new Exception(self::lang('encoding') . $encoding); } $filename = (string) static::mb_pathinfo($path, PATHINFO_BASENAME); @@ -3974,7 +4163,7 @@ class PHPMailer } if (!$this->validateEncoding($encoding)) { - throw new Exception($this->lang('encoding') . $encoding); + throw new Exception(self::lang('encoding') . $encoding); } //Append to $attachment array @@ -4011,7 +4200,7 @@ class PHPMailer protected function validateEncoding($encoding) { return in_array( - $encoding, + strtolower($encoding), [ self::ENCODING_7BIT, self::ENCODING_QUOTED_PRINTABLE, @@ -4231,7 +4420,7 @@ class PHPMailer } if (strpbrk($name . $value, "\r\n") !== false) { if ($this->exceptions) { - throw new Exception($this->lang('invalid_header')); + throw new Exception(self::lang('invalid_header')); } return false; @@ -4255,15 +4444,15 @@ class PHPMailer if ('smtp' === $this->Mailer && null !== $this->smtp) { $lasterror = $this->smtp->getError(); if (!empty($lasterror['error'])) { - $msg .= ' ' . $this->lang('smtp_error') . $lasterror['error']; + $msg .= ' ' . self::lang('smtp_error') . $lasterror['error']; if (!empty($lasterror['detail'])) { - $msg .= ' ' . $this->lang('smtp_detail') . $lasterror['detail']; + $msg .= ' ' . self::lang('smtp_detail') . $lasterror['detail']; } if (!empty($lasterror['smtp_code'])) { - $msg .= ' ' . $this->lang('smtp_code') . $lasterror['smtp_code']; + $msg .= ' ' . self::lang('smtp_code') . $lasterror['smtp_code']; } if (!empty($lasterror['smtp_code_ex'])) { - $msg .= ' ' . $this->lang('smtp_code_ex') . $lasterror['smtp_code_ex']; + $msg .= ' ' . self::lang('smtp_code_ex') . $lasterror['smtp_code_ex']; } } } @@ -4271,7 +4460,7 @@ class PHPMailer } /** - * Return an RFC 822 formatted date. + * Return the current date and time as an RFC 822 formatted date. * * @return string */ @@ -4281,7 +4470,51 @@ class PHPMailer //Will default to UTC if it's not set properly in php.ini date_default_timezone_set(@date_default_timezone_get()); - return date('D, j M Y H:i:s O'); + return date(self::RFC822_DATE_FORMAT); + } + + /** + * Normalise a user-supplied date into a correctly-formatted RFC 5322 date value + * string suitable for use in the Date header. + * + * Accepts: + * - A {@see \DateTime} (or \DateTimeImmutable) object + * - Any date/time string understood by PHP's DateTime constructor (RFC 5322, ISO 8601, + * Unix timestamp with leading "@", natural-language strings, etc.) + * + * Dates in the future are not permitted for email headers; if the parsed date is later + * than "now" the method falls back to the current time via {@see self::rfcDate()}. + * An empty value, a non-string/non-DateTime argument, or any value that cannot be + * parsed will likewise fall back to {@see self::rfcDate()}. + * + * @param \DateTime|\DateTimeImmutable|string $date The date to normalise + * + * @return string An RFC 5322-formatted date string + */ + private static function sanitiseDate($date) + { + try { + //Ensure the default timezone is set properly + date_default_timezone_set(@date_default_timezone_get()); + + if ($date instanceof \DateTimeInterface) { + $dt = $date; + } elseif (is_string($date) && $date !== '') { + $dt = new \DateTime($date); + } else { + //Empty string, null, or any unsupported type + return self::rfcDate(); + } + + //Reject future dates — they are invalid for outgoing message headers + if ($dt->getTimestamp() > time()) { + return self::rfcDate(); + } + + return $dt->format(self::RFC822_DATE_FORMAT); + } catch (\Exception $e) { + return self::rfcDate(); + } } /** @@ -4388,21 +4621,21 @@ class PHPMailer * * @return string */ - protected function lang($key) + protected static function lang($key) { - if (count($this->language) < 1) { - $this->setLanguage(); //Set the default language + if (count(self::$language) < 1) { + self::setLanguage(); //Set the default language } - if (array_key_exists($key, $this->language)) { + if (array_key_exists($key, self::$language)) { if ('smtp_connect_failed' === $key) { //Include a link to troubleshooting docs on SMTP connection failure. //This is by far the biggest cause of support questions //but it's usually not PHPMailer's fault. - return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting'; + return self::$language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting'; } - return $this->language[$key]; + return self::$language[$key]; } //Return the key as a fallback @@ -4417,7 +4650,7 @@ class PHPMailer */ private function getSmtpErrorMessage($base_key) { - $message = $this->lang($base_key); + $message = self::lang($base_key); $error = $this->smtp->getError(); if (!empty($error['error'])) { $message .= ' ' . $error['error']; @@ -4461,7 +4694,7 @@ class PHPMailer //Ensure name is not empty, and that neither name nor value contain line breaks if (empty($name) || strpbrk($name . $value, "\r\n") !== false) { if ($this->exceptions) { - throw new Exception($this->lang('invalid_header')); + throw new Exception(self::lang('invalid_header')); } return false; @@ -4492,10 +4725,10 @@ class PHPMailer * Converts data-uri images into embedded attachments. * If you don't want to apply these transformations to your HTML, just set Body and AltBody directly. * - * @param string $message HTML message string - * @param string $basedir Absolute path to a base directory to prepend to relative paths to images - * @param bool|callable $advanced Whether to use the internal HTML to text converter - * or your own custom converter + * @param string $message HTML message string + * @param string $basedir Absolute path to a base directory to prepend to relative paths to images + * @param bool|callable $advanced Whether to use the internal HTML to text converter + * or your own custom converter * @return string The transformed message body * * @throws Exception @@ -4504,6 +4737,12 @@ class PHPMailer */ public function msgHTML($message, $basedir = '', $advanced = false) { + $cid_domain = 'phpmailer.0'; + if (filter_var($this->From, FILTER_VALIDATE_EMAIL)) { + //prepend with a character to create valid RFC822 string in order to validate + $cid_domain = substr($this->From, strrpos($this->From, '@') + 1); + } + preg_match_all('/(? 1 && '/' !== substr($basedir, -1)) { @@ -4525,7 +4764,7 @@ class PHPMailer } //Hash the decoded data, not the URL, so that the same data-URI image used in multiple places //will only be embedded once, even if it used a different encoding - $cid = substr(hash('sha256', $data), 0, 32) . '@phpmailer.0'; //RFC2392 S 2 + $cid = substr(hash('sha256', $data), 0, 32) . '@' . $cid_domain; //RFC2392 S 2 if (!$this->cidExists($cid)) { $this->addStringEmbeddedImage( @@ -4559,7 +4798,7 @@ class PHPMailer $directory = ''; } //RFC2392 S 2 - $cid = substr(hash('sha256', $url), 0, 32) . '@phpmailer.0'; + $cid = substr(hash('sha256', $url), 0, 32) . '@' . $cid_domain; if (strlen($basedir) > 1 && '/' !== substr($basedir, -1)) { $basedir .= '/'; } @@ -4854,7 +5093,7 @@ class PHPMailer return true; } - $this->setError($this->lang('variable_set') . $name); + $this->setError(self::lang('variable_set') . $name); return false; } @@ -4992,7 +5231,7 @@ class PHPMailer { if (!defined('PKCS7_TEXT')) { if ($this->exceptions) { - throw new Exception($this->lang('extension_missing') . 'openssl'); + throw new Exception(self::lang('extension_missing') . 'openssl'); } return ''; @@ -5007,12 +5246,14 @@ class PHPMailer } if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) { if (\PHP_MAJOR_VERSION < 8) { + // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.openssl_pkey_freeDeprecated openssl_pkey_free($privKey); } return base64_encode($signature); } if (\PHP_MAJOR_VERSION < 8) { + // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.openssl_pkey_freeDeprecated openssl_pkey_free($privKey); } diff --git a/portfolio-private/PHPMailer/SMTP.php b/portfolio-private/PHPMailer/SMTP.php index 7226ee9..f9dc747 100644 --- a/portfolio-private/PHPMailer/SMTP.php +++ b/portfolio-private/PHPMailer/SMTP.php @@ -34,8 +34,9 @@ class SMTP * The PHPMailer SMTP version number. * * @var string + * @deprecated This constant will be removed in PHPMailer 8.0. Use `PHPMailer::VERSION` instead. */ - const VERSION = '6.10.0'; + const VERSION = '7.1.1'; /** * SMTP line break constant. @@ -205,6 +206,7 @@ class SMTP 'Haraka' => '/[\d]{3} Message Queued \((.*)\)/', 'ZoneMTA' => '/[\d]{3} Message queued as (.*)/', 'Mailjet' => '/[\d]{3} OK queued as (.*)/', + 'Gsmtp' => '/[\d]{3} 2\.0\.0 OK (.*) - gsmtp/', ]; /** @@ -273,6 +275,14 @@ class SMTP */ protected $last_reply = ''; + /** + * The last command sent to the server. + * Used to avoid sending QUIT while a DATA command is still in progress. + * + * @var string + */ + protected $state = ''; + /** * Output debugging info via a user-selected method. * @@ -493,7 +503,9 @@ class SMTP //PHP 5.6.7 dropped inclusion of TLS 1.1 and 1.2 in STREAM_CRYPTO_METHOD_TLS_CLIENT //so add them back in manually if we can if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { + // phpcs:ignore PHPCompatibility.Constants.NewConstants.stream_crypto_method_tlsv1_2_clientFound $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; + // phpcs:ignore PHPCompatibility.Constants.NewConstants.stream_crypto_method_tlsv1_1_clientFound $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; } @@ -632,11 +644,49 @@ class SMTP if (null === $OAuth) { return false; } - $oauth = $OAuth->getOauth64(); - - //Start authentication - if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) { - return false; + try { + $oauth = $OAuth->getOauth64(); + } catch (\Exception $e) { + // We catch all exceptions and convert them to PHPMailer exceptions to be able to + // handle them correctly later + throw new Exception("SMTP authentication error", 0, $e); + } + /* + * An SMTP command line can have a maximum length of 512 bytes, including the command name, + * so the base64-encoded OAUTH token has a maximum length of: + * 512 - 13 (AUTH XOAUTH2) - 2 (CRLF) = 497 bytes + * If the token is longer than that, the command and the token must be sent separately as described in + * https://www.rfc-editor.org/rfc/rfc4954#section-4 + */ + if ($oauth === '') { + //Sending an empty auth token is legitimate, but it must be encoded as '=' + //to indicate it's not a 2-part command + if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 =', 235)) { + return false; + } + } elseif (strlen($oauth) <= 497) { + //Authenticate using a token in the initial-response part + if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) { + return false; + } + } else { + //The token is too long, so we need to send it in two parts. + //Send the auth command without a token and expect a 334 + if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2', 334)) { + return false; + } + //Send the token + if (!$this->sendCommand('OAuth TOKEN', $oauth, [235, 334])) { + return false; + } + //If the server answers with 334, send an empty line + //a reply other than a 235 means the authentication failed, so we don't need to send anything else + if ( + strpos($this->last_reply, '334') === 0 + && !$this->sendCommand('AUTH End', '', 235) + ) { + return false; + } } break; default: @@ -721,6 +771,7 @@ class SMTP { $this->server_caps = null; $this->helo_rply = null; + $this->state = ''; if (is_resource($this->smtp_conn)) { //Close the connection and cleanup fclose($this->smtp_conn); @@ -729,6 +780,25 @@ class SMTP } } + private function iterateLines($s) + { + $start = 0; + $length = strlen($s); + + for ($i = 0; $i < $length; $i++) { + $c = $s[$i]; + if ($c === "\n" || $c === "\r") { + yield substr($s, $start, $i - $start); + if ($c === "\r" && $i + 1 < $length && $s[$i + 1] === "\n") { + $i++; + } + $start = $i + 1; + } + } + + yield substr($s, $start); + } + /** * Send an SMTP DATA command. * Issues a data command and sends the msg_data to the server, @@ -757,15 +827,16 @@ class SMTP * NOTE: this does not count towards line-length limit. */ - //Normalize line breaks before exploding - $lines = explode("\n", str_replace(["\r\n", "\r"], "\n", $msg_data)); + //Iterate over lines with normalized line breaks + $lines = $this->iterateLines($msg_data); /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field * of the first line (':' separated) does not contain a space then it _should_ be a header, and we will * process all lines before a blank line as headers. */ - $field = substr($lines[0], 0, strpos($lines[0], ':')); + $first_line = $lines->current(); + $field = substr($first_line, 0, strpos($first_line, ':')); $in_headers = false; if (!empty($field) && strpos($field, ' ') === false) { $in_headers = true; @@ -959,7 +1030,12 @@ class SMTP */ public function quit($close_on_error = true) { - $noerror = $this->sendCommand('QUIT', 'QUIT', 221); + if ($this->state === 'DATA') { + //The server would take QUIT as part of an unfinished message, so just close the connection + $noerror = true; + } else { + $noerror = $this->sendCommand('QUIT', 'QUIT', 221); + } $err = $this->error; //Save any error if ($noerror || $close_on_error) { $this->close(); @@ -1062,6 +1138,7 @@ class SMTP return false; } + $this->state = $command; $this->client_send($commandstring . static::LE, $command); $this->last_reply = $this->get_lines(); @@ -1228,7 +1305,7 @@ class SMTP * 3. EHLO has been sent - * $name == 'HELO'|'EHLO': returns the server name * $name == any other string: if extension $name exists, returns True - * or its options (e.g. AUTH mechanisms supported). Otherwise returns False. + * or its options (e.g. AUTH mechanisms supported). Otherwise, returns False. * * @param string $name Name of SMTP extension or 'HELO'|'EHLO' * @@ -1309,7 +1386,16 @@ class SMTP //stream_select returns false when the `select` system call is interrupted //by an incoming signal, try the select again - if (stripos($message, 'interrupted system call') !== false) { + if ( + stripos($message, 'interrupted system call') !== false || + ( + // on applications with a different locale than english, the message above is not found because + // it's translated. So we also check for the SOCKET_EINTR constant which is defined under + // Windows and UNIX-like platforms (if available on the platform). + defined('SOCKET_EINTR') && + stripos($message, 'stream_select(): Unable to select [' . SOCKET_EINTR . ']') !== false + ) + ) { $this->edebug( 'SMTP -> get_lines(): retrying stream_select', self::DEBUG_LOWLEVEL diff --git a/portfolio-private/smtp-config.example.php b/portfolio-private/smtp-config.example.php index 4801809..2f34984 100644 --- a/portfolio-private/smtp-config.example.php +++ b/portfolio-private/smtp-config.example.php @@ -14,13 +14,13 @@ return [ // (Proton: Settings > All settings > Proton Mail > IMAP/SMTP > SMTP tokens). // A @proton.me / @pm.me address will NOT work here: Proton only issues // SMTP tokens for custom-domain addresses. - 'smtp_user' => 'contact@nelson-thomas.fr', + 'smtp_user' => 'contact@your-domain.tld', // The token itself (not your Proton password). 'smtp_token' => 'PASTE_YOUR_SMTP_TOKEN_HERE', // Where the messages are delivered. Can be any of your addresses. - 'to' => 'nelson.thomas.contact@pm.me', + 'to' => 'you@example.com', // Only these sites may post to the form (scheme + host, no trailing slash). 'allowed_origins' => [ diff --git a/www/.htaccess b/www/.htaccess new file mode 100644 index 0000000..e63a71c --- /dev/null +++ b/www/.htaccess @@ -0,0 +1,25 @@ +# Apache uniquement (ignoré par Nginx) +ErrorDocument 404 /404.html +Options -Indexes + + + Header always set Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self'; font-src 'self'; img-src 'self' data:; connect-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'self'; object-src 'none'" + Header always set X-Content-Type-Options "nosniff" + Header always set Referrer-Policy "strict-origin-when-cross-origin" + Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()" + Header always set X-Frame-Options "DENY" + + Header set Cache-Control "public, max-age=2592000" + + + Header set Cache-Control "no-cache" + + + +# Seul contact.php peut être exécuté + + Require all denied + + + Require all granted + diff --git a/www/404.html b/www/404.html new file mode 100644 index 0000000..a3ff528 --- /dev/null +++ b/www/404.html @@ -0,0 +1,25 @@ + + + + + + +Page not found – Nelson Thomas + + + + + + +
+
+
$ traceroute this-page
+
1nelson-thomas.frokReached the site
+
2* * *404This page does not exist
+
+

Page not found

+

The link may be old or mistyped.

+ Back to the portfolio +
+ + diff --git a/www/contact.php b/www/contact.php index 4d6ee69..8e44bb6 100644 --- a/www/contact.php +++ b/www/contact.php @@ -38,6 +38,7 @@ require $private . '/PHPMailer/SMTP.php'; // ---------- Request checks ---------- if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'POST') { + header('Allow: POST'); reply(405, false, 'Method not allowed.'); } $origin = $_SERVER['HTTP_ORIGIN'] ?? ''; @@ -97,15 +98,15 @@ if (count($hits) >= (int) ($cfg['max_per_hour'] ?? 5)) { $mail = new PHPMailer(true); try { $mail->isSMTP(); - $mail->Host = $cfg['smtp_host'] ?? 'smtp.protonmail.ch'; - $mail->Port = (int) ($cfg['smtp_port'] ?? 587); - $mail->SMTPSecure = $cfg['smtp_secure'] ?? PHPMailer::ENCRYPTION_STARTTLS; + $mail->Host = $cfg['smtp_host'] ?? 'smtp.protonmail.ch'; + $mail->Port = (int) ($cfg['smtp_port'] ?? 587); + $mail->SMTPSecure = $cfg['smtp_secure'] ?? PHPMailer::ENCRYPTION_STARTTLS; $mail->SMTPAutoTLS = $mail->SMTPSecure !== ''; - $mail->SMTPAuth = $cfg['smtp_auth'] ?? true; - $mail->Username = $cfg['smtp_user']; - $mail->Password = $cfg['smtp_token']; - $mail->CharSet = PHPMailer::CHARSET_UTF8; - $mail->Timeout = 15; + $mail->SMTPAuth = $cfg['smtp_auth'] ?? true; + $mail->Username = $cfg['smtp_user']; + $mail->Password = $cfg['smtp_token']; + $mail->CharSet = PHPMailer::CHARSET_UTF8; + $mail->Timeout = 15; // Proton only accepts the address tied to the token as sender. $mail->setFrom($cfg['smtp_user'], 'Portfolio: ' . $name); diff --git a/www/css/fonts.css b/www/css/fonts.css new file mode 100644 index 0000000..b738016 --- /dev/null +++ b/www/css/fonts.css @@ -0,0 +1,9 @@ +/* Self-hosted fonts (SIL Open Font License, see fonts/OFL-*.txt). Latin subset. */ +@font-face{font-family:"Chakra Petch";font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/chakra-petch-500.woff2) format("woff2")} +@font-face{font-family:"Chakra Petch";font-style:normal;font-weight:600;font-display:swap;src:url(../fonts/chakra-petch-600.woff2) format("woff2")} +@font-face{font-family:"Chakra Petch";font-style:normal;font-weight:700;font-display:swap;src:url(../fonts/chakra-petch-700.woff2) format("woff2")} +@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/ibm-plex-sans-400.woff2) format("woff2")} +@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/ibm-plex-sans-500.woff2) format("woff2")} +@font-face{font-family:"IBM Plex Sans";font-style:normal;font-weight:600;font-display:swap;src:url(../fonts/ibm-plex-sans-600.woff2) format("woff2")} +@font-face{font-family:"IBM Plex Mono";font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/ibm-plex-mono-400.woff2) format("woff2")} +@font-face{font-family:"IBM Plex Mono";font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/ibm-plex-mono-500.woff2) format("woff2")} diff --git a/www/css/style.css b/www/css/style.css index ed40739..d0504ff 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -48,7 +48,7 @@ nav a::after{content:"";position:absolute;left:.75rem;right:.75rem;bottom:.15rem nav a.active{color:var(--text)} nav a.active::after{transform:scaleX(1)} header::after{content:"";position:absolute;left:0;bottom:-1px;height:1px;width:var(--progress,0%);background:var(--proton-soft)} -.theme{background:none;border:1px solid var(--line);color:var(--muted);border-radius:6px;padding:.35rem .55rem;cursor:pointer;font-size:.9rem} +.theme{display:inline-grid;place-items:center;background:none;border:1px solid var(--line);color:var(--muted);border-radius:6px;padding:.35rem .55rem;cursor:pointer;font-size:.9rem} main{max-width:1080px;margin:0 auto;padding:2.5rem 1.25rem 2rem} html{scroll-behavior:smooth;scroll-padding-top:calc(env(safe-area-inset-top,0px) + 4.5rem)} @@ -66,7 +66,7 @@ p{margin:0 0 1rem;max-width:68ch} /* Hero: traceroute */ .hero{display:grid;grid-template-columns:1.1fr 1fr;gap:2.5rem;align-items:center;margin-bottom:3rem} .avatar{box-shadow:0 0 0 4px color-mix(in srgb,var(--proton) 25%,transparent);width:96px;height:96px;border-radius:50%;display:grid;place-items:center;font:700 1.8rem var(--display); - background:var(--surface-2);border:2px dashed var(--todo);color:var(--todo);margin-bottom:1.2rem} + background:var(--grad);color:#fff;margin-bottom:1.2rem} .role{font:500 1.1rem var(--display);color:var(--proton-soft);margin-bottom:1rem} .trace{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:1.1rem 1.2rem;font:400 .86rem/1.75 var(--mono);overflow-x:auto} .trace .cmd{color:var(--muted);margin-bottom:.4rem} @@ -94,15 +94,8 @@ dl.star dt{color:var(--muted)} dl.star dd{margin:0} .tags span{font-size:.8rem;padding:.15rem .55rem;border-radius:4px;background:var(--surface-2);color:var(--muted)} .result{color:var(--signal);font-weight:500} -.todo{border:1px dashed var(--todo);border-radius:6px;padding:.1rem .4rem;color:var(--todo);font-size:.95em} -.item.todo-box{border-style:dashed;border-color:var(--todo)} .sub{margin:2.5rem 0 1rem;font:600 1.25rem var(--display);color:var(--text)} -.checklist{list-style:none;padding:0;margin:0 0 2rem;display:grid;gap:.5rem;max-width:720px} -.checklist li{display:flex;gap:.7rem;align-items:flex-start;padding:.7rem .9rem;background:var(--surface);border:1px solid var(--line);border-radius:8px} -.checklist .st{flex:none;width:1.3rem;height:1.3rem;border-radius:50%;border:2px solid var(--todo);margin-top:.15rem} -.checklist .st.ok{border-color:var(--signal);background:var(--signal)} -.video{aspect-ratio:16/9;display:grid;place-items:center;background:var(--surface-2);border:1px dashed var(--todo);border-radius:10px;color:var(--todo);text-align:center;padding:1rem} .meter{height:10px;background:var(--surface-2);border-radius:5px;overflow:hidden;margin:.6rem 0 .3rem;max-width:520px} .meter i{display:block;height:100%;width:0;background:var(--proton-soft)} @@ -124,19 +117,17 @@ input:user-invalid,textarea:user-invalid{border-color:var(--rose)} .direct{display:grid;gap:.6rem;margin-top:1.2rem} @media (max-width:820px){.contact{grid-template-columns:1fr}.row{grid-template-columns:1fr}} /* Hover: frames lift slightly and pick up the Proton purple */ -.item,.checklist li,.trace,.form,.video,.btn,.tags span{transition:transform .25s ease,border-color .25s ease,box-shadow .25s ease,background-color .25s ease} +.item,.trace,.form,.btn,.tags span{transition:transform .25s ease,border-color .25s ease,box-shadow .25s ease,background-color .25s ease} @media (hover:hover){ - .item:hover,.trace:hover,.form:hover,.video:hover{transform:translateY(-3px);border-color:var(--proton-soft); + .item:hover,.trace:hover,.form:hover{transform:translateY(-3px);border-color:var(--proton-soft); box-shadow:0 10px 28px -12px color-mix(in srgb,var(--proton) 55%,transparent)} - .item.todo-box:hover{border-color:var(--todo)} - .checklist li:hover{transform:translateX(4px);border-color:var(--proton-soft)} .btn:hover{transform:translateY(-2px);border-color:var(--proton-soft);box-shadow:0 6px 18px -8px color-mix(in srgb,var(--proton) 70%,transparent)} .btn.primary:hover{background:var(--proton-soft);filter:none} .item:hover .tags span{background:color-mix(in srgb,var(--proton) 22%,var(--surface-2));color:var(--text)} .form button:hover{transform:translateY(-1px)} } @media (prefers-reduced-motion:reduce){ - .item:hover,.trace:hover,.form:hover,.video:hover,.checklist li:hover,.btn:hover,.form button:hover{transform:none} + .item:hover,.trace:hover,.form:hover,.btn:hover,.form button:hover{transform:none} } .cover{display:block;width:100%;height:auto;aspect-ratio:16/9;object-fit:cover;border-radius:8px;margin-bottom:1rem;background:var(--surface-2)} .civic-head{display:flex;justify-content:space-between;align-items:baseline;gap:.8rem} @@ -225,6 +216,10 @@ footer{border-top:1px solid var(--line);text-align:center;padding:1.5rem 1rem;co @keyframes certIn{from{opacity:0;transform:scale(.97)}} @media (prefers-reduced-motion:reduce){.cert-viewer[open]{animation:none}} +/* School logo chip over the timeline photo */ +.place-logo{position:absolute;right:12px;top:74px;display:block;padding:5px 9px;line-height:0;background:#fff;border-radius:8px;box-shadow:0 6px 16px -6px rgba(0,0,0,.55);transition:transform .25s ease} +.place-logo img{display:block;height:28px;width:auto;max-width:none} +@media (hover:hover){.place-logo:hover{transform:translateY(-2px)}} /* Toolbox icons */ .toolbox{margin-top:2.5rem} .toolbox .sub{margin-top:0} @@ -345,3 +340,38 @@ footer p{margin:0} .tl-scroll.fade-r{-webkit-mask-image:linear-gradient(90deg,#000 0,#000 calc(100% - 48px),transparent);mask-image:linear-gradient(90deg,#000 0,#000 calc(100% - 48px),transparent)} .tl-scroll.fade-l{-webkit-mask-image:linear-gradient(90deg,transparent,#000 48px,#000 100%);mask-image:linear-gradient(90deg,transparent,#000 48px,#000 100%)} .tl-scroll.fade-l.fade-r{-webkit-mask-image:linear-gradient(90deg,transparent,#000 48px,#000 calc(100% - 48px),transparent);mask-image:linear-gradient(90deg,transparent,#000 48px,#000 calc(100% - 48px),transparent)} +/* Project with a side image (featured card) */ +.item.with-media{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.35fr);gap:1.5rem;align-items:center} +.item.with-media .media{display:block;width:100%;height:100%;min-height:220px;max-height:300px;object-fit:cover;border-radius:8px} +@media (max-width:820px){.item.with-media{grid-template-columns:1fr}.item.with-media .media{min-height:0;max-height:none;aspect-ratio:4/3;height:auto}} + +/* Career cards: keep the action buttons at the bottom */ +#career .item{display:flex;flex-direction:column;align-items:flex-start} +#career .item>.btn,#career .cv-links{margin-top:auto} +#career .cv-links{display:flex;margin-bottom:0} + +/* 404 page */ +.notfound{max-width:640px;min-height:100vh;display:grid;align-content:center;gap:1.2rem;padding:2rem 1.25rem} +.notfound h1{margin:0} + +/* Former inline styles (moved here so a strict Content-Security-Policy can block inline CSS) */ +.u-019d5f{left:4.76% !important;width:78.57% !important} +.u-054622{animation-delay:.5s !important} +.u-084650{animation-delay:1.4s !important} +.u-2133b3{left:47.62% !important} +.u-465ef4{object-position:50% 38% !important} +.u-4913bb{left:9.52% !important} +.u-51037d{width:12.5% !important} +.u-554682{width:34.9% !important} +.u-603952{left:66.67% !important} +.u-6e5a89{animation-delay:1.1s !important} +.u-6f748d{left:71.43% !important} +.u-75bc8d{left:90.48% !important;width:9.52% !important} +.u-7d53d2{height:20px !important;margin:4px 2px !important} +.u-925d61{object-position:50% 12% !important} +.u-ae93b7{animation-delay:.8s !important} +.u-bd9c6a{left:42.86% !important} +.u-c55905{left:21.43% !important} +.u-cf3fb6{left:14.29% !important} +.u-d46287{animation-delay:.2s !important} +.u-ed50ea{left:92.86% !important} diff --git a/www/favicon.svg b/www/favicon.svg new file mode 100644 index 0000000..810bcfd --- /dev/null +++ b/www/favicon.svg @@ -0,0 +1 @@ +NT diff --git a/www/fonts/OFL-ChakraPetch.txt b/www/fonts/OFL-ChakraPetch.txt new file mode 100644 index 0000000..6b156fb --- /dev/null +++ b/www/fonts/OFL-ChakraPetch.txt @@ -0,0 +1,93 @@ +Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) ChakraPetch-LightItalic.ttf: Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) ChakraPetch-Regular.ttf: Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) ChakraPetch-Italic.ttf: Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) ChakraPetch-Medium.ttf: Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) ChakraPetch-MediumItalic.ttf: Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) ChakraPetch-SemiBold.ttf: Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) ChakraPetch-SemiBoldItalic.ttf: Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) ChakraPetch-Bold.ttf: Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) ChakraPetch-BoldItalic.ttf: Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/www/fonts/OFL-IBMPlex.txt b/www/fonts/OFL-IBMPlex.txt new file mode 100644 index 0000000..2ae8ef3 --- /dev/null +++ b/www/fonts/OFL-IBMPlex.txt @@ -0,0 +1,93 @@ +Copyright 2019 IBM Corp. All rights reserved. IBMPlexSans-Italic[wdth,wght].ttf: Copyright 2019 IBM Corp. All rights reserved. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/www/fonts/chakra-petch-500.woff2 b/www/fonts/chakra-petch-500.woff2 new file mode 100644 index 0000000..ff49854 Binary files /dev/null and b/www/fonts/chakra-petch-500.woff2 differ diff --git a/www/fonts/chakra-petch-600.woff2 b/www/fonts/chakra-petch-600.woff2 new file mode 100644 index 0000000..e4d90d5 Binary files /dev/null and b/www/fonts/chakra-petch-600.woff2 differ diff --git a/www/fonts/chakra-petch-700.woff2 b/www/fonts/chakra-petch-700.woff2 new file mode 100644 index 0000000..de88f23 Binary files /dev/null and b/www/fonts/chakra-petch-700.woff2 differ diff --git a/www/fonts/ibm-plex-mono-400.woff2 b/www/fonts/ibm-plex-mono-400.woff2 new file mode 100644 index 0000000..0804aaf Binary files /dev/null and b/www/fonts/ibm-plex-mono-400.woff2 differ diff --git a/www/fonts/ibm-plex-mono-500.woff2 b/www/fonts/ibm-plex-mono-500.woff2 new file mode 100644 index 0000000..090f82f Binary files /dev/null and b/www/fonts/ibm-plex-mono-500.woff2 differ diff --git a/www/fonts/ibm-plex-sans-400.woff2 b/www/fonts/ibm-plex-sans-400.woff2 new file mode 100644 index 0000000..f0ee65d Binary files /dev/null and b/www/fonts/ibm-plex-sans-400.woff2 differ diff --git a/www/fonts/ibm-plex-sans-500.woff2 b/www/fonts/ibm-plex-sans-500.woff2 new file mode 100644 index 0000000..6d5527e Binary files /dev/null and b/www/fonts/ibm-plex-sans-500.woff2 differ diff --git a/www/fonts/ibm-plex-sans-600.woff2 b/www/fonts/ibm-plex-sans-600.woff2 new file mode 100644 index 0000000..08c0d5a Binary files /dev/null and b/www/fonts/ibm-plex-sans-600.woff2 differ diff --git a/www/img/certs/badge-ccna-itn.png b/www/img/certs/badge-ccna-itn.png new file mode 100644 index 0000000..98aed57 Binary files /dev/null and b/www/img/certs/badge-ccna-itn.png differ diff --git a/www/img/logos/itrust.png b/www/img/logos/itrust.png new file mode 100644 index 0000000..94c15fc Binary files /dev/null and b/www/img/logos/itrust.png differ diff --git a/www/img/logos/iut-blagnac.png b/www/img/logos/iut-blagnac.png new file mode 100644 index 0000000..6ffedfd Binary files /dev/null and b/www/img/logos/iut-blagnac.png differ diff --git a/www/img/logos/paul-sabatier.png b/www/img/logos/paul-sabatier.png new file mode 100644 index 0000000..a8756ee Binary files /dev/null and b/www/img/logos/paul-sabatier.png differ diff --git a/www/img/og-card.png b/www/img/og-card.png new file mode 100644 index 0000000..beddf51 Binary files /dev/null and b/www/img/og-card.png differ diff --git a/www/img/projects/fog-lab-reimaging.jpg b/www/img/projects/fog-lab-reimaging.jpg new file mode 100644 index 0000000..1acaa8d Binary files /dev/null and b/www/img/projects/fog-lab-reimaging.jpg differ diff --git a/www/img/projects/sae32-m5stack.jpg b/www/img/projects/sae32-m5stack.jpg new file mode 100644 index 0000000..4273b0e Binary files /dev/null and b/www/img/projects/sae32-m5stack.jpg differ diff --git a/www/img/projects/sae512-reconstructed-screen.jpg b/www/img/projects/sae512-reconstructed-screen.jpg new file mode 100644 index 0000000..cf3382a Binary files /dev/null and b/www/img/projects/sae512-reconstructed-screen.jpg differ diff --git a/www/index.html b/www/index.html index fb3043e..34d3d2f 100644 --- a/www/index.html +++ b/www/index.html @@ -4,25 +4,35 @@ - + + + + + + + + + + + Nelson Thomas – ePortfolio - - - - + + + + +
Nelson Thomas - +
-
Cisco logo
+
CCNA: Introduction to Networks badge

CCNA: Introduction to Networks

Cisco Networking Academy · Apr 2024
@@ -272,7 +286,7 @@

A hands-on certification covering both offensive and defensive basics: finding common vulnerabilities, basic exploitation and post-exploitation, SIEM-assisted monitoring, network traffic and log analysis, intrusion detection, and reporting on security issues in enterprise environments.

Junior Cybersecurity Analyst path34.9%
-
+
PentestingSIEM monitoringLog analysisIntrusion detection
@@ -288,24 +302,12 @@

Projects

-

Each project follows the same frame: the context, what I did, the tools, and what came out of it. Company work is described without confidential details.

- -

In my company

-
-
-

[Apprenticeship mission title]

-
[Company], 2026 to now
-
-
Context
[Team and need, in one line, no client names]
-
My part
[What you are responsible for]
-
Result
[A number, a delivery or a decision. Check with your tutor before publishing.]
-
-
-
+

Each project follows the same frame: the context, what I did, the tools, and what came out of it.

Internships

+ Lab laptops being re-imaged at the same time over the network

Automated lab re-imaging

IUT de Blagnac, network technician intern, 2025
@@ -340,14 +342,18 @@

Academic

-

Career

-

One real job ad drives everything below: the CV, the cover letter, my LinkedIn headline and my pitch.

- -
    -
  • Target job ad
    [Title, company, link or screenshot]
  • -
  • CV
    CV in English (PDF)CV in French (PDF) [tailor the English one to the ad, add the apprenticeship]
  • -
  • Cover letter in English
    [Answer the ad point by point]
  • -
  • LinkedIn
    linkedin.com/in/nelson-thomas-pr [set the apprenticeship as current position]
  • -
  • Two My Job Glasses interviews
    [0 of 2 done]
  • -
  • Elevator pitch video
    [3 min ± 30 s, spoken, not read]
  • -
- +

I'm aiming for defensive security: detection engineering, SOC work and secure network architecture. Here is where to find my CV and follow my path.

-
-

Elevator pitch

-
Embed your YouTube (unlisted) or Vimeo video here.
Present, then a very short past, then where you're heading.
-
-
-

Interview 1: [Name, job, company]

-
-
Why
[e.g. a SOC or CERT analyst, the job I'm aiming for]
-
Learnt
[2–3 concrete takeaways]
-
+ -
-

Interview 2: [Name, job, company]

-
-
Why
[e.g. a network security architect, the other path]
-
Learnt
[2–3 concrete takeaways]
-
+
+

LinkedIn

+

My up-to-date profile, experience and recommendations.

+ View my profile
- -
-

Mobility

-

Seventeen weeks abroad in S9. Three options, why each one fits, and whether my employer can make it work. [The three below are suggestions: keep, swap or rewrite them.]

-
-
-

Tallinn, Estonia

-
Option 1
-
-
Why
Home of the NATO cyber defence centre and one of Europe's most digitised states.
-
Employer fit
[Does the company have partners or clients in the Baltics?]
-
-
-
-

Montréal, Canada

-
Option 2
-
-
Why
Large cybersecurity sector, French and English working environment.
-
Employer fit
[Subsidiary, partner lab, or university exchange?]
-
-
-
-

Dublin, Ireland

-
Option 3
-
-
Why
European base for many cloud providers, full English immersion to push past B2.
-
Employer fit
[Ask your tutor about timing within the apprenticeship calendar]
-
-
-
-
@@ -466,7 +418,7 @@
  • TryHackMe (tryhackme.com, opens in a new tab)
  • Root-Me (root-me.org, opens in a new tab)
  • -

    Photography

    Nature, wildlife and landmarks, including drone shots. [Add 3–4 of your photos]

    +

    Photography

    Nature, wildlife and landmarks, including drone shots.

    Geopolitics

    Following world affairs, which often explains the threats a SOC ends up seeing.

    @@ -474,8 +426,8 @@

    Civic engagement

    -

    Forty hours required by S9. Here is what's done and what's planned.

    -
    +

    Volunteering and awareness actions, with a goal of forty hours over my engineering degree.

    +

    5 of 40 hours completed

    @@ -484,6 +436,7 @@
    Interactive theatre,

    An interactive play about sexual and gender-based violence. The audience takes part in the story, which opens a discussion on how to recognise this violence, react as a witness and support the people affected.

    AwarenessSexual & gender-based violence
    + See the event (University of Toulouse, opens in a new tab)
    Volunteer in gloves picking up a plastic bottle from the grass @@ -492,11 +445,6 @@

    A group walk through the streets of Toulouse to collect litter and keep it out of drains and green spaces.

    EnvironmentLocal action
    -
    -

    [Next action]

    -

    [35 hours to go: e.g. cyber-awareness sessions for a school or an association, digital help for seniors, N7 student association]

    -
    [hours, dates]
    -
    @@ -530,6 +478,6 @@

    © 2026 Nelson Thomas. Toulouse, France.

    - + diff --git a/www/js/main.js b/www/js/main.js index e065bf0..8e2e727 100644 --- a/www/js/main.js +++ b/www/js/main.js @@ -8,7 +8,6 @@ var LINKEDIN_URL = "https://www.linkedin.com/in/nelson-thomas-pr/"; (function(){ var root=document.documentElement; - try{var s=localStorage.getItem('theme');if(s)root.dataset.theme=s}catch(e){} document.getElementById('theme').addEventListener('click',function(){ var dark=root.dataset.theme?root.dataset.theme==='dark':!matchMedia('(prefers-color-scheme: light)').matches; root.dataset.theme=dark?'light':'dark'; diff --git a/www/js/theme.js b/www/js/theme.js new file mode 100644 index 0000000..be7f6fd --- /dev/null +++ b/www/js/theme.js @@ -0,0 +1,2 @@ +/* Apply the saved light/dark choice before the page paints (no flash). */ +try{var t=localStorage.getItem('theme');if(t==='light'||t==='dark')document.documentElement.dataset.theme=t}catch(e){} diff --git a/www/robots.txt b/www/robots.txt new file mode 100644 index 0000000..d79fc43 --- /dev/null +++ b/www/robots.txt @@ -0,0 +1,5 @@ +User-agent: * +Allow: / +Disallow: /contact.php + +Sitemap: https://nelson-thomas.fr/sitemap.xml diff --git a/www/sitemap.xml b/www/sitemap.xml new file mode 100644 index 0000000..f2bf7fd --- /dev/null +++ b/www/sitemap.xml @@ -0,0 +1,4 @@ + + + https://nelson-thomas.fr/2026-10-12 +