mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-03 11:22:45 +02:00
chore(deps): bump github.com/golangci/golangci-lint from 1.48.0 to 1.50.0 (#3667)
* chore(deps): bump github.com/golangci/golangci-lint Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.48.0 to 1.50.0. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.48.0...v1.50.0) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * lint Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Caleb Doxsey <cdoxsey@pomerium.com>
This commit is contained in:
parent
d147846e64
commit
ec495bb682
25 changed files with 236 additions and 382 deletions
|
@ -91,9 +91,8 @@ func RulesFromArray(a Array) ([]Rule, error) {
|
|||
//
|
||||
// One form is supported:
|
||||
//
|
||||
// 1. An object where the keys are the actions and the values are an object with "and", "or", or "not" fields:
|
||||
// `{ "allow": { "and": [ {"groups": "group1"} ] } }`
|
||||
//
|
||||
// 1. An object where the keys are the actions and the values are an object with "and", "or", or "not" fields:
|
||||
// `{ "allow": { "and": [ {"groups": "group1"} ] } }`
|
||||
func RulesFromObject(o Object) ([]Rule, error) {
|
||||
var rules []Rule
|
||||
for k, v := range o {
|
||||
|
@ -237,9 +236,8 @@ func CriteriaFromArray(a Array) ([]Criterion, error) {
|
|||
//
|
||||
// One form is supported:
|
||||
//
|
||||
// 1. An object where the keys are the names with a sub path and the values are the corresponding
|
||||
// data for each Criterion: `{ "groups": "group1" }`
|
||||
//
|
||||
// 1. An object where the keys are the names with a sub path and the values are the corresponding
|
||||
// data for each Criterion: `{ "groups": "group1" }`
|
||||
func CriterionFromObject(o Object) (*Criterion, error) {
|
||||
if len(o) != 1 {
|
||||
return nil, fmt.Errorf("each criteria may only contain a single key and value")
|
||||
|
|
|
@ -139,7 +139,9 @@ func (o Object) Clone() Value {
|
|||
}
|
||||
|
||||
// Falsy returns true if the value is considered Javascript falsy:
|
||||
// https://developer.mozilla.org/en-US/docs/Glossary/Falsy.
|
||||
//
|
||||
// https://developer.mozilla.org/en-US/docs/Glossary/Falsy.
|
||||
//
|
||||
// If the field is not found in the object it is *not* falsy.
|
||||
func (o Object) Falsy(field string) bool {
|
||||
v, ok := o[field]
|
||||
|
|
|
@ -15,63 +15,62 @@
|
|||
//
|
||||
// An example policy:
|
||||
//
|
||||
// allow:
|
||||
// and:
|
||||
// - domain: example.com
|
||||
// - group: admin
|
||||
// deny:
|
||||
// or:
|
||||
// - user: user1@example.com
|
||||
// - user: user2@example.com
|
||||
// allow:
|
||||
// and:
|
||||
// - domain: example.com
|
||||
// - group: admin
|
||||
// deny:
|
||||
// or:
|
||||
// - user: user1@example.com
|
||||
// - user: user2@example.com
|
||||
//
|
||||
// The JSON Schema for the language:
|
||||
//
|
||||
// {
|
||||
// "$ref": "#/definitions/policy",
|
||||
// "definitions": {
|
||||
// "policy": {
|
||||
// "anyOf": [
|
||||
// { "$ref": "#/definitions/rules" },
|
||||
// {
|
||||
// "type": "array",
|
||||
// "items": { "$ref": "#/definitions/rules" }
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// "rules": {
|
||||
// "type": "object",
|
||||
// "properties": {
|
||||
// "allow": { "$ref": "#/definitions/rule_body" },
|
||||
// "deny": { "$ref": "#/definitions/rule_body" }
|
||||
// }
|
||||
// },
|
||||
// "rule_body": {
|
||||
// "type": "object",
|
||||
// "properties": {
|
||||
// "and": {
|
||||
// "type": "array",
|
||||
// "items": { "$ref": "#/definitions/criteria" }
|
||||
// },
|
||||
// "not": {
|
||||
// "type": "array",
|
||||
// "items": { "$ref": "#/definitions/criteria" }
|
||||
// },
|
||||
// "or": {
|
||||
// "type": "array",
|
||||
// "items": { "$ref": "#/definitions/criteria" }
|
||||
// }
|
||||
// },
|
||||
// "additionalProperties": false
|
||||
// },
|
||||
// "criteria": {
|
||||
// "type": "object",
|
||||
// "additionalProperties": true,
|
||||
// "minProperties": 1,
|
||||
// "maxProperties": 1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// "$ref": "#/definitions/policy",
|
||||
// "definitions": {
|
||||
// "policy": {
|
||||
// "anyOf": [
|
||||
// { "$ref": "#/definitions/rules" },
|
||||
// {
|
||||
// "type": "array",
|
||||
// "items": { "$ref": "#/definitions/rules" }
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// "rules": {
|
||||
// "type": "object",
|
||||
// "properties": {
|
||||
// "allow": { "$ref": "#/definitions/rule_body" },
|
||||
// "deny": { "$ref": "#/definitions/rule_body" }
|
||||
// }
|
||||
// },
|
||||
// "rule_body": {
|
||||
// "type": "object",
|
||||
// "properties": {
|
||||
// "and": {
|
||||
// "type": "array",
|
||||
// "items": { "$ref": "#/definitions/criteria" }
|
||||
// },
|
||||
// "not": {
|
||||
// "type": "array",
|
||||
// "items": { "$ref": "#/definitions/criteria" }
|
||||
// },
|
||||
// "or": {
|
||||
// "type": "array",
|
||||
// "items": { "$ref": "#/definitions/criteria" }
|
||||
// }
|
||||
// },
|
||||
// "additionalProperties": false
|
||||
// },
|
||||
// "criteria": {
|
||||
// "type": "object",
|
||||
// "additionalProperties": true,
|
||||
// "minProperties": 1,
|
||||
// "maxProperties": 1
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
package parser
|
||||
|
||||
import (
|
||||
|
@ -83,8 +82,7 @@ import (
|
|||
)
|
||||
|
||||
// A Parser parses raw policy definitions into a Policy.
|
||||
type Parser struct {
|
||||
}
|
||||
type Parser struct{}
|
||||
|
||||
// New creates a new Parser.
|
||||
func New() *Parser {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue