freedomofpress / freedomofpress/securedrop-https-everywhere-ruleset

https-everywhere's merge-rulesets.py fails if org name includes double quotes

Open
#92 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11
Forks
4
Avg merge
8m
Merged PRs (30d)
7

Description

If the organization name for an instance includes double quotes, they will be included without escaping in the reuleset XML, breaking HTTPSE's scripts with errors like:

~/securedrop-https-everywhere-ruleset/https-everywhere ~/securedrop-https-everywhere-ruleset
 * Parsing XML ruleset and constructing JSON library...
Traceback (most recent call last):
  File "utils/merge-rulesets.py", line 50, in <module>
    tree = xml.etree.ElementTree.parse(filename)
  File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 1197, in parse
    tree.parse(source, parser)
  File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 598, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 24

One workaround is to just not do that, but it would be good to properly escape string values being used in XML instead.

Contributor guide

No contributing guide indexed for this repository

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

The failure is reported in utils/merge-rulesets.py. Start by tracing how organization names are inserted into the generated ruleset XML and reproduce the issue with a name containing double quotes. Done means the generated XML parses successfully and ruleset processing completes for that case.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.