gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit45163bd445163bd4log: person/tmdb error hypothesismre45163bd4/tests/seed-xss.hl

2.4 KB

  1. // tests/seed-xss.hl — GATE FIXTURE for the security gate (tests/security.mjs): a movie, a person and a genre whose text is HTML /
  2. // script, in every field a page prints. The app is stopped while this runs. Self-assigned ids, one put() each.
  3. import { MPackDB } from 'hl:mpackdb'
  4. import { env } from 'hl:proc'
  5. storageDir = env('TRACKER_STORAGE')
  6. if (storageDir == null || !storageDir.startsWith('/')) { hlError('set TRACKER_STORAGE, absolute') }
  7. genresTable = new MPackDB(file = storageDir + '/genres.db', primaryKey = '@id', indexes = ['!oldId'])
  8. personsTable = new MPackDB(file = storageDir + '/persons.db', primaryKey = '@id', indexes = ['!oldId'])
  9. showsTable = new MPackDB(file = storageDir + '/shows.db', primaryKey = '@id', indexes = ['!oldId'])
  10. seasonsTable = new MPackDB(file = storageDir + '/seasons.db', primaryKey = '@id', indexes = ['!oldId'])
  11. episodesTable = new MPackDB(file = storageDir + '/episodes.db', primaryKey = '@id', indexes = ['!oldId'])
  12. evil = '</script><img src=x onerror=window.__xss=1>"\'<svg onload=window.__xss=2>'
  13. genresTable.put({ id = 'xssg00000000000g' name = 'G' + evil urlSegment = 'xss-genre' tmdbId = 99001 oldId = 'xssg' })
  14. personsTable.put({ id = 'xssp00000000000p' name = 'P' + evil urlSegment = 'xss-person' tmdbId = null oldId = 'xssp' bio = 'B' + evil })
  15. seasonsTable.put({ id = 'xsss00000000000s' seasonNumber = 1 title = 'S' + evil release = null summary = 'SS' + evil show = 'xsst00000000000t' episodes = ['xsse00000000000e'] oldId = 'xsss' })
  16. episodesTable.put({ id = 'xsse00000000000e' episodeNumber = 1 seasonNumber = 1 title = 'E' + evil summary = 'ES' + evil release = '2020-01-01' show = 'xsst00000000000t' season = 'xsss00000000000s' oldId = 'xsse' })
  17. showsTable.put({
  18. adult = false id = 'xsst00000000000t' title = 'T' + evil summary = 'M' + evil tmdbSummary = null tmdbId = null
  19. language = 'en' type = 'series' release = '2020-01-01' year = 2020 image = null urlSegment = 'xss-title'
  20. episodesCount = 1 homepage = 'javascript:window.__xss=3' imdbId = '"><img src=x onerror=window.__xss=4>' seasonsCount = 1 status = 'Ended' tagline = 'T' + evil
  21. tvdbId = null tvmzId = null genres = ['xssg00000000000g'] cast = [{ person = 'xssp00000000000p' character = 'C' + evil actor = 'A' + evil }]
  22. seasons = ['xsss00000000000s'] oldId = 'xsst' tmdbSync = 1
  23. })
  24. genresTable.persist()
  25. personsTable.persist()
  26. showsTable.persist()
  27. seasonsTable.persist()
  28. episodesTable.persist()
  29. console.log('seed-xss: 1 series, 1 person, 1 genre with HTML in every text field')

Branches

Latest commits

  • 45163bd4log: person/tmdb error hypothesismre
  • cb38de2blog: swap 503 causemre
  • fd10c3d5log: CB livemre
  • 7557c025log: CB deploy try 2mre
  • 06a7534aMerge branch 'cb'mre
  • 2f8030d6log: CB gates greenmre
  • 498bf644log: CB gates startmre
  • f59c2847gc1: bound the five request caches (shows.hl cacheLimit)mre
  • 6ea2c6d6log: morning re-measure 11-04mre
  • 446290f0log: GC1 livemre
  • 8e6aa91dlog: GC1 deploy retrymre
  • 87ad2dc1log: GC1 deployingmre
  • 53f10fb8Merge branch 'gc1-deploy'mre
  • 7fcbf1d2log: GC1 deploy GOmre
  • 1fb6664bcompose: TRACKER_QSTATS=1 (GC1 measurement)mre
  • 6576c1cdgc1: release the people-view scan lists once the view is builtmre
  • 94f8a373gc1: back out the kept episode-id set (no measurable gain on /my/unwatched: 4.69 -> 4.61 GB per 150 loads)mre
  • a1a88bd4gc1: search skips the stale-key string while no entry is stale; /my/unwatched asks a kept id set instead of building a key string per episode rowmre
  • cd830744gc1: dbSearch: no split / map / list copy per candidate (scores from the stored text, top list touched only when the hit can enter)mre
  • 451db7cdgc1: show page and check clicks read the kept watched set instead of building one from a by-value copy of every watchmre