Saltar al contenido ForoHackers

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

Formación en seguridadPruebasControl de versiones
#22234 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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

#22260 · · Citar · Denunciar

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 · · Citar · Denunciar

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

#22262 · · Citar · Denunciar

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 · · Citar · Denunciar

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

#22264 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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

#22279 · · Citar · Denunciar

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

#22280 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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

#22284 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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

#22287 · · Citar · Denunciar

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

#22290 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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

#22298 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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

#22302 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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.

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder