repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
lemur
lemur/policies/models.py
.py
""" .. module: lemur.policies.models :platform: unix :synopsis: This module contains all of the models need to create a certificate policy within Lemur. :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@ne...
24
735
lemur
lemur/policies/schemas.py
.py
""" .. module: lemur.policies.schemas :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from marshmallow import fields from lemur.common.schema import LemurOutputSchema clas...
20
502
lemur
lemur/policies/service.py
.py
""" .. module: lemur.policies.service :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from lemur import database from lemur.policies.models import RotationPolicy def get(po...
72
1,390
lemur
lemur/policies/cli.py
.py
""" .. module: lemur.policies.cli :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import click from flask.cli import with_appcontext from lemur.policies import service as po...
35
952
lemur
lemur/roles/models.py
.py
""" .. module: lemur.roles.models :platform: unix :synopsis: This module contains all of the models need to create a role within Lemur :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ ...
56
1,652
lemur
lemur/roles/views.py
.py
""" .. module: lemur.roles.views :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import Blueprint, g from flask import make_response, jsonify from flask_restful ...
469
12,916
lemur
lemur/roles/schemas.py
.py
""" .. module: lemur.roles.schemas :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from marshmallow import fields from lemur.users.schemas import UserNestedOutputSchema from ...
44
1,450
lemur
lemur/roles/service.py
.py
""" .. module: service :platform: Unix :synopsis: This module contains all of the services level functions used to administer roles in Lemur :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix....
163
3,772
lemur
lemur/acme_providers/cli.py
.py
import json import time import arrow import click from flask import current_app from flask.cli import with_appcontext from sentry_sdk import capture_exception from lemur.common.utils import check_validation from lemur.constants import SUCCESS_METRIC_STATUS from lemur.plugins import plugins from lemur.plugins.lemur_ac...
206
6,361
lemur
lemur/reporting/service.py
.py
import arrow from datetime import timedelta from sqlalchemy import cast, not_ from sqlalchemy_utils import ArrowType from lemur import database from lemur.certificates.models import Certificate def filter_by_validity(query, validity=None): if validity == "expired": query = query.filter(Certificate.expir...
78
1,918
lemur
lemur/reporting/cli.py
.py
""" .. module: lemur.reporting.cli :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import click from flask.cli import with_appcontext from tabulate import tabulate from lemu...
106
2,754
lemur
lemur/endpoints/models.py
.py
""" .. module: lemur.endpoints.models :platform: unix :synopsis: This module contains all of the models need to create an authority within Lemur. :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.c...
124
3,973
lemur
lemur/endpoints/views.py
.py
""" .. module: lemur.endpoints.views :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import Blueprint, g from flask_restful import reqparse, Api from lemur.common...
109
2,991
lemur
lemur/endpoints/schemas.py
.py
""" .. module: lemur.endpoints.schemas :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from marshmallow import fields from lemur.common.schema import LemurOutputSchema from ...
49
1,445
lemur
lemur/endpoints/service.py
.py
""" .. module: lemur.endpoints.service :platform: Unix :synopsis: This module contains all of the services level functions used to administer endpoints in Lemur :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson ...
230
6,021
lemur
lemur/authorities/models.py
.py
""" .. module: lemur.authorities.models :platform: unix :synopsis: This module contains all of the models need to create an authority within Lemur. :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix...
143
4,637
lemur
lemur/authorities/views.py
.py
""" .. module: lemur.authorities.views :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import Blueprint, g from flask_restful import reqparse, Api from lemur.comm...
575
20,493
lemur
lemur/authorities/schemas.py
.py
""" .. module: lemur.authorities.schemas :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import current_app from marshmallow import fields, validates_schema, pre_l...
154
5,291
lemur
lemur/authorities/service.py
.py
""" .. module: lemur.authorities.service :platform: Unix :synopsis: This module contains all of the services level functions used to administer authorities in Lemur :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glis...
278
8,386
lemur
lemur/users/models.py
.py
""" .. module: lemur.users.models :platform: unix :synopsis: This module contains all of the models need to create a user within lemur :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> ""...
113
3,299
lemur
lemur/users/views.py
.py
""" .. module: lemur.users.views :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import g, Blueprint from flask_restful import reqparse, Api from lemur.auth.permi...
431
11,761
lemur
lemur/users/schemas.py
.py
""" .. module: lemur.users.schemas :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import re from flask import current_app from marshmallow import fields, validates, Validat...
74
2,583
lemur
lemur/users/service.py
.py
""" .. module: lemur.users.service :platform: Unix :synopsis: This module contains all of the services level functions used to administer users in Lemur :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisso...
174
4,805
lemur
lemur/domains/models.py
.py
""" .. module: lemur.domains.models :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from sqlalchemy import Column, Integer, String, Boolean from lemur.database import Base...
24
608
lemur
lemur/domains/views.py
.py
""" .. module: lemur.domains.views :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import Blueprint from flask_restful import reqparse, Api from lemur.domains i...
286
7,825
lemur
lemur/domains/schemas.py
.py
""" .. module: lemur.domains.schemas :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from marshmallow import fields from lemur.common.schema import LemurInputSchema, LemurOu...
38
1,143
lemur
lemur/domains/service.py
.py
""" .. module: lemur.domains.service :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from sqlalchemy import and_ from flask import current_app, g from lemur import databas...
136
3,513
lemur
lemur/logs/models.py
.py
""" .. module: lemur.logs.models :platform: unix :synopsis: This module contains all of the models related private key audit log. :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from sq...
34
1,031
lemur
lemur/logs/views.py
.py
""" .. module: lemur.logs.views :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import Blueprint from flask_restful import reqparse, Api from lemur.common.schema ...
76
2,001
lemur
lemur/logs/schemas.py
.py
""" .. module: lemur.logs.schemas :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from marshmallow import fields from lemur.common.schema import LemurOutputSchema from lemur...
24
731
lemur
lemur/logs/service.py
.py
""" .. module: lemur.logs.service :platform: Unix :synopsis: This module contains all of the services level functions used to administer logs in Lemur :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@...
107
3,081
lemur
lemur/auth/ldap.py
.py
""" .. module: lemur.auth.ldap :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Ian Stahnke <ian.stahnke@myob.com> """ import ldap from ldap.filter import escape_filter_chars from flask import current_app from lemur...
231
8,866
lemur
lemur/auth/views.py
.py
""" .. module: lemur.auth.views :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from __future__ import annotations # Import annotations to make type hints backwards compati...
751
27,772
lemur
lemur/auth/permissions.py
.py
""" .. module: lemur.auth.permissions :platform: Unix :synopsis: This module defines all the permission used within Lemur :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from functools i...
102
3,358
lemur
lemur/auth/service.py
.py
""" .. module: lemur.auth.service :platform: Unix :synopsis: This module contains all of the authentication duties for lemur :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import b...
248
8,921
lemur
lemur/defaults/views.py
.py
""" .. module: lemur.defaults.views :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. """ from flask import current_app, Blueprint from flask_restful import Api from lemur.common.schema import validate_schema from lemur.authorities.service import get_by_...
81
2,367
lemur
lemur/defaults/schemas.py
.py
""" .. module: lemur.defaults.schemas :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from marshmallow import fields from lemur.common.schema import LemurOutputSchema from le...
24
736
lemur
lemur/sources/models.py
.py
""" .. module: lemur.sources.models :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from sqlalchemy.orm import relationship from sqlalchemy import Column, Integer, String, Te...
34
1,025
lemur
lemur/sources/views.py
.py
""" .. module: lemur.sources.views :platform: Unix :synopsis: This module contains all of the accounts view code. :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import Bluepr...
380
11,713
lemur
lemur/sources/schemas.py
.py
""" .. module: lemur.sources.schemas :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from marshmallow import fields, post_dump from lemur.schemas import PluginInputSchema, P...
40
1,162
lemur
lemur/sources/service.py
.py
""" .. module: lemur.sources.service :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import arrow from datetime import timedelta import copy from flask import current_app fr...
467
16,929
lemur
lemur/sources/cli.py
.py
""" .. module: lemur.sources.cli :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import sys import time from copy import deepcopy import click from flask import current_app ...
451
15,302
lemur
lemur/authorizations/models.py
.py
""" .. module: lemur.authorizations.models :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Netflix Secops <secops@netflix.com> """ from sqlalchemy import Column, Integer, String from sqlalchemy_utils import JSONType...
35
1,085
lemur
lemur/authorizations/service.py
.py
""" .. module: lemur.pending_certificates.service Copyright (c) 2018 and onwards Netflix, Inc. All rights reserved. .. moduleauthor:: Secops <secops@netflix.com> """ from lemur import database from lemur.authorizations.models import Authorization def get(authorization_id): """ Retrieve dns authorization...
25
647
lemur
lemur/tests/test_schemas.py
.py
import json import pytest from marshmallow.exceptions import ValidationError from lemur.tests.factories import RoleFactory def test_get_object_attribute(): from lemur.schemas import get_object_attribute with pytest.raises(ValidationError): get_object_attribute({}) with pytest.raises(ValidationE...
131
3,852
lemur
lemur/tests/vectors.py
.py
from lemur.common.utils import parse_certificate VALID_USER_HEADER_TOKEN = { "Authorization": "Basic " + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MjE2NTIwMjIsImV4cCI6MjM4NTY1MjAyMiwic3ViIjoiMSJ9.UQBQzJHyUJNgTVKQRHsBw3tz-plqRWAXiaSIYnOfY9g", "Content-Type": "application/json", } VALID_ADMIN_HEADE...
716
39,137
lemur
lemur/tests/test_notifications.py
.py
import pytest from lemur.notifications.views import * # noqa from .vectors import ( VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, VALID_READ_ONLY_HEADER_TOKEN, VALID_USER_HEADER_TOKEN, ) def test_notification_input_schema(client, notification_plugin, notification): from lemur.notifications....
205
4,945
lemur
lemur/tests/test_ldap.py
.py
import pytest from lemur.auth.ldap import * # noqa from unittest.mock import patch, MagicMock class LdapPrincipalTester(LdapPrincipal): def __init__(self, args): super().__init__(args) self.ldap_server = "ldap://localhost" def bind_test(self): groups = [ ( ...
83
2,766
lemur
lemur/tests/test_verify.py
.py
import pytest import requests import requests_mock from unittest.mock import patch from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization, hashes from cryptography.x509 import UniformResourceIdentifier from lemur.certificates.veri...
69
2,802
lemur
lemur/tests/test_authorities.py
.py
import json import pytest from lemur.authorities.views import * # noqa from lemur.exceptions import InvalidConfiguration from lemur.tests.factories import AuthorityFactory, RoleFactory from lemur.tests.vectors import ( VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN, ) def test...
604
17,473
lemur
lemur/tests/test_user_service.py
.py
from unittest.mock import MagicMock, patch from lemur.users import service as user_service def _role(name): r = MagicMock() r.name = name return r def _patch_config(overrides=None): mock_app = MagicMock() def config_get(key, default=None): return (overrides or {}).get(key, default) ...
109
5,180
lemur
lemur/tests/test_destinations.py
.py
import json import pytest from lemur.destinations.views import * # noqa from .vectors import ( VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN, ) def test_invalid_label(): from lemur.destinations.models import Destination with pytest.raises(ValueError) as e: D...
274
7,313
lemur
lemur/tests/test_oauth.py
.py
from datetime import datetime, timedelta from freezegun import freeze_time from flask import current_app from lemur.auth.views import * # noqa from lemur.tests.conf import OAUTH_STATE_TOKEN_STALE_TOLERANCE_SECONDS, OAUTH_STATE_TOKEN_SECRET def test_build_hmac(client): from lemur.auth.views import build_hmac ...
49
1,575
lemur
lemur/tests/test_api_keys.py
.py
import json import pytest from lemur.api_keys.views import * # noqa from .vectors import ( VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN, ) @pytest.mark.parametrize( "token,status", [ (VALID_USER_HEADER_TOKEN, 200), (VALID_ADMIN_HEADER_TOKEN, 200), ...
402
9,920
lemur
lemur/tests/test_auth.py
.py
from unittest.mock import patch import pytest from cryptography.hazmat.primitives import hashes from cryptography.hazmat.backends import default_backend import jwt from lemur.auth.service import decode_with_multiple_secrets @patch("lemur.auth.service.metrics") def test_decode_with_multiple_secrets(mock_metrics): ...
84
3,610
lemur
lemur/tests/test_missing.py
.py
import arrow from freezegun import freeze_time def test_convert_validity_years(session): from lemur.common.missing import convert_validity_years with freeze_time("2016-01-01"): data = convert_validity_years(dict(validity_years=2)) assert data["validity_start"] == arrow.utcnow().isoformat() ...
21
628
lemur
lemur/tests/test_dns_providers.py
.py
import json import unittest from lemur.dns_providers import util as dnsutil from lemur.dns_providers.schemas import dns_provider_output_schema class TestDNSProvider(unittest.TestCase): def test_is_valid_domain(self): self.assertTrue(dnsutil.is_valid_domain('example.com')) self.assertTrue(dnsutil....
41
1,904
lemur
lemur/tests/factories.py
.py
import json from datetime import date from typing import List from factory import Sequence, post_generation, SubFactory from factory.alchemy import SQLAlchemyModelFactory from factory.fuzzy import FuzzyChoice, FuzzyText, FuzzyDate, FuzzyInteger from lemur.api_keys.models import ApiKey from lemur.authorities.models im...
477
11,949
lemur
lemur/tests/test_defaults.py
.py
from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from .vectors import SAN_CERT, WILDCARD_CERT, INTERMEDIATE_CERT def test_cert_get_cn(client): from lemur.common.defaults import common_name assert common_name(SAN_CERT) ==...
185
5,509
lemur
lemur/tests/conf.py
.py
# This is just Python which means you can inherit and tweak settings import base64 import os import secrets import string _basedir = os.path.abspath(os.path.dirname(__file__)) # generate random secrets for unittest def get_random_secret(length): chars = string.ascii_uppercase + string.ascii_lowercase + string.d...
273
11,267
lemur
lemur/tests/test_permissions.py
.py
from unittest.mock import MagicMock, patch from flask_principal import Identity, RoleNeed from lemur.auth.permissions import AuthorityCreatorPermission, StrictRolePermission def _config_get(overrides): """Returns a config.get side_effect function with the given key overrides.""" def config_get(key, default=...
112
4,183
lemur
lemur/tests/test_endpoints.py
.py
import pytest from lemur.endpoints.views import * # noqa from lemur.tests.factories import EndpointFactory, CertificateFactory from .vectors import ( VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN, ) def test_rotate_certificate(client, source_plugin): from lemur.deploymen...
219
5,956
lemur
lemur/tests/test_users.py
.py
import json import pytest from marshmallow import ValidationError from lemur.tests.factories import UserFactory, RoleFactory from lemur.users.schemas import UserInputSchema, UserCreateInputSchema from lemur.users.views import * # noqa from .vectors import ( VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, ...
238
5,920
lemur
lemur/tests/test_validators.py
.py
from datetime import datetime import pytest from marshmallow.exceptions import ValidationError from lemur.common.utils import parse_private_key from lemur.common.validators import verify_private_key_match from lemur.tests.vectors import INTERMEDIATE_CERT, SAN_CERT, SAN_CERT_KEY def test_private_key(session): pa...
57
1,560
lemur
lemur/tests/test_domains.py
.py
import pytest from lemur.domains.views import * # noqa from .vectors import ( VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN, ) @pytest.mark.parametrize( "token,status", [ (VALID_USER_HEADER_TOKEN, 200), (VALID_ADMIN_HEADER_TOKEN, 200), (VALID_...
155
3,510
lemur
lemur/tests/test_redis.py
.py
import fakeredis import time import sys def test_write_and_read_from_redis(): function = f"{__name__}.{sys._getframe().f_code.co_name}" red = fakeredis.FakeStrictRedis() key = f"{function}.last_success" value = int(time.time()) assert red.set(key, value) is True assert (int(red.get(key)) == v...
14
334
lemur
lemur/tests/test_messaging.py
.py
from datetime import timedelta import arrow import boto3 import pytest from freezegun import freeze_time from moto import mock_ses from lemur.certificates.service import get_expiring_deployed_certificates from lemur.tests.factories import AuthorityFactory, CertificateFactory, EndpointFactory @mock_ses def verify_se...
352
13,105
lemur
lemur/tests/test_plugins.py
.py
from lemur.plugins.views import * # noqa from .vectors import ( VALID_ADMIN_HEADER_TOKEN, ) def test_plugins_list_get(client, app): response = client.get(api.url_for(PluginsList), headers=VALID_ADMIN_HEADER_TOKEN) assert response.status_code == 200 data = response.get_json() # Perform some as...
21
495
lemur
lemur/tests/test_roles.py
.py
import json import pytest from lemur.roles.views import * # noqa from lemur.tests.factories import ( RoleFactory, AuthorityFactory, CertificateFactory, UserFactory, ) from .vectors import ( VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN, ) def test_role_input_s...
242
5,851
lemur
lemur/tests/test_logs.py
.py
import pytest from lemur.tests.vectors import ( VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN, ) from lemur.logs.views import * # noqa def test_private_key_audit(client, certificate): from lemur.certificates.views import CertificatePrivateKey, api assert len(certifica...
33
836
lemur
lemur/tests/test_certificates.py
.py
import datetime from flask import current_app import json import ssl import threading from http.server import HTTPServer, SimpleHTTPRequestHandler from tempfile import NamedTemporaryFile from unittest.mock import patch import arrow import pytest from cryptography import x509 from cryptography.hazmat.backends import de...
2,341
81,424
lemur
lemur/tests/test_utils.py
.py
import pytest from lemur.tests.vectors import ( SAN_CERT, SAN_CERT_STR, INTERMEDIATE_CERT, ROOTCA_CERT, EC_CERT_EXAMPLE, ECDSA_PRIME256V1_CERT, ECDSA_SECP384r1_CERT, ECDSA_SECP384r1_CERT_STR, DSA_CERT, CERT_CHAIN_PKCS7_PEM, ACME_CHAIN_LONG_STR, ACME_CHAIN_X1_STR ) def ...
161
6,528
lemur
lemur/tests/test_pending_certificates.py
.py
import json import pytest from marshmallow import ValidationError from lemur.pending_certificates.views import * # noqa from .vectors import ( CSR_STR, INTERMEDIATE_CERT_STR, VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN, WILDCARD_CERT_STR, ) def test_increment_at...
118
3,905
lemur
lemur/tests/test_sources.py
.py
import pytest from lemur.sources.views import * # noqa from .vectors import ( VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN, WILDCARD_CERT_STR, WILDCARD_CERT_KEY, ) def validate_source_schema(client): from lemur.sources.schemas import SourceInputSchema input_...
202
4,677
lemur
lemur/tests/conftest.py
.py
import datetime import os import pytest from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from flask import current_app from flask_principal import identity_changed, Identity from sqlalchemy.sql import text from lemur import create...
366
8,548
lemur
lemur/tests/plugins/notification_plugin.py
.py
from lemur.plugins.bases import NotificationPlugin class TestNotificationPlugin(NotificationPlugin): title = "Test" slug = "test-notification" description = "Enables testing" author = "Kevin Glisson" author_url = "https://github.com/netflix/lemur.git" def __init__(self, *args, **kwargs): ...
18
463
lemur
lemur/tests/plugins/issuer_plugin.py
.py
from lemur.plugins.bases import IssuerPlugin from lemur.tests.vectors import SAN_CERT_STR, INTERMEDIATE_CERT_STR, IP_SAN_NO_CN_CERT_STR from lemur.common.utils import parse_csr from cryptography import x509 from cryptography.x509.oid import ExtensionOID class TestIssuerPlugin(IssuerPlugin): title = "Test" sl...
63
2,114
lemur
lemur/tests/plugins/destination_plugin.py
.py
from lemur.plugins.bases import DestinationPlugin class TestDestinationPlugin(DestinationPlugin): title = "Test" slug = "test-destination" description = "Enables testing" author = "Kevin Glisson" author_url = "https://github.com/netflix/lemur.git" def __init__(self, *args, **kwargs): ...
35
987
lemur
lemur/tests/plugins/source_plugin.py
.py
from lemur.plugins.bases import SourcePlugin class TestSourcePlugin(SourcePlugin): title = "Test" slug = "test-source" description = "Enables testing" author = "Kevin Glisson" author_url = "https://github.com/netflix/lemur.git" def __init__(self, *args, **kwargs): super().__init__(*a...
20
453
lemur
lemur/pending_certificates/models.py
.py
""" .. module: lemur.pending_certificates.models Copyright (c) 2018 and onwards Netflix, Inc. All rights reserved. .. moduleauthor:: James Chuong <jchuong@instartlogic.com> """ from datetime import datetime as dt from sqlalchemy import ( Integer, ForeignKey, String, DefaultClause, func, Co...
184
5,976
lemur
lemur/pending_certificates/views.py
.py
""" .. module: lemur.pending_certificates.views :platform: Unix :license: Apache, see LICENSE for more details. .. moduleauthor:: James Chuong <jchuong@instartlogic.com> """ from flask import Blueprint, g, make_response, jsonify from flask_restful import Api, reqparse, inputs from lemur.auth.service import Aut...
568
19,027
lemur
lemur/pending_certificates/schemas.py
.py
from marshmallow import fields, validates_schema, post_load from marshmallow.exceptions import ValidationError from lemur.authorities.schemas import AuthorityNestedOutputSchema from lemur.certificates.schemas import CertificateNestedOutputSchema from lemur.common import utils, validators from lemur.common.schema impor...
142
5,259
lemur
lemur/pending_certificates/service.py
.py
""" .. module: lemur.pending_certificates.service Copyright (c) 2018 and onwards Netflix, Inc. All rights reserved. .. moduleauthor:: James Chuong <jchuong@instartlogic.com> """ import arrow from flask import current_app from sqlalchemy import or_, cast, Integer from lemur import database from lemur.authorities i...
320
11,578
lemur
lemur/pending_certificates/cli.py
.py
""" .. module: lemur.pending_certificates.cli .. moduleauthor:: James Chuong <jchuong@instartlogic.com> .. moduleauthor:: Curtis Castrapel <ccastrapel@netflix.com> """ import copy import sys import click from flask import current_app from flask.cli import with_appcontext from lemur.authorities.service import get as...
151
5,344
lemur
lemur/certificates/utils.py
.py
""" Utils to parse certificate data. .. module: lemur.certificates.hooks :platform: Unix :copyright: (c) 2019 by Javier Ramos, see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Javier Ramos <javier.ramos@booking.com> """ from cryptography import x509 from cryptography...
88
2,716
lemur
lemur/certificates/models.py
.py
""" .. module: lemur.certificates.models :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from datetime import timedelta import arrow from cryptography import x509 from flask...
517
16,581
lemur
lemur/certificates/hooks.py
.py
""" Debugging hooks for dumping imported or generated CSR and certificate details to stdout via OpenSSL. .. module: lemur.certificates.hooks :platform: Unix :copyright: (c) 2018 by Marti Raudsepp, see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Marti Raudsepp <marti@...
48
1,383
lemur
lemur/certificates/verify.py
.py
""" .. module: lemur.certificates.verify :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import ipaddress import requests import socket import subprocess from collections imp...
310
11,005
lemur
lemur/certificates/views.py
.py
""" .. module: lemur.certificates.views :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import base64 from flask import Blueprint, make_response, jsonify, g, current_app fro...
1,972
72,562
lemur
lemur/certificates/schemas.py
.py
""" .. module: lemur.certificates.schemas :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import current_app from flask_restful import inputs from flask_restful.re...
504
19,161
lemur
lemur/certificates/service.py
.py
""" .. module: lemur.certificate.service :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import re import time from collections import defaultdict from itertools import group...
1,488
54,159
lemur
lemur/certificates/cli.py
.py
""" .. module: lemur.certificate.cli :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import sys from time import sleep import arrow import click from flask import current_ap...
1,347
49,999
lemur
lemur/notifications/models.py
.py
""" .. module: lemur.notifications.models :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from sqlalchemy.orm import relationship from sqlalchemy import Integer, String, Colu...
49
1,466
lemur
lemur/notifications/views.py
.py
""" .. module: lemur.notifications.views :platform: Unix :synopsis: This module contains all of the accounts view code. :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import ...
483
16,937
lemur
lemur/notifications/schemas.py
.py
""" .. module: lemur.notifications.schemas :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from marshmallow import fields, post_dump from lemur.common.schema import LemurInp...
57
1,845
lemur
lemur/notifications/service.py
.py
""" .. module: lemur.notifications.service :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from flask import current_app from lemur import database from lemur.constants i...
200
5,679
lemur
lemur/notifications/messaging.py
.py
""" .. module: lemur.notifications.messaging :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import sys from collections import defaultdict from datetime import timedelta ...
541
21,780
lemur
lemur/notifications/cli.py
.py
""" .. module: lemur.notifications.cli :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import click from flask import current_app from flask.cli import with_appcontext from s...
147
5,223
lemur
lemur/api_keys/models.py
.py
""" .. module: lemur.api_keys.models :platform: Unix :synopsis: This module contains all of the models need to create an api key within Lemur. :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Eric Coan <kungfury@instructure.com>...
32
1,071
lemur
lemur/api_keys/views.py
.py
""" .. module: lemur.api_keys.views :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Eric Coan <kungfury@instructure.com> """ from datetime import datetime from flask import Blueprint, g from flask_restful import ...
626
17,609