Repository navigation
F/os 303 digital signature security - #385
Conversation
…_digital_signature_security * commit '100e15f20d3d26f5d9950134282b74bea48aa960': (42 commits) 312: Set #parents before building handler configuration forms Computed twig encryption fix (#380) #321 deleting SaveToFile handler (#382) Fixing autocomplete fields usage (#381) Add missing trailing comma Applied map display settings consistently Remove delete state from handlers and require php 8.3 Preparing 6.1.0 Bumped os2web_datalookup version Apply coding standards Ensure no attachments with export type html are signed Run handler conditions before adding signature validation text Upgrading Gin theme OS-320 SBSYS child elements integration (#365) Fixing translation setting page (#359) Synching develop with master changes (#364) Preparing release 6.0.0 #355 OS-314 children select element '#address_protection_help_text' fix 352: Code cleanup 352: Updated CHANGELOG ... # Conflicts: # modules/os2forms_digital_signature/src/Plugin/WebformHandler/DigitalSignatureWebformHandler.php
|
@MadNicGit vil I lave review på dette PR. Det er ikke et issue på dette PR af sikkerhedsmæssige årsager. Spørg evt. Gitte efter en mail jeg lige har sendt til Koordinationsgruppen. |
|
|
||
| /** @var \Drupal\webform\Plugin\WebformElementAttachmentInterface $elementPlugin */ | ||
| $elementPlugin = $this->elementManager->getElementInstance($element); | ||
| $attachments = $elementPlugin->getEmailAttachments($element, $webformSubmission); |
There was a problem hiding this comment.
Am i right in saying that the resolve method is used in preSave() to render and get the actual content of the attachment file?
But then it is also used during signCallback() just for the purpose of finding the fid? Is it not possible to use a more light-weight method of finding the fid?
There was a problem hiding this comment.
I agree that mechanism of fetching fid is quite complex.
One reason for the security refactoring was to prevent FID manipulation through the request. Previously, the callback route included {fid}:
before change:
path: '/os2forms_digital_signature/{uuid}/{hash}/sign_callback/{fid}'
after the change
path: '/os2forms_digital_signature/{uuid}/{hash}/sign_callback'
We therefore need to determine the target file server-side, using the submission and the handler’s configured attachment element. We could store the target when initiating signing, but resolving it from the submission avoids managing additional state.
However, you’re right that calling resolve() does unnecessary work here: the callback only needs the FID, while resolve() also loads or generates the attachment content. We could extract the element lookup and validation into a shared method so the callback skips that work.
Did you have another approach in mind? Open to suggestions 😃
There was a problem hiding this comment.
I did not. Extracting the logic they have common into a separate shared method seems like a good idea!
| // SwiftMailer and Mime Mail consume filecontent rather than filepath. | ||
| if (($this->moduleHandler->moduleExists('swiftmailer') | ||
| || $this->moduleHandler->moduleExists('mimemail')) | ||
| && isset($attachment['filecontent'], $attachment['filepath'])) { | ||
| unset($attachment['filepath']); | ||
| } |
There was a problem hiding this comment.
We don't use either of these modules. Do you?
There was a problem hiding this comment.
i checked, we don't use them either.
there are left there from the older versions. I think this piece is still valid, should anyone start using these or similar modules.
but if that bothers you, we can also remove it.
There was a problem hiding this comment.
If neither of us use it i think we should remove it
|
Hej @ds-bellcom |
Yes, det har jeg set. Jeg håber Stan kan få det færdiggjort inden længe. |
No description provided.