| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Config.Rule
Contents
Description
Resolve named rule patches against a base policy, accumulating malformed entries.
Mount patches keep unspecified parameters and phases, or remove an entry with enabled: false.
Synopsis
- newtype RulePolicy = RulePolicy {
- policyRules :: Map Text PrecededRule
- emptyPolicy :: RulePolicy
- resolvePolicy :: RulePolicy -> RulePatch -> Either [PolicyError] RulePolicy
- newtype RulePatch = RulePatch (Map Text RuleEntry)
- data RuleEntry = RuleEntry {
- entryType :: Maybe Text
- entryPrecedence :: Maybe Int
- entryEnabled :: Maybe Bool
- entryAgeSeconds :: Maybe Integer
- entryScope :: Maybe Text
- entryIdentity :: Maybe Text
- entryMinCvss :: Maybe Double
- entryMinEpss :: Maybe Double
- entryOnUnavailable :: Maybe Text
- entryRemainingAdvisories :: Maybe Text
- entryMaxRemainingCvss :: Maybe Double
- entryMaxRemainingEpss :: Maybe Double
- entryMinCvssGap :: Maybe Double
- entryMinEpssGap :: Maybe Double
- entryAppliesTo :: Maybe [Text]
- knownRuleTypes :: [Text]
- data PolicyError
- renderPolicyError :: PolicyError -> Text
Policies
newtype RulePolicy Source #
A resolved rule set, keyed by the rule name an operator patches it under.
Constructors
| RulePolicy | |
Fields
| |
Instances
| Show RulePolicy Source # | |
Defined in Ecluse.Config.Rule Methods showsPrec :: Int -> RulePolicy -> ShowS # show :: RulePolicy -> String # showList :: [RulePolicy] -> ShowS # | |
| Eq RulePolicy Source # | |
Defined in Ecluse.Config.Rule | |
emptyPolicy :: RulePolicy Source #
The policy a load starts from before the shipped defaults are applied.
resolvePolicy :: RulePolicy -> RulePatch -> Either [PolicyError] RulePolicy Source #
Apply a patch to a base policy. Every entry resolves before any applies, so one load reports every refusal.
Declared patches
A declared rules object: one RuleEntry per rule name it names.
One rule's declared keys, every one optional. refuseStrayParameters refuses those its type does not read.
Constructors
| RuleEntry | |
Fields
| |
knownRuleTypes :: [Text] Source #
The rule type names the diagnostics recognise. Any other name is an UnknownRuleType.
Refusals
data PolicyError Source #
Why one declared rule was refused. A load reports every one it accumulated.
Constructors
| MissingRuleType Text | |
| UnknownRuleType Text Text | |
| MalformedRule Text Text | |
| SuppressUnknownRule Text |
Instances
| Show PolicyError Source # | |
Defined in Ecluse.Config.Rule Methods showsPrec :: Int -> PolicyError -> ShowS # show :: PolicyError -> String # showList :: [PolicyError] -> ShowS # | |
| Eq PolicyError Source # | |
Defined in Ecluse.Config.Rule | |
renderPolicyError :: PolicyError -> Text Source #
One refusal as the boot reports it, naming the rule it was declared under.