Skip to the content ForoHackers
Log inJoin

Tabs or spaces in a generated security report: which diff can a reviewer trust?

Security educationTestingVersion control
#22234 · · Quote · Report

My generated vulnerability report looks aligned in a preformatted browser view, but every row changes in the byte diff when somebody changes tabs to spaces. The generator has two little formatter functions with different trailing whitespace, too. This is a local toy export, not customer findings. What do we promise the reviewer: exact bytes, fields, or a picture of a table? I wanted to fix one column. I have apparently founded a standards committee.

#22258 · · Quote · Report

The little input has bytes 61 09 62 0a: a, TAB, b, LF. cat -vet shows a^Ib$. A preformatted display can make it look like padded spaces; the byte 09 hasn't become three spaces out of politeness.

#22259 · · Quote · Report

yo no digo que la vista bonita baste: el byte \t sigue ahí aunque el navegador expanda columnas.

#22260 · · Quote · Report

con tabuladores de ancho cuatro, la vista preformateada puede mostrar a b. eso es presentación. en un exporte TSV el tab separa campos; sustituirlo por espacios cambia lo que lee el parser. primero decide qué archivo estamos discutiendo, coño.

#22261 · · Quote · Report

Una huella no vuelve revisable el cambio fuente. Una celda cambió y el ruido de espacios tapó el diff; menudo disfraz, boludo.

#22262 · · Quote · Report

For a toy report, parse the fields and compare exact bytes as separate views. That catches a changed value and whitespace churn without calling them the same thing.

#22263 · · Quote · Report

corrección: mi muestra tenía crlf en una línea. al normalizar saltos, desapareció la deriva que atribuí al formateador.

#22264 · · Quote · Report

Keep the CRLF original beside the LF copy. If the comparison normalizes both before showing anything, it hides exactly the edit that sent you looking for a formatter bug. The investigator should not tidy the evidence first.

#22265 · · Quote · Report

metí un tabulador dentro de un campo CSV entre comillas. separar por tab devuelve tres campos; CSV devuelve dos. jaja, el separador también quería salir en la foto.

#22266 · · Quote · Report

Vale: exporte tabulado con comillas y una vista humana aparte. No voy a reemplazar tabs por espacios dentro del exporte. En la vista puedo alinear columnas; el fuzzing del lector puede cubrir tabs y saltos dentro de campos citados.

#22267 · · Quote · Report

And spaces at the end of a field: data or decoration? If a name ends with one, trimming it because it looks ugly changes the value. The formatting function doesn't get to decide out of embarrassment.

#22268 · · Quote · Report

A container for four fucking lines feels excessive. Pin the formatter version and give me one generation command first. If that still varies by environment, show me the differing bytes and I'll stop complaining about the container. Briefly.

#22269 · · Quote · Report

if an editor adds BOM, CI could reject it once the file contract declares UTF-8 without BOM. first specify the contract; otherwise the check is just a surprise with a badge. wtf.

#22270 · · Quote · Report

The byte check distinguishes the UTF-8 BOM EF BB BF from a CRLF ending 0D 0A; they're separate mismatches with separate messages. @Ophuscado ya tendría tres adaptadores sobre la mesa; ninguno convierte una especificación ausente en una presente.

#22271 · · Quote · Report

si eliges utf-8 sin bom y lf, escribe eso junto al archivo. que el editor lo sugiera y CI lo compruebe. una regla que sólo aparece cuando falla el viernes es una chapuza con horario laboral.

#22272 · · Quote · Report

for this export I'll specify UTF-8, no BOM, LF, tab separator and CSV-style double-quote escaping. the importer should reject a BOM with a useful message instead of letting it sneak into the first column name. that's the first paragraph of the contract, finally.

#22273 · · Quote · Report

si la salida se genera, regenerala en CI y comparala con la guardada. el editor puede decorar su ventana como un palacio; no tiene por qué reescribir el artefacto. me niego a revisar otra boda entre tabs y espacios.

#22274 · · Quote · Report

Eso detecta un archivo generado que quedó viejo, pero falta leer qué cambió en la entrada. Pongan el diff de la fuente junto a la tabla regenerada. Una comprobación verde no explica por qué alguien renombró una vulnerabilidad. Joder, la insignia no va a leer por nosotros.

#22275 · · Quote · Report

The 08 identifier should stay text. int("08") == int("8") is true, which is exactly why passing these IDs through an integer loses information. Someone will tell me the leading zero is decorative. I have prepared a chair for the argument.

#22276 · · Quote · Report

I tried another ID, 000, because everyone was defending the eight. Same problem: converting it to a number gives 0. The example schema needs strings and the comparison needs to preserve them. The zero has brought friends.

#22277 · · Quote · Report

el byte exacto no basta: 08 a 8 importa, tabs a espacios quizá no. hay que definir significado por campo; qué chapuza sería esconder el cero.

#22278 · · Quote · Report

You now want parsed comparison plus byte check. Fine if review shows both without hiding either.

#22279 · · Quote · Report

git diff --word-diff dejó visible el cambio de celda entre espacios. sirve de apoyo, no de política.

#22280 · · Quote · Report

word diff can leave the tabs between words hard to follow. for the vulnerability list, show the record ID and changed fields together. don't match records by their current row number if one insert shifts every later row.

#22281 · · Quote · Report

pero tampoco ordenes las filas antes de comparar: si su secuencia importa, mover una fila es un cambio. quiero ver tanto qué ID cambió de posición como qué celda cambió de valor. la lista no es un saco de patatas.

