Skip to content

K Anonymity

Ajay Ramachandran edited this page Nov 15, 2022 · 4 revisions

Segments are fetched from the server using a k-anonymity system originally proposed by Girst and implemented by Zegnat and Joe-Dowd.

Every time you watch a video, it takes the videoID and hashes it, producing a value that looks like 5f6b0b4e201f2a7e66927abb5cadeec81624dcc8efe6644b78aa182213f653a2. Instead of sending the videoID to the server, it sends only the first 4 characters of that hash, 5f6b.

https://sponsor.ajay.app/api/skipSegments/5f6b?categories=["sponsor","intro","outro","selfpromo","music_offtopic","preview"]

The client then gets a list of possible videos that have that prefix. This list may or may not contain the videoID

Click to see the result
[
   {
      "videoID":"ifI_fwg55k8",
      "hash":"5f6b9697b907622242a43ac766a0735840efe62a93249dd00e4cd2bd3e29c6c2",
      "segments":[
         {
            "category":"intro",
            "segment":[
               0,
               2.811777
            ],
            "UUID":"1db91efbce60d754d1cc86687202701741c8f31ee239f75d88979e29ecd9be03",
            "videoDuration":1163
         },
         {
            "category":"intro",
            "segment":[
               24.182026,
               39.86125
            ],
            "UUID":"966d6ee4f37811e790bc902eff1650c912e6e148e85a150730c15a22bffa8878",
            "videoDuration":1163
         }
      ]
   },
   {
      "videoID":"rPA_nqPHjXo",
      "hash":"5f6b2a774993bd13c38ea79d53d341f9246e1fc564d2e33c08014262690746de",
      "segments":[
         {
            "category":"outro",
            "segment":[
               0,
               145
            ],
            "UUID":"5d5184386913bd10021f5bccff54c26441cc88479caf33c087710b12fcc887a7",
            "videoDuration":1828
         },
         {
            "category":"outro",
            "segment":[
               1705.593,
               1827.661
            ],
            "UUID":"1829807614e13b0cb81e8aa9ac9ed23892ce66dd300c64c40e2b4f77f5a14070",
            "videoDuration":1828
         }
      ]
   },
   {
      "videoID":"6qc2GsH_ii4",
      "hash":"5f6b3279fbf3a40cd1eefe71aa9e1812a3957b44d0d88f6f23b8bb7d8db857a0",
      "segments":[
         {
            "category":"intro",
            "segment":[
               0,
               27.439728
            ],
            "UUID":"9ee28368f6f450d14fd9cede79dcf6b6ceff04ddb7eb48ca6f12120e19304139",
            "videoDuration":1790
         }
      ]
   },
   {
      "videoID":"dQw4w9WgXcQ",
      "hash":"5f6b0b4e201f2a7e66927abb5cadeec81624dcc8efe6644b78aa182213f653a2",
      "segments":[
         
      ]
   },
   {
      "videoID":"auBq3fZ-WAM",
      "hash":"5f6b5627fa138974690be4333b8f53fb3e76e2dc70dd661e9d82c7c5854aaceb",
      "segments":[
         {
            "category":"intro",
            "segment":[
               0,
               6.9
            ],
            "UUID":"e0a750b81efc389b2a69f8a4a62926f4f8d2cb7acc37aff110b5b43370706b11",
            "videoDuration":0
         }
      ]
   },
   {
      "videoID":"YRQuvRjXXPc",
      "hash":"5f6b3d10cc6f79f099014ac4dc4aad4a43f648f25397a1a481ccae9a37cca644",
      "segments":[
         {
            "category":"intro",
            "segment":[
               0,
               12
            ],
            "UUID":"7b590105e87bfcecfb3c9524c7ec889bde92a1486b7fafd08309531bec408460",
            "videoDuration":0
         }
      ]
   },
   {
      "videoID":"5GKIUKsrnKo",
      "hash":"5f6bbb7cc756d761ab675469743142c0b27d0e1b2436309410201cc3c86ba2c9",
      "segments":[
         {
            "category":"intro",
            "segment":[
               0,
               4.177
            ],
            "UUID":"975f0840028e7ce21e9608a9dcc2a2a529a079b68eca636da87259d7e3cba80a",
            "videoDuration":0
         },
         {
            "category":"sponsor",
            "segment":[
               80.93964,
               145.15292
            ],
            "UUID":"6bb6d1cbf85c7fa65ad5c08acdceb6c4ebb7720f2f794e51e38caf20fad83853",
            "videoDuration":0
         }
      ]
   },
   {
      "videoID":"aQp-iM0bCs4",
      "hash":"5f6bcdd946838ebf572b0526cb29dc557918674e7ff650e33d8a78893f4aabb2",
      "segments":[
         {
            "category":"sponsor",
            "segment":[
               0,
               31.861
            ],
            "UUID":"b772d4b75ca73ce63940fa982d051c031964160941efd93bd6ed1bbe9327a46e",
            "videoDuration":361
         }
      ]
   },
   {
      "videoID":"thODYqd9G9U",
      "hash":"5f6bb87827fd5c93e44650defe57247c5965fac3c2d26068c3aae770436b83a7",
      "segments":[
         {
            "category":"sponsor",
            "segment":[
               0.332106,
               22.484015
            ],
            "UUID":"5f498eade41a1fbb46aee46d94fdc6fff5ad3b1d9f5046720c75ad6a28bdfd8b",
            "videoDuration":0
         }
      ]
   },
   {
      "videoID":"5t6saOlOTZE",
      "hash":"5f6bb71ba929d4395f0c25f964f010e103de517f3adb269b22d0cb939bd06550",
      "segments":[
         {
            "category":"sponsor",
            "segment":[
               171.933,
               255.06
            ],
            "UUID":"33ef5c921624914930ffb0b37e1182abe938f2ff44a7fdeeafd7e8e5ba6f608b",
            "videoDuration":0
         },
         {
            "category":"selfpromo",
            "segment":[
               438.051,
               476.568
            ],
            "UUID":"e0f8c2416494211200774f74dea45e0dcad62eead20217a7582fbb3ece395f3d",
            "videoDuration":0
         }
      ]
   },
   {
      "videoID":"HXzMwe8PZBA",
      "hash":"5f6b33fd117ef95e62f7fe07c9fa1a7667147994081a70cb933941a8622d589f",
      "segments":[
         {
            "category":"outro",
            "segment":[
               449.84006,
               459.581
            ],
            "UUID":"cbd9fd2701548277e43cbb83fc839b5679a525a30ee794282958ef3036a8741e",
            "videoDuration":460
         }
      ]
   }
]

The client then gets back these 11 videos (in this case) and checks to see if the video it is looking for is in the list. If it is not, it treats it as not found. Since the list may, or may not contain the video, this makes it even more secure than a 1 / 11 chance.

This system allows the client to be lightweight and always get the latest segments on every video while still ensuring the server cannot predict which videos they are watching.


Note: The extension also sends an anonymous request after segment is skipped to give you a "time saved" metric on your submissions. This can be disabled, and it is recommended to disable this setting if you want to fully prevent leaks. So, if you watch a video, and it does have segments, and you do skip a segment, then the server does get access the that segment ID, which is directly linked to the video.

Why is K-anonymity still used then? Even with skip counting enabled, K-anonymity still helps with the following cases:

  • Unlisted videos with no segments (Since those are private to everyone who doesn't have access to the URL, leaking the video ID is not a good idea)
  • Videos with no segments you skip

K-anonymity was originally developed as an optional feature but was enabled by default for the above reasons.