ProtonMail / ProtonMail/libsieve-php

No To or Cc does not match

Open
#42 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
25
Forks
9
Avg merge
6m
Merged PRs (30d)
3

Description

Hi,

The following expression

allof(
        anyof(not exists "to", address :is "to" ""),
        anyof(not exists "cc", address :is "cc" "")
)

does not seem to match messages containing no 'Cc' header and the following 'To'-header:

To: Undisclosed recipients:;

which I find strange as 'To' contains no valid address and 'Cc' does not exist.

I maybe just have taken for granted that address "whateverheader" would match the emtpy string if the header exists but contains no valid address ... but I've not been able to find out exactly what it is set to in your Sieve-implementation when the header exists and contains data without a valid address.

... I could do it differently I guess matching 'To' and 'Cc' addrs lacking an '@' e.g. ... but I still find the behaviour strange that the above expression does not match those e-mails!

Will test:

allof(
        anyof(not exists "to", not address :contains "to" "@"),
        anyof(not exists "cc", not address :contains "cc" "@")
)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing issue #42 with the provided Sieve expression and the message headers, then read RFC5228's address-test semantics alongside the relevant implementation. Clarify the expected result for an existing To or Cc header with no valid address, and consider how that behavior can be covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.