Project

General

Profile

Actions

Feature #102761

closed

Introduce class for HMAC generation

Added by Torben Hansen 11 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
Start date:
2024-01-05
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

The core currently has the following functions or classes to create HMACs:

  1. GeneralUtility::hmac($input, $additionalSecret = '')
  2. Extbase HashService with generateHmac(string $string), appendHmac(string $string), validateHmac(string $string, string $hmac) and validateAndStripHmac(string $string)

The GeneralUtility::hmac($input, $additionalSecret = '') is used in several places in TYPO3 core and allows to provide an $additionalSecret. If the additional secret is used, it is safe to create hashed for the same input in a different context. If however the additional secret is left blank, the same input will result in the same HMAC, which is bad in terms of security, since a calculated HMAC possibly can be reused in a different context.

Example:
  • Extension 1 used GeneralUtility::hmac('1') to calculate a HMAC. This HMAC is used in a extbase action confirmNewsletterSubscription(int $uid, string $hmac)
  • Extension 2 uses GeneralUtility::hmac('1') to calculate a HMAC. This HMAC is used in a extbase action deleteUser(int $userId, string $hmac)

The HMAC generated my extension 1 for $uid === 1 can be reused in extension 2, since no additional secret is provided.

The Extbase HashService does not allow to provide any additional secret, so calculated HMACs will always be equal for the same value but in different context.

TYPO3 should have a dedicated class, which combines the fuctionality of GeneralUtility::hmac() and extbase HashService. The additional secret should be a mandatory parameter and not be empty.


Related issues 8 (0 open8 closed)

Related to TYPO3 Core - Task #102763: Deprecate Extbase HashServiceClosedTorben Hansen2024-01-05

Actions
Related to TYPO3 Core - Task #102762: Deprecate GeneralUtility::hmac()ClosedTorben Hansen2024-01-05

Actions
Related to TYPO3 Core - Task #103245: Replace GeneralUtility::hmac usage with HashServiceClosedTorben Hansen2024-03-02

Actions
Related to TYPO3 Core - Task #103251: Replace GeneralUtility::hmac usage in ext:installClosed2024-03-02

Actions
Related to TYPO3 Core - Task #103320: Remove internal declaration for hashService property in actionControllerClosedTorben Hansen2024-03-07

Actions
Related to TYPO3 Core - Task #103248: Replace GeneralUtility::hmac usage in ext:coreClosedTorben Hansen2024-03-02

Actions
Related to TYPO3 Core - Task #103249: Replace GeneralUtility::hmac usage in ext:formClosedTorben Hansen2024-03-02

Actions
Related to TYPO3 Core - Task #103247: Replace GeneralUtility::hmac usage in ext:backendClosedTorben Hansen2024-03-02

Actions
Actions #1

Updated by Torben Hansen 11 months ago

  • Subtask #102762 added
Actions #2

Updated by Torben Hansen 11 months ago

  • Subtask #102763 added
Actions #3

Updated by Gerrit Code Review 11 months ago

  • Status changed from New to Under Review

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80394

Actions #4

Updated by Gerrit Code Review 11 months ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80394

Actions #5

Updated by Gerrit Code Review 11 months ago

Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80394

Actions #6

Updated by Gerrit Code Review 11 months ago

Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80394

Actions #7

Updated by Gerrit Code Review 10 months ago

Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80394

Actions #8

Updated by Gerrit Code Review 10 months ago

Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80394

Actions #9

Updated by Gerrit Code Review 10 months ago

Patch set 11 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80394

Actions #10

Updated by Torben Hansen 10 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #11

Updated by Torben Hansen 10 months ago

  • Subtask deleted (#102763)
Actions #12

Updated by Torben Hansen 10 months ago

  • Related to Task #102763: Deprecate Extbase HashService added
Actions #13

Updated by Torben Hansen 9 months ago

  • Subtask deleted (#102762)
Actions #14

Updated by Torben Hansen 9 months ago

  • Related to Task #102762: Deprecate GeneralUtility::hmac() added
Actions #15

Updated by Torben Hansen 9 months ago

  • Related to Task #103245: Replace GeneralUtility::hmac usage with HashService added
Actions #16

Updated by Julian Lichte 9 months ago

  • Related to Task #103251: Replace GeneralUtility::hmac usage in ext:install added
Actions #17

Updated by Christian Kuhn 9 months ago

  • Related to Task #103320: Remove internal declaration for hashService property in actionController added
Actions #18

Updated by Christian Kuhn 9 months ago

  • Related to Task #103248: Replace GeneralUtility::hmac usage in ext:core added
Actions #19

Updated by Christian Kuhn 9 months ago

  • Related to Task #103249: Replace GeneralUtility::hmac usage in ext:form added
Actions #20

Updated by Christian Kuhn 9 months ago

  • Related to Task #103247: Replace GeneralUtility::hmac usage in ext:backend added
Actions #21

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF