Skip to content

Cloudflare blocks sign PDF #280

@MichalY-WizSoft

Description

@MichalY-WizSoft
  • Generate PDF using JSPDF
  • Merge PDFs using PDF-MERGER
  • Add signature placeholder using pdflibAddPlaceholder
  • Sign the PDF
  • Try to upload to system -> Cloudflare blocks with WAF alerts
  • When switching to plainAddPlaceholder, the upload works but the signature is not visible in Adobe Reader
  • what the difrent and how to do not block and visible in Adobe Reader ?

Attachments

  • [signed_pdflib.pdf] - PDF signed with pdflibAddPlaceholder
  • [signed_plain.pdf] - PDF signed with plainAddPlaceholder
  • [cloudflare_block.png] - Screenshot of Cloudflare WAF block

signed_plain.pdf
signed_pdflib.pdf
cloudflare_block

const signPdf = async (pdfBuffer, signer) => {
    try {
        const pdfWithPlaceholder = await plainAddPlaceholder({
            pdfBuffer,
            reason: 'Digital Invoice Signature',
            contactInfo: 'Wizsoft',
            name: 'Wizsoft Digital Signature',
            location: 'Israel',
            signingTime: new Date().toISOString(),
            signatureLength: 8192,
            subFilter: 'adbe.pkcs7.detached',
            appName: 'Wizsoft Digital Signature System',
            widgetRect: [0, 0, 595, 842]
        });    
        return signpdf.sign(pdfWithPlaceholder, signer);
    } catch (err) {
        throw {message:`signature faild, error : ${err}`};
    }
}

const signPdfLib = async (pdfBuffer,  signer) =>{
    try {
        let pdfDoc = await PDFDocument.load(pdfBuffer);
        await pdflibAddPlaceholder({
            pdfDoc: pdfDoc,
            reason: 'Digital Invoice Signature',
            contactInfo: '',
            name: 'Digital Signature',
            location: 'Israel',
            signingTime: new Date().toISOString(),
            signatureLength: 8192,
            subFilter: 'adbe.pkcs7.detached',
        });
        pdfWithPlaceholder = await Buffer.from(await pdfDoc.save({useObjectStreams: false }), 'arraybuffer');
        return signpdf.sign(pdfWithPlaceholder, signer)                    
    } catch (err) {
        throw {message:`signature faild, error : ${err}`};
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions