示例#1
0
    def testWithFlowsWithoutVfsAndSingleProperlyLabeledAndApprovedClient(self):
        self.RequestAndGrantClientApproval(self.client_urn)

        params = api_router.ApiLabelsRestrictedCallRouterParams(
            labels_whitelist=["foo"], allow_flows_access=True)
        router = api_router.ApiLabelsRestrictedCallRouter(params=params)

        self.CheckOnlyFollowingMethodsArePermitted(
            router,
            [
                # Clients methods.
                "SearchClients",
                "ListClientApprovals",
                "GetClient",
                "GetClientVersions",
                "GetClientVersionTimes",
                "CreateClientApproval",
                "GetClientApproval",

                # Flows methods.
                "ListFlows",
                "GetFlow",
                "CreateFlow",
                "CancelFlow",
                "ListFlowResults",
                "GetFlowResultsExportCommand",
                "GetFlowFilesArchive",
                "ListFlowOutputPlugins",
                "ListFlowOutputPluginLogs",
                "ListFlowOutputPluginErrors",
                "ListFlowLogs",
            ] + self.NON_ACLED_METHODS)  # pyformat: disable
示例#2
0
    def testWithoutFlowsWithVfsAndSingleProperlyLabeledAndApprovedClient(self):
        self.RequestAndGrantClientApproval(self.client_urn)

        params = api_router.ApiLabelsRestrictedCallRouterParams(
            labels_whitelist=["foo"], allow_vfs_access=True)
        router = api_router.ApiLabelsRestrictedCallRouter(params=params)

        self.CheckOnlyFollowingMethodsArePermitted(
            router,
            [
                # Client methods.
                "SearchClients",
                "ListClientApprovals",
                "GetClient",
                "GetClientVersions",
                "GetClientVersionTimes",
                "CreateClientApproval",
                "GetClientApproval",

                # VFS methods
                "ListFiles",
                "GetFileDetails",
                "GetFileText",
                "GetFileBlob",
                "GetFileVersionTimes",
                "GetFileDownloadCommand",
                "CreateVfsRefreshOperation",
                "GetVfsRefreshOperationState",
                "GetVfsTimeline",
                "GetVfsTimelineAsCsv"
            ] + self.NON_ACLED_METHODS)  # pyformat: disable
示例#3
0
    def testWithoutFlowsWithoutVfsAndUnapprovedClientWithWrongLabelOwner(self):
        params = api_router.ApiLabelsRestrictedCallRouterParams(
            labels_whitelist=["foo"], labels_owners_whitelist=["somebody"])
        router = api_router.ApiLabelsRestrictedCallRouter(params=params)

        self.CheckOnlyFollowingMethodsArePermitted(
            router, ["SearchClients", "ListClientApprovals"] +
            self.NON_ACLED_METHODS)  # pyformat: disable
示例#4
0
    def testWithoutFlowsWithoutVfsAndUnapprovedClientWithWrongLabelName(self):
        params = api_router.ApiLabelsRestrictedCallRouterParams(
            allow_labels=["bar"])
        router = api_router.ApiLabelsRestrictedCallRouter(params=params)

        self.CheckOnlyFollowingMethodsArePermitted(
            router, ["SearchClients", "ListClientApprovals"] +
            self.NON_ACLED_METHODS)  # pyformat: disable
示例#5
0
    def testWithFlowsWithoutVfsAndSingleMislabeledUnapprovedClient(self):
        params = api_router.ApiLabelsRestrictedCallRouterParams(
            allow_flows_access=True)
        router = api_router.ApiLabelsRestrictedCallRouter(params=params)

        self.CheckOnlyFollowingMethodsArePermitted(router, [
            "SearchClients",
            "ListClientApprovals",
        ] + self.NON_ACLED_METHODS)  # pyformat: disable
示例#6
0
    def testWithoutFlowsWithoutVfsAndSingleProperlyLabeledApprovedClient(self):
        self.RequestAndGrantClientApproval(self.client_urn)

        params = api_router.ApiLabelsRestrictedCallRouterParams(
            labels_whitelist=["foo"])
        router = api_router.ApiLabelsRestrictedCallRouter(params=params)
        self.CheckOnlyFollowingMethodsArePermitted(router, [
            "SearchClients", "ListClientApprovals", "GetClient",
            "GetClientVersions", "GetClientVersionTimes",
            "CreateClientApproval", "GetClientApproval"
        ] + self.NON_ACLED_METHODS)  # pyformat: disable
示例#7
0
  def testWithoutFlowsWithVfsAndSingleMislabeledUnapprovedClient(self):
    params = api_router.ApiLabelsRestrictedCallRouterParams(
        allow_vfs_access=True)
    router = api_router.ApiLabelsRestrictedCallRouter(params=params)

    self.CheckOnlyFollowingMethodsArePermitted(router, [
        "SearchClients",
        "ListClientApprovals",

        # This operation is always allowed as it doesn't depend on a client
        # id.
        "GetVfsRefreshOperationState"
    ] + self.NON_ACLED_METHODS)  # pyformat: disable
示例#8
0
    def testWithFlowsWithoutVfsAndSingleProperlyLabeledUnapprovedClient(self):
        params = api_router.ApiLabelsRestrictedCallRouterParams(
            labels_whitelist=["foo"], allow_flows_access=True)
        router = api_router.ApiLabelsRestrictedCallRouter(params=params)

        self.CheckOnlyFollowingMethodsArePermitted(router, [
            "SearchClients",
            "ListClientApprovals",
            "GetClient",
            "GetClientVersions",
            "GetClientVersionTimes",
            "CreateClientApproval",
            "GetClientApproval",
        ] + self.NON_ACLED_METHODS)  # pyformat: disable