#22282 · · Quote · Report

Two checks, then: compare the ordered ID sequence, and compare fields by ID. Reject duplicate IDs before making that lookup, or the second duplicate overwrites the first and your beautiful diff loses a whole complaint.

#22283 · · Quote · Report

¿ponemos fecha de generación? cambia en cada ejecución, pero el operador necesita saber cuándo se preparó.

#22284 · · Quote · Report

Put the generation timestamp in metadata beside the content digest. Two runs can have identical content hashes and different generation times. Then reviewers can tell a new wrapper from a changed report instead of decoding your wall clock.

#22285 · · Quote · Report

if we sign this later, put the date inside the signed manifest if we want to protect it too. a hash of the content doesn't authenticate the timestamp sitting next to it. we've stuffed two different promises under guarantee, shit.

#22286 · · Quote · Report

For a local toy, a manifest signature is overkill. We can still be precise about the bytes a future signature would cover.

#22287 · · Quote · Report

una fecha fija en ci hace estables las capturas, pero parece fecha real. el ejemplo debe marcarla como test_epoch. lol.

#22290 · · Quote · Report

For snapshot tests, pass an explicit sample timestamp and label it TEST_EPOCH. For a real run, record its real generation time. Don't get reproducibility by quietly dating every report as if it were born on the same Thursday.

#22291 · · Quote · Report

Ojo con otro supuesto: sorted() de Python ordena cadenas por puntos de código, no por la locale del sistema. Si luego usas una comparación dependiente de locale, eso es otra política. No bauticemos como experimento de colación un cambio de variable de entorno que el código ni lee.

#22292 · · Quote · Report

For the machine inventory, codepoint order is easy to specify if the generator needs sorting. For this report you've just declared that source row order matters, so keep it. A pretty sort added by the comparison tool would violate your own contract.

#22293 · · Quote · Report

y para una lista española que ve una persona puedo tener otra vista con colación española, sin cambiar el exporte. la ñ no tiene que presentarse a oposiciones para caber en la pantalla.

#22294 · · Quote · Report

The composed accent and letter-plus-combining-accent normalize to the same string under NFC. Their original bytes differ. Whether you want that equivalence for an ID is a schema decision, not a cosmetic favour from the editor.

#22295 · · Quote · Report

si usamos NFC para comparar etiquetas, guardaría también el texto original para mostrarlo. dos columnas con trabajos distintos. no voy a prometer que se conserva el original después de sustituirlo por el normalizado, que ya me conozco.

#22296 · · Quote · Report

What happens when two different source records get the same normalized comparison key? Put that collision in the tests before you use the key to merge anything. The accent did not appoint you registrar of people.

#22297 · · Quote · Report

aunque nos fuimos de los tabs, la salida debe explicar qué es canónico y qué es solo presentación.

#22298 · · Quote · Report

ban tabs as alignment padding in the human view if you like. the firmware-inventory export still uses them as delimiters, and quoted fields may contain literal tabs. a blanket ban would break the format we just spent a day inventing. lol, excellent committee.

#22299 · · Quote · Report

El lector CSV de Python, configurado con delimitador tab y comillas dobles, entiende el tab dentro de un campo citado. Un split simple no. No jodas, tenemos que probar el dialecto que declaramos, no uno que se le parezca en una captura.

#22300 · · Quote · Report

and if a consumer uses cut -f, it won't understand that quoted embedded tab. the export may be valid and that consumer still wrong for its dialect. let's inventory consumers before deciding whether to fix them or offer a different export.

#22301 · · Quote · Report

no mantengamos para siempre conducta sin documentar. una prueba y aviso de migración dan transición corta.

#22302 · · Quote · Report

para x<TAB><LF>, hacer rstrip("\t\n").split("\t") pierde la última celda vacía. el lector CSV conserva dos campos. joder, la celda vacía acaba de demostrar más iniciativa que mi departamento.

#22303 · · Quote · Report

One row with an empty last field, one with a quoted tab, and one with an embedded newline: I'd keep those three cases by the format contract. They catch different shortcuts; one successful split on a friendly row isn't a parser review.

#22304 · · Quote · Report

Una firma sobre los bytes originales no valida después de cambiar un espacio. Podés canonicalizar antes, pero todos los firmantes tienen que aplicar las mismas reglas. Al algoritmo no le alcanza con que la servilleta se vea igual.

#22305 · · Quote · Report

if we canonicalize before hashing, fix the encoding, quoting, line endings, ordering and Unicode policy. two implementations need the same bytes for the same meaning. normal format isn't a protocol, it's a favour we're asking of the future.

#22306 · · Quote · Report

A hash detects a changed byte if you compare against a trusted digest. If both file and digest are replaced, it proves no authenticity.

#22307 · · Quote · Report

cierto: estaba llamando firma a un digest de comparación. retiro la palabra firma de mi ejemplo. el hash me dice que una copia cambió respecto a la referencia; no me dice quién merece que le creamos.

#22308 · · Quote · Report

Remove the final LF from a copy: different content digest, same parsed fields in this little example. That's enough to show why the two views disagree. It doesn't need a fake digital-signature ceremony. ffs.

#22309 · · Quote · Report

probado: mismas celdas, hash distinto sin el LF final. según el contrato que elegimos, esa copia es inválida aunque la tabla se vea bien. por fin un desacuerdo de bytes que tiene una respuesta escrita.

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply