7 ms·
X-ray: a Python library for finding bad redactions in PDF documents
- seanw444 10mo agoThe context for OP posting this is that many of the recently-released Epstein documents were PDFs "redacted" by being drawn on top of.
- formerly_proven 10mo agoIs there a good free tool to properly redact PDFs? My workflow is to place black annotation rectangles on top and then print as PDF with "force rasterization" on. The resulting PDF files then just consist of pages with one image each. But this tends to be really suboptimal, because it's usually a grayscale or color rasterization, so file sizes are very large vs. monochrome PDFs with CCITT G3/G4 compression (which is absolutely what you want for text content, excellent compression and lossless). Post-processing PDFs to convert them to CCITT is rather annoying and I only know of CLI ways.
- agumonkey 10mo agoI wasn't sure of this, even though sometimes you'd see remains of the original characters near rectangles edges.. does this mean the leaked documents have been de-redacted ?
- kstrauser 10mo agoAt least some, yes: https://daringfireball.net/linked/2025/12/23/trump-doj-pdf-redactions https://daringfireball.net/linked/2025/12/23/trump-doj-pdf-r...
- agumonkey 10mo agoyeah i expected every political team, even the low level ones, to be fully aware of naive pdf "edition"... alas, incompetence often does that
- arthurcolle 10mo agoChecks and balances for a more technological era.
- airstrike 10mo agoSurvival of the leetest
- zahlman 10mo agoI'm actually surprised not to have yet heard widespread conspiracy theorization that this is deliberate for some inscrutable reason or other.
- kstrauser 10mo agoSomething something "chess, not checkers, this proves he has them on the run!"
- deleted 10mo ago[deleted]
- k1t 10mo agoYes, in some cases, eg. https://news.ycombinator.com/item?id=46364121 https://news.ycombinator.com/item?id=46364121
- arthurcolle 10mo agoAlso good for UFO/UAP/"anomalous phenomena" documents and remote viewing PDFs for what it's worth :)
- IceHegel 10mo agoGiven recent high profile redaction events, I think one simple use of AI would be to have it redact documents according to an objective standard. That should in theory prevent overly redacted documents for political purposes. An approach that could be rolled out today would be redacting with human review, but showing what % of redactions the AI would have done, and also showing the prompt given to the AI to perform redactions.
- mmazing 10mo agoHonestly, it doesn't take any inference or need for AI, there's simply data in the documents that can be extracted.
- bogtog 10mo agoI don't think the commentor above is saying that an AI should necessarily apply the redaction. Rather, an AI can serve as an objective-ish way of determining what should be redacted. This seems somewhat analogous to how (non-AI) models can we used to evaluate how gerrymandered a map is
- unfocused 10mo agoAdobe Pro, when used properly, will redact anything in a PDF permanently. Whoever did these "bad" redactions doesn't even know how to use a PDF Editor. We have paralegals and lawyers "mark for redaction", then review the documents, then "apply redactions". It's literally be done by thousands of lawyers/paralegals for decades. This is just someone not following the process and procedure, and making mistakes. It's actually quite amateurish. You should never, ever screw up redactions if you follow the proper process. Good on the X-ray project on trying to find errors. I just want to add, applying black highlights on top of text is in fact, the "old" way of redaction, as it was common to do this, and then simply print the paper with the black bars, and send the paper as the final product. Whoever did it is probably old, and may have done it thinking they were going to print it on paper afterwards!! Just guessing as to why someone would do this.
- tgsovlerkhgsel 10mo agoOr they may not understand how PDF works and think that it's the same as paper. Especially with the "draw a black box over it" method, the text also stops being trivially mouse-selectable (even if CTRL+A might still work). Another possibility is, of course, that whoever was responsible for this knew exactly what they were doing, but this way they can claim a honest mistake rather than intentionally leaking the data.
- zahlman 10mo ago> Or they may not understand how PDF works and think that it's the same as paper. Yes; that's presumably included in being "amateurish" and "not following proper process".
- aidos 10mo agoA while back I did a little work with a company that were meant to help us improve our security posture. I terminated the contract after they sent me documents in which they’d redacted their own AWS keys using this method.
- selectodude 10mo agoAny attorney or law enforcement that works for the US Federal Government receives very, very comprehensive instructions on how to redact information on basically the first day of training. There is absolutely zero doubt among any of my DOGE'd friends that this was 100 percent on purpose malicious compliance.
- mlissner 10mo agoCool to see this here. It’s funny because we do so many huge, complex, multiyear projects at Free Law Project, but this is the most viral any of our work has ever gone! Anyway, I made X-ray to analyze the millions of documents we have in CourtListener so that we can try to educate people about the issue. The analysis was fun. We used S3 batch jobs to analyze millions of documents in a matter of minutes, but we haven’t done the hard part of looking at the results and reporting them out. One day.
- thangalin 10mo agohttps://www.argeliuslabs.com/deep-research-on-pdf-redaction-failures-and-security-risks-exploits-and-best-practices/ https://www.argeliuslabs.com/deep-research-on-pdf-redaction-... > Information Leaking from Redaction Marks: Even when content is properly removed, the redaction marks themselves can leak some information if not done carefully. For example, if you have a black box exactly covering a word, the length of that black box gives a clue to the word’s length (and potentially its identity). Does X-ray employ glyph spacing attacks and try to exploit font metric leaks?
- mlissner 10mo agoNo, we worked with researchers that developed that kind of system, but didn't broadcast our work b/c the research was too sensitive. Seems the cat is out the bag now though. I think the combination of AI and font-metrics is going to be wild though. You ought to be able to make a system that can figure out likely words based on the unredacted ones and the redaction's size. I haven't seen any redaction system yet that protects against this.
- thangalin 10mo ago> I haven't seen any redaction system yet that protects against this. The linked article suggests widening redacted areas more than needed with some randomization applied to the width. Strikes me that that wouldn't do much except add a few more possible solutions.
- gigatexal 10mo agoHilarious that DOJ didn’t flatten the layers so you can unredact stuff. What a clown show of incompetent idiots. Or… a skillful one over on the powers that be internally from someone who knew better but knew that they wouldn’t know … and did this to help us all
- gigatexal 10mo agoOnly MAGA weirdos would downvote this ;-)
- brotchie 10mo agoYou'd think the go-to workflow for releasing redacted PDFs would be to draw black rectangles and then rasterize to image-only PDFs :shrug:
- shbooms 10mo agooften times you will have requirements that the documents you release be digitally searchable and so in these cases, this would not be an option
- 8note 10mo agorun some ocr on them after to recreate the text layer?
- albert_e 10mo agoWith the aggressive push of LLMs and Generative AI ..i am expecting a lot of OCR features to become "smarter" by default, namely go beyond mechanical OCR and start inserting hallucinations and sematically/contextually "more correct" information in OCR output It's not hard to imagine some powerful LLMs being able to undo some light redactions that are deducible based on context
- blharr 10mo agoOr worse, making up names or information instead of writing the reaction.
- pottertheotter 10mo agoThis made me think of something I came across recently that’s almost the opposite problem of requiring PDFs to be searchable. A local government would publish PDFs where the text is clearly readable on screen, but the selectable text layer is intentionally scrambled, so copy/paste or search returns garbage. It's a very hostile thing to do, especially with public data!
- embedding-shape 10mo agoI haven't gone through more than just 10% of the files released today, but noticed that at least EFTA00037069.pdf for example has a `/Prev` pointer, meaning the previous revision of the file is available inside of the PDF itself. In this case, the difference is minor (stuff moved around), but I'm guessing if it's in one file, it could be more. You can run `qpdf --show-object=trailer EFTA00037069.pdf` on a PDF file to see for yourself if it's there. I'm almost fully convinced that someone did this bad intentionally, together with the bad redactions, as surely people tasked with redacting a bunch of files receive some instructions on what to do/not to do?
- xhevahir 10mo ago> as surely people tasked with redacting a bunch of files receive some instructions on what to do/not to do? You've phrased this as a question; I gather that you know better than to assume a modicum of competence from these people.
- dcollect 10mo ago[flagged]
- titaniumtown 10mo agobot
- throwawaysleep 10mo agoAll the reporting I have read suggests that they are roping anyone and everyone they can into doing redactions. So I suspect many simply lack the experience to do it well.
- jmward01 10mo agoHmmm.. The more I think about this the more any font kerning is likely a major leak for redaction. Even if the boxes have randomness applied to them, the words around a blacked out area have exact positioning that constrains the text within so that only certain letter/space combinations could fit between them. With a little knowledge of the rendering algorithm and some educated guessing about the text a bruit force search may be able to do a very credible job of discovering the actual text. This isn't my field. Anyone out there that has actually worked on this problem?
- mlissner 10mo agoReally depends on the length and predictability of the redaction, but yes. If it's short and contextually it's only likely to be either "yes" or "no", you've got it. If it's longer and could contain an unknown person's name along with some other words, well, that's harder.
- jmward01 10mo agoI feel like this creates a hash value and the real question is how unique of a value does it represent and how easy it is to narrow it down given throwing a dictionary at it. Similarly, unknown names could likely be teased out like a one-time pad. If they appear in multiple sentences then their randomness quickly repeats and becomes something that potentially could be isolated from the rest of the words around them. This would probably be a fun problem for a cryptography class to work on.
- skykooler 10mo agoIf so, then finding the redacted string would be similar to trying to brute-force a hash (though presumably slower, since text layout algorithms are probably more complex than a single hash invocation).
- worewood 10mo agoThere was a recent vulnerability, where researchers were able to extract information from an encrypted chat session from an LLM, by analyzing packet size/timings of the underlying SSL connection. A classic side-channel attack. Seems possible to draw a parallel between the two.
- deleted 10mo ago[deleted]
- dcollect 10mo ago[flagged]
- 5ak12agff 10mo agoGiven that no U.S. or Israeli citizen apart from Epstein and Maxwell has experienced severe repercussions and Andrew Windsor is the perfect fall guy, there is the possibility that nothing will be revealed from these uncovered redactions. The releases haven't yielded anything so far. For all we know, Epstein used other methods of communications for the really sensitive stuff. This would not be a surprise, since the whole Maxwell family was deep into tech (Magellan, Chiliad) and Ehud Barak was the head of Israeli military intelligence in the 1980s. The story is going to be closed in a bipartisan manner except that it might be used to remove some unwanted politicians. The New York Times has already released an article that "explains" Epstein's wealth which names all figures that appear in "conspiracy theories" in an innocent way. Basically, they claim that Epstein could just steal from billionaires like Wexner and the billionaires would roll over and do nothing. That is the official confirmation that all intelligence angles will be squashed in a bipartisan manner. For all we know, the "incompetence" in the redactions may be a way of saying: "See, we have nothing to hide."
- shrubble 10mo agoShockingly, you can see redaction info from within your browser's PDF viewer. I am using Brave on Linux, and went here: https://www.justice.gov/multimedia/Court%20Records/Matter%20of%20the%20Estate%20of%20Jeffrey%20E.%20Epstein,%20Deceased,%20No.%20ST-21-RV-00005%20(V.I.%20Super.%20Ct.%202021)/2022.03.17-1%20Exhibit%201.pdf https://www.justice.gov/multimedia/Court%20Records/Matter%20... As a test, select with your mouse the entire first line of paragraph number 90, and then paste it into a text editor or a shell. The unredacted text appears!
- ktpsns 10mo agoThis is exactly the type of bad redactions which the X-ray software will also find.
- sawjet 10mo agoYou can X-ray a PDF?
- stressback 10mo agoUnsure if you are serious but the commenter is referring to the tool name that this post links to
- Fnoord 10mo agoYep, bingo: $ uvx --from x-ray xray "https://www.justice.gov/multimedia/Court%20Records/Matter%20of%20the%20Estate%20of%20Jeffrey%20E.%20Epstein,%20Deceased,%20No.%20ST-21-RV-00005%20(V.I.%20Super.%20Ct.%202021)/2022.03.17-1%20Exhibit%201.pdf https://www.justice.gov/multimedia/Court%20Records/Matter%20..."
- sroussey 10mo agoWhy would “Financial Strategy Group, Ltd” be redacted?
- belter 10mo agoThere is no way looking at most of the now unredacted text that it should redacted. It´s clear that the DOJ was paying overtime, based on the number of redactions, so the agents and lawyers just roamed free...
- blitz_skull 10mo agoExplain like I’m stupid: what is the most gracious interpretation of redaction when releasing files like this? Why should anyone involved retain any anonymity? I’m asking in good faith because naively it seems like this should not even exist. All of it should be exposed. EDIT: I did not think about the innocent folks that might be caught in the crossfire. That checks out. Thanks everyone!
- empath75 10mo agoThe files of a high profile and long running investigation are going to be full of false leads, hoaxes and other bullshit. The reason they don’t just always release the files after closing cases is that there genuinely are going to he innocent people caught in the crossfire who have privacy rights. This case is so important and such a clusterfuck that the files need to be opened anyway.
- ozim 10mo agoPerson asking above question explains he doesn’t understand so I guess he also doesn’t understand prosecutors, lawyers, law enforcement, judges make mistakes. So yes this is best explanation. Revealing everything might bring great harm to innocent people just because they were somehow mentioned in the documents. Just add all the experience we already have with “internet investigators” that ruin people lives for petty reasons.
- MiguelX413 10mo agoI'm unaware of the phenomenon as I live under a rock, please tell me about it.
- krapp 10mo agoProtecting the identity of victims, eyewitnesses or informants.
- sawjet 10mo agoDon't forget the co-conspirators!
- unstatusthequo 10mo agoIt’s a bit amusing seeing ediscovery principles go mainstream.
- ballpug 10mo ago[dead]
- hamonrye 10mo ago[dead]
- tamimio 10mo agoTech people would be shocked and surprised to know how tech-illiterate non-tech people are. Reminds me of old days when the IT guy is AIO in some non-tech facility and is treated like god!!
- eviks 10mo agoPity such an awful document format with so many basic fails at being digital, continues to reign in a lot of areas!
- alessandroliva 10mo agoThis being on top of the news on Esptein files being badly redacted is pretty funny
- IshKebab 10mo agoAre you under the impression that they're unconnected?
- e38383 10mo agoIt’s either redacted or not. There is no "bad". The text is either there or it isn’t, sorry but this is a binary option and not on a spectrum from bad to good.
- 47282847 10mo agoMaybe “attempted” would be more accurate? I personally don’t mind the “bad”, I get what is meant by it. But since we’re talking about accuracy: I don’t agree on redactions being binary. You can redact with a pen that under certain lighting still reveals the text; you can redact parts that are easy to reconstruct when you have additional information; you can redact with a pen color that over time loses its function; etc. The “perfect” redaction would perhaps leave no clues as to even how much text was redacted? It seems to depend on the goal and context of the redaction, whether it achieves its purpose or not.
- e38383 10mo ago"attempted" would be more accurate IMO. I still think that the word redacted is meant to destroy the original text, it might not remove the metadata (e.g. length). Redaction is done mostly in ways with a possibility to reveal the underlying text, but all this is not redacted in my understanding of the word. I always liked the english word for this – the german word "schwärzen" just means to "blacken" the text and this was never the same for me. But after further research I must agree with you, it just means to obscure or remove, but not clearly just remove. I have been using it for years in a stronger meaning that it's really meant. One more but: we hopefully can all agree that putting a black bar over some text which still is just copy/pasteable is not even obscuring.
- dev1ycan 10mo agoYeah let's helpt he govt redact pdfs (literally).
- PunchyHamster 10mo agoGreat, now govt will have easy tool to check it
- shevy-java 10mo agoThe issue is more that the current US government is not very bright. Nor very open. Kind of rogue-like. I think governments should not be able to hide information from citizens in general. I don't trust those who hide stuff while being fed money from the taxpayers - that is a modern form of slavery.
- bossyTeacher 10mo agoThis is not something to do with the redacted Epstein files, right?
- yoan9224 10mo agothe timing of this with the epstein docs is pretty funny. honestly feels like someone did those redactions badly on purpose - anyone who works with pdfs knows you don't just draw black boxes over text. either massive incompetence or malicious compliance