Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delegationRequestSchema.json incomplete schema #348

Open
andrii482 opened this issue Nov 27, 2023 · 0 comments
Open

delegationRequestSchema.json incomplete schema #348

andrii482 opened this issue Nov 27, 2023 · 0 comments

Comments

@andrii482
Copy link
Contributor

andrii482 commented Nov 27, 2023

looks like delegation request failed because target missing in policySets in delegationRequestSchema.json

{"error":"Invalid mask document","details":[{"keyword":"additionalProperties","dataPath":".delegationRequest.policySets[0]","schemaPath":"#/properties/delegationRequest/properties/policySets/items/additionalProperties","params":{"additionalProperty":"target"},"message":"should NOT have additional properties"}]}

looks like this modification of delegationRequestSchema.json can fix mentioned issue:

{
    "definitions": {
      "accessSubject": {
        "type": "string",
        "pattern": "^\\S+$"
      },
      "type": {
        "type": "string",
        "pattern": "^[^\\s\\*]+$"
      },
      "identifiers": {
        "type": "array",
        "uniqueItems": true,
        "minItems": 1,
        "items": {
          "type": "string",
          "pattern": "^\\S+$"
        }
      },
      "attributes": {
        "type": "array",
        "uniqueItems": true,
        "minItems": 1,
        "items": {
          "type": "string",
          "pattern": "^\\S+$"
        }
      },
      "actions": {
        "type": "array",
        "uniqueItems": true,
        "minItems": 1,
        "items": {
          "type": "string",
          "pattern": "^\\S+$"
        }
      },
      "effect": {
        "type": "string",
        "enum": [
          "Permit",
          "Deny"
        ]
      },
      "rules": {
        "type": "array",
        "minItems": 1,
        "items": {
          "type": "object",
          "required": [ "effect" ],
          "properties": {
            "effect": {
              "$ref": "#/definitions/effect"
            }
          },
          "additionalProperties": {
            "target": {
              "type": "object",
              "additionalProperties": false,
              "required": [ "resource" ],
              "properties": {
                "resource": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "type": {
                      "$ref": "#/definitions/type"
                    },
                    "identifiers": {
                      "$ref": "#/definitions/identifiers"
                    },
                    "attributes": {
                      "$ref": "#/definitions/attributes"
                    }
                  }
                },
                "actions": {
                  "$ref": "#/definitions/actions"
                }
              }
            }
          }
        }
      },
      "target": {
        "type": "object",
        "additionalProperties": false,
        "required": [ "resource", "actions" ],
        "properties": {
          "resource": {
            "type": "object",
            "additionalProperties": false,
            "required": [ "type", "identifiers" ],
            "properties": {
              "type": {
                "$ref": "#/definitions/type"
              },
              "identifiers": {
                "$ref": "#/definitions/identifiers"
              },
              "attributes": {
                "$ref": "#/definitions/attributes"
              }
            }
          },
          "actions": {
            "$ref": "#/definitions/actions"
          },
          "environment": {
            "type": "object",
            "additionalProperties": false,
            "required": [ "serviceProviders" ],
            "properties": {
              "serviceProviders": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "policies": {
        "type": "array",
        "minItems": 1,
        "items": {
          "type": "object",
          "additionalProperties": false,
          "required": [ "target", "rules" ],
          "properties": {
            "target": {
              "$ref": "#/definitions/target"
            },
            "rules": {
              "$ref": "#/definitions/rules"
            }
          }
        }
      }
    },
  
    "type": "object",
    "required": ["delegationRequest"],
    "additionalProperties": false,
    "properties": {
      "delegationRequest": {
        "type": "object",
        "required": [ "policyIssuer", "target", "policySets" ],
        "additionalProperties": false,
        "properties": {
          "policyIssuer": {
            "type": "string",
            "pattern": "^\\S+$"
          },
          "target": {
            "type": "object",
            "additionalProperties": false,
            "required": [ "accessSubject" ],
            "properties": {
              "accessSubject": {
                "$ref": "#/definitions/accessSubject"
              }
            }
          },
          "policySets": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [ "policies" ],
              "properties": {
                "policies": {
                  "$ref": "#/definitions/policies"
                },
                "target": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [ "environment" ],
                  "properties": {
                    "environment": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [ "licenses" ],
                      "properties": {
                        "licenses": {
                          "type": "array",
                          "minItems": 1,
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "delegation_path": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^\\S+$"
            }
          },
          "previous_steps": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^\\S+$"
            }
          }
        }
      }  
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant