Skip to content

Commit

Permalink
Update update_bulk_preloaded.py to account for subdomain entries
Browse files Browse the repository at this point in the history
https://chromium-review.googlesource.com/#/c/773787/ added a new bulk entry
section ("1-YEAR BULK SUBDOMAIN HSTS ENTRIES") that update_bulk_preloaded.py
doesn't expect. This patch updates update_bulk_preloaded.py to parse that
section and add its contents to the bulk entries list.
  • Loading branch information
estark37 committed Dec 14, 2017
1 parent 7724179 commit ded146d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/update_bulk_preloaded.py
Expand Up @@ -14,7 +14,9 @@ class State:
During18WeekBulkEntries, \
After18WeekBulkEntries, \
During1YearBulkEntries, \
After1YearBulkEntries = range(7)
After1YearBulkEntries, \
During1YearBulkSubdomainEntries, \
After1YearBulkSubdomainEntries = range(9)

def getRawText():
log("Fetching preload list from Chromium source...\n")
Expand Down Expand Up @@ -50,9 +52,18 @@ def extractBulkEntries(rawText):
else:
bulkEntryString += line + "\n"
elif state == State.After1YearBulkEntries:
if "START OF 1-YEAR BULK SUBDOMAIN HSTS ENTRIES" in line:
state = State.During1YearBulkSubdomainEntries
elif state == State.During1YearBulkSubdomainEntries:
if "END OF 1-YEAR BULK SUBDOMAIN HSTS ENTRIES" in line:
state = State.After1YearBulkSubdomainEntries
else:
bulkEntryString += line + "\n"
elif state == State.After1YearBulkSubdomainEntries:
if "BULK" in line:
print(line)
raise Exception("Preload list contains unexpected bulk entry markers.")
if state != State.After1YearBulkEntries:
if state != State.After1YearBulkSubdomainEntries:
raise Exception("Unexpected end state: %d" % state)

# Add an empty object for the last entry to go after the trailing comma.
Expand Down

0 comments on commit ded146d

Please sign in to comment.