comparison mercurial/revset.py @ 19721:d8ca6d965230

revset: add a whitelist of DoS-safe symbols 'Safe' here means that they can't be used for a DoS attack for any given input.
author Alexander Plavin <alexander@plav.in>
date Fri, 06 Sep 2013 13:30:56 +0400
parents f0b992a9be9c
children 61a47fd64f30
comparison
equal deleted inserted replaced
19720:f0b992a9be9c 19721:d8ca6d965230
1597 "user": user, 1597 "user": user,
1598 "unstable": unstable, 1598 "unstable": unstable,
1599 "_list": _list, 1599 "_list": _list,
1600 } 1600 }
1601 1601
1602 # symbols which can't be used for a DoS attack for any given input
1603 # (e.g. those which accept regexes as plain strings shouldn't be included)
1604 # functions that just return a lot of changesets (like all) don't count here
1605 safesymbols = set([
1606 "adds",
1607 "all",
1608 "ancestor",
1609 "ancestors",
1610 "_firstancestors",
1611 "author",
1612 "bisect",
1613 "bisected",
1614 "bookmark",
1615 "branch",
1616 "branchpoint",
1617 "bumped",
1618 "bundle",
1619 "children",
1620 "closed",
1621 "converted",
1622 "date",
1623 "desc",
1624 "descendants",
1625 "_firstdescendants",
1626 "destination",
1627 "divergent",
1628 "draft",
1629 "extinct",
1630 "extra",
1631 "file",
1632 "filelog",
1633 "first",
1634 "follow",
1635 "_followfirst",
1636 "head",
1637 "heads",
1638 "hidden",
1639 "id",
1640 "keyword",
1641 "last",
1642 "limit",
1643 "_matchfiles",
1644 "max",
1645 "merge",
1646 "min",
1647 "modifies",
1648 "obsolete",
1649 "origin",
1650 "outgoing",
1651 "p1",
1652 "p2",
1653 "parents",
1654 "present",
1655 "public",
1656 "remote",
1657 "removes",
1658 "rev",
1659 "reverse",
1660 "roots",
1661 "sort",
1662 "secret",
1663 "matching",
1664 "tag",
1665 "tagged",
1666 "user",
1667 "unstable",
1668 "_list",
1669 ])
1670
1602 methods = { 1671 methods = {
1603 "range": rangeset, 1672 "range": rangeset,
1604 "dagrange": dagrange, 1673 "dagrange": dagrange,
1605 "string": stringset, 1674 "string": stringset,
1606 "symbol": symbolset, 1675 "symbol": symbolset,