Repository navigation
Ergo CLI and Rust engine 0.4.0
·
37 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
New
ergo_policy_engine::SPECis public. It is the version of the spec the engine implements, the text a policy'sergo_specand a report'sergouse, so a program that builds policies for the engine can write the version from it.
Changed
- A
fromline with more than one name needseveryto read a list, andeveryworks on a child subject, as inergo.rego0.6.0 and spec 0.6. A line that ends at text, a number or true or false gives that value as a subject, the subjects of a line must be of one type,everyreads one list per name, a name it reads as a list must be one in every item,every deploymentis written wrong, and a list beforenamed by each ofsays to use a child subject. A failure for mixed types, or for a name that is a list in some items only, lists the items it names infailed_items, and a child subject of such a line is still read under each parent. Reports change as spec/CHANGELOG.md says. - Names resolve where spec 0.6 says, as in
ergo.rego0.6.0: a bare name on the right of the phrase aftereveryorsomereads the subject's field,whoseandthatread the value the path ends at,pr.authorreads the subject's field inside a relative clause, and the right side of asomeoreverycondition in afromline reads the candidate. Reports change for policies that write these, see spec/CHANGELOG.md. This version follows spec 0.6, so a policy saysergo_spec: v0.6. - As spec 0.6 also says:
pr named by kandpr[0]are allowed inside a relative clause; awhosethat compares a field with itself sayswrite pr.x;distinctno longer makes a bare name on the right written wrong; asum ofwhosewhose, or the right side of itsthat, reads a name of the value it adds is written wrong; anamed byon the right ofeveryorsomereads the subject's key whatever the path starts at,$paramsand$inputincluded;named by pr.ktakes the key from the subject inside a relative clause, after any path; a root name in awhoseor on the right ofeveryorsomeis read once, up front, so a problem with it fails the row even on an empty list; awhosethat compares a field with itself gives no advice when the subject's name needs double quotes; and messages name a value past the list after its item and a colon, list every item acount oforsum ofcouldn't read, say a root name no item can use once, and a root name's problem inside a relative clause once with no item, and an item of its own list once, likeitem 2 of $params.envs is null, which isn't an object, name anamed bykey that can't be read, and write the item's path in full when a name on the right is spelled the same. - As spec 0.6 and
ergo.rego0.6.0 say,containsanddoes not containread one value and never walk a list on their right side, the list afternamed by each ofnever walks a list, a message names text, a number or a list that stops the read of its keys, and a right side that walks a list names the value where the read stopped when another item holds a list there.tags contains $input.k followed by ""on an input that is a list fails asnot_an_object, as inergo.rego, where it read each item of the input and passed.$refslist such a path, and the keys ofnamed by each of, as written with the valuenull, as inergo.rego. Reports change as spec/CHANGELOG.md says. - As spec 0.6 and
ergo.rego0.6.0 say,every,some,count of,sum of, aforitem without a position and the right side of the phrases that take a list read each item of a list a path starts at, whether it is the subject, a part, aforalias or$input, and so does a secondforitem that starts at an alias holding a list. A check that also reads the subject's own field outside those still fails asnot_an_object, once. A path from$inputwhose first step is a key or anamed byfails asnot_an_objecton an input that is a list, where it failed asunusable, and says$input is [...], which isn't an object. Aforitem that isn't an object is named by its value, where it saidis null. A check that can't use a param or anamed bykey no longer says the list it reads isn't an object, and a root name inside awhosethat isn't a list, or that is missing ornullin an item of the subject, is said once, with no item. - A path that meets
nullpartway along fails asnull, where it failed asabsent, and the message names the step that isnull, as inergo.regoand spec 0.6:c.z is 1withcnullsaysc is null, andpl.z is 1with the partplnullsayspl is null. The same goes for$input,$params, a parent's field, aforalias and a position on anullsubject, alias or$input. A key read from a field right after thenullstill decides. Awhosecondition on afromline reads the same way, so its$appliesrow fails asnull, while afromline that walks through thenull, likeevery prs.c.z, still fails$min_subjectsasabsent. A key read from a field after thenullis named too, after the step, likes is null; p is 3, which isn't text. - A requirement on a child subject checks the ids of every ancestor of its subject too, on
$unique_ancestor_idsrows, as inergo.rego0.6.0 and spec 0.6. Reports of every requirement on a child subject change, see spec/CHANGELOG.md. - A name under a
forline that doesn't depend on the item, a field of the subject or of a part,$paramsor$inputwith or without a path, or an alias of an earlier line, is read once, before any item, as inergo.regoand spec 0.6 (for.roots). When a compare oris inphrase reads it as a value, a problem with it fails the check on an empty list too, with or without, if any,, and the message names it once with no item in front, whatever its cause, then the empty list if it is one, then what each item says on its own,z is missing; item 1 of xs: m.v is 1. A$paramsor$inputread alone is such a name too, andfailed_itemslists every item that failed, also when a name is said once. A root in awhoseon theforline no longer hides what an item says on its own, whichever clause comes first:every xs whose k is in pr.z and whose v is 1 as mwithpr.zholding"s"sayspr.z is "s", which isn't a list; item 2 of xs: v is "x", which isn't a number, where it said onlypr.z is "s", which isn't a list. A list on a later line that doesn't depend on the item is said before the items' problems. Anamed bykey read from the item undernullparams says what missing params say. In acount oforsum of, a$paramsor$inputname that is missing ornullis named before the others, like$params.l is missing; pr.l is missingforcount of xs whose w is in pr.l and whose v is in $params.l is 0, where it saidpr.l is missing; $params.l is missing. The report no longer depends on the order thewhoseclauses are written in. Reports change for policies that write these, see spec/CHANGELOG.md. - Under a
forline,is,count of,sum ofand anamed bykey read a root once, before any item, as inergo.regoand spec 0.6 (for.roots). A root that is missing,nullor of the wrong type fails the check on an empty list too, and is named once with no item in front:z is 1withzholding"s"saysz is "s", which isn't a number,count of z is 1saysz is "s", which isn't a list or an object, andm.t named by z is 1withzholding3saysz is 3, which isn't text, where it said it for each item. A key the row can't read is named before what each item says on its own. An object thatcount oforsum ofreads fails on an empty list too, withz is {"a": 1}, which isn't a list, with or without awhose, as it does with items. Acount oforsum ofroot is said once with items, where it was said for each item:count of z is at least m.vwithzholding"s"saysz is "s", which isn't a list or an object. A sentence that reads two roots isn't said again after them, and a root named before an item's own problem counts towards the cause, sozz is 3, which isn't text; item 1 of ws: w[0] named by zz is missingfails asunusable, notabsent. A name that depends on the item and can't be read, likei.tholding"s"inevery items as i, every $params.l whose v is at least i.t as x, makes the causeunusablewhere a missing ornullitem of$params.lgaveabsentornull, with the same message. The names of one sentence are said worst cause first and then by name. Reports change for policies that write these. - A ref on the right of
is in,is not in,contains,contains all ofand the other phrases that take a list or patterns is listed in the row'sinputsafter the field, as inergo.rego0.6.0 and spec 0.6 (path.right_inputs), and a violation lists a ref its row lists already once. The rows ofevery,someandcount oflist such a ref from$inputwhere they list the right side ofis at least, but not one from$params, and aforline's own row lists one from either. A ref withnamed byafter these phrases is listed in those rows as it is afteris at least, like$input.m named by kandkinevery xs.n is in $input.m named by k, where it was left out, or listed in full in awhosewhereergo.regolists$input.m. Changes the report of every such check.
Fixed
- The
checksblock of the report matchesergo.regoin three places. A$refsentry for a path that reads through a list of params, like$params[0].v, points at where the read stopped,$params:/0, where it pointed at$params:. A check written wrong because it has a field no check has, likezzor afornext to anany_of, keeps the words it was written with in itsexpression,is one of $params.z, and has no$refs, where it printedis inand listed the refs. A failed assertion of aforcheck lists the alias before the path through it,okand thenok.fs[].k, where it listed the path first. - The
$appliescheck has$refsfor each$paramsor$inputpath the conditions of afromline read, like$params.iinthings whose x.y named by $params.i does not exist, asergo.regoand spec 0.6 say, where it had none. - A
count oforsum ofwhose path runs into an item that isn't an object says so, likeitem 1 of xs: m is "s", which isn't an object, asergo.regodoes, where it saidm.v is null, which isn't a number. - A root name that a
whose, or the phrase aftereveryorsome, reads as a list and that isn't one, like$params.qorpr.zincount of xs whose v is in pr.z is 0, fails asunusableand names itself, likepr.z is "s", which isn't a list, on an empty list too, asergo.regodoes, where the check passed. On aforitem the message no longer puts an item in front, likeitem 1 of xs: pr.z is "s", which isn't a list. Every root name in a relative clause that fails is named, whatever its cause, in the order the sentence reads them and in front of what the items say, as inergo.rego, where it named the first one with the row's cause, and a check's own row that fails asabsentornullnames a missing ornullside read from the subject too, likec.z is missing, and d is null. A list in the middle of a subject's field on the right ofeveryorsome, likec.zwithca list, fails before any item and with no item in front, where it passed on an empty list. A walk whose ref step can't be read names its path and then each root its phrase can't read, likexs named by $params.k is missing; q is missing, where it named only the path. A root of the wrong type for any other phrase, likepr.zafteris at least, fails the same way on an empty list too, with no item in front, asergo.regodoes. A root in a sentence under aforline is named once, with no item, and a root that reads the alias of the first item in the second item fails on an empty list too, likeitem 1 of ys: m.q is "s", which isn't a list, where it blameditem 1 of xs. Acount ofnames a missing ornull$paramsor$inputroot first, sorted, asergo.regodoes. - A part that holds a list, like
plinm.v is in pl.zunderevery xs as mwithhas: {pl: c}andcholding[{"z": 1}], fails theforcheck asunusablewithpl is [{"z": 1}], which isn't an object, asergo.regoand spec 0.6 say, where it failed asvaluewith[]and passed with[{"z": 1}].count of xs whose v is in pl.z is 0is read the same way. When the params aren't an object, aforline that picks tied items fails asambiguous, notunusable, and a tie under awhosethat reads the first item's name is named instead offor ... is false. require: someon a child subject needs a passing subject under each parent, as spec 0.6 andergo.rego0.6.0 say. Failing subjects under a parent that has a passing one are not violations and not counted incauses.