Repository navigation
ergo.rego 0.4.0
·
68 commits
to main
since this release
New
- Every phrase that lacked an opposite has one, as spec 0.4 says:
does not start with,does not end with,is not a <type>,is not a non-empty string,is not between,is not <value> within <number>,does not equal <field> within <number>,contains some ofanddoes not contain all of, plusis alphabetically on or beforeandis alphabetically on or after. Each fails as its opposite does when a field is missing,nullor of the wrong type. A sentence likex is not 3 within 1was written wrong before and reads now, after acount of, asum of, aplusor an elapsed time too (count of x is not 3 within 1), and acomparewithnecan have awithin. In a comparison of plain paths and written values, and in the pieces offollowed by, a path that names its key by a field now lists the field right after the path in a row'sinputs, as spec 0.4 says:m named by p is qshowsm named by p,p,q, where it showedm named by p,q,p. So does acount of, asum of, an elapsed time and aplus:count of m named by p is qshowscount of m named by p,m named by p[],p,q, wherepcame last. When the path before the field can't be read, the cause comes from that path and not from the field, so$params.m named by p is qwith nomin the params fails asabsentwhenpisnull, where it failed asnull, androws.w named by p is qwithrowsa list fails asunusable. Anevery,some,count oforsum ofwalks a list before the field, soevery rows.w named by p is qfails as the field says whenrowsis a list. Whenrowsisnull, it now fails asnullwhateverpholds, a missingpincluded, where a missingpfailed asabsent, andfailed_itemsnamesrows, where it was empty whenpcouldn't be read, asevery rows.w.k is qdoes. - Text can be joined on the right side with
followed by, as spec 0.4 says:rego.version is tag.version followed by "-dev",rego.spec is "v" followed by tag.version. It takes written strings and fields. Nothing that read before changes.
Changed
- This version follows spec 0.4, so a policy says
ergo_spec: v0.4, and the report'sergofollows. One that saysv0.3is written wrong, withunsupported version v0.3, expected v0.4. - The report's
enginename isergo-rego, where it wasergo.rego. Every report changes in that field only, and the hash leavesengineout, so hashes stay the same. A compiled policy made by an older copy saysergo.rego, soergo.reportreads it as one from another engine, and the message saysexpected ergo-rego. Compile the policy again. - A
fromthat starts at the input with anamed bystep is written as it is, whatever follows it, in the$min_subjectsand$unique_idsexpressions, soevery $input named by $params.kis no longercount(matching(every )). A subject that narrows a subject read witheverytakes its flat list of subjects and filters it, whereergo.regodropped theeveryand found none. An input that reads the item's own field named like a parent subject keeps its dot, like.art.k. Reports change for such policies. - A policy with no requirement, because
requirementsis missing,null, not an object or empty, gets Ergo's own requirement$policywith a failing$well_formedrow that says what is wrong, where its report had no row andergo.violationsreturned[]whilecompliantwasfalse. A requirement called$policyis written wrong. Reports change for such policies. - A name that starts with
$is written wrong, whether it names a subject, a requirement, a check, anany_ofoption or a part, witha name can't start with $, where only a check named like one of Ergo's own rows was (name reserved),$inputand$paramsas subject names (a subject can't be named $input), and a part called$dollar(invalid alias). Reports change for such policies. A check with such a name has no entry inrequirementsany more. - A name that starts or ends with a space or an invisible character (Unicode White_Space or general category Cf, like U+200B or U+FEFF) is written wrong too, with
a name can't start or end with a space or an invisible character, for a subject, a requirement, a check, anany_ofoption and a part. Reports change for such policies. - An empty name,
"", is written wrong too, whether it names a requirement, a check, anany_ofoption or a part, witha name can't be empty. Reports change for such policies: a""was read before. - The docs are split by engine.
README.mdis short and the same for both engines,OPA.mdholds how to install and runergo.regoand the parts ofREFERENCE.mdthat only it has (OPA, Wasm, numbers,ergo.compile), andREFERENCE.mddescribes only the language. - The
$well_formedrow lists the problems of fields, parts and checks sorted by name as the report writes it, quotes and escapes included, by code point, where parts were sorted by the raw name. Reports change for parts with names that need quoting, and arequirethat is written wrong is listed second in the$well_formedrow. - An own field named like a part of the subject or like a
foralias keeps its dot in the name of an input, like.cov.pct, and so does the list acount of,sum ofor a walk reads, like.art.xs[]. Reports change for such policies: they were namedcov.pctandart.xs[]. Thefailed_itemsof a walk or aforline keep the dot too. - A key read from
$paramsor$input, afternamed byor in brackets, has to be a string, as spec 0.4 says. A number used to read that item of a list, som named by $input.k is 1withkholding1andmholding[5, 1]passed by reading1, andcommits[$params.n]read a commit. It fails asunusablenow, and so does a boolean. An object, a list ornullfailed asabsentin afollowed bypiece, anevery, asome, acount of, asum of, aforline and a field aftersorted byon aforline, and fails asunusable, ornullfornull, now, as it did in a plain comparison. Reports change for such policies. - A
fromline likescans named by $params.env named by each of $params.kgave$min_subjectsthe list's cause when bothenvandkcouldn't be read. The ref before the list decides now, as subjects.sentence says:envholding1or an object givesunusablewhateverkholds. Reports change for such policies, in the cause only.
Fixed
- A
forline whose check reads a path with anamed byfield, likerow.w named by p is "xy"underevery rows as row, stopped the whole report witheval_conflict_errorwhen an item wasn't an object andpwasnullor a number. The row fails asnot_an_objectnow, with the item infailed_items, as in the Rust engine. - A later
foritem whose path is named by an alias of an earlier one, likeevery ks as k, every m named by k as x, failed asabsentwhen the alias held an object, a list, a number ornull. It fails asunusablenow, and asnullwhen the alias holdsnull, as for.named_by says and as the Rust engine does. So doesevery rows as r, every r.xs named by r.k as x, where the key afternamed byis the one wordr, the whole row. Reports change for such policies, in the cause only: none of them passed. some vals is m named by kunderevery ks as kstopped the whole report witheval_conflict_errorwhenkheld anything but a string, and so didevery,is inand the other comparisons where aneveryorsomereads a path named by aforalias on the right. The row fails asunusablenow, or asnullwhen the alias holdsnull, as in the Rust engine. Reports change for such policies: they have rows where there was an error.