def validate_config_against_schema(
    config_schema, config_object, config_path, pack_name=None
):
    """
    Validate provided config dictionary against the provided config schema
    dictionary.
    """
    # NOTE: Lazy improt to avoid performance overhead of importing this module when it's not used
    import jsonschema

    pack_name = pack_name or "unknown"

    schema = util_schema.get_schema_for_resource_parameters(
        parameters_schema=config_schema, allow_additional_properties=True
    )
    instance = config_object

    try:
        cleaned = util_schema.validate(
            instance=instance,
            schema=schema,
            cls=util_schema.CustomValidator,
            use_default=True,
            allow_default_none=True,
        )
        for key in cleaned:
            if (
                jinja_utils.is_jinja_expression(value=cleaned.get(key))
                and "decrypt_kv" in cleaned.get(key)
                and config_schema.get(key).get("secret")
            ):
                raise ValueValidationException(
                    'Values specified as "secret: True" in config '
                    "schema are automatically decrypted by default. Use "
                    'of "decrypt_kv" jinja filter is not allowed for '
                    "such values. Please check the specified values in "
                    "the config or the default values in the schema."
                )
    except jsonschema.ValidationError as e:
        attribute = getattr(e, "path", [])

        if isinstance(attribute, (tuple, list, Iterable)):
            attribute = [str(item) for item in attribute]
            attribute = ".".join(attribute)
        else:
            attribute = str(attribute)

        msg = 'Failed validating attribute "%s" in config for pack "%s" (%s): %s' % (
            attribute,
            pack_name,
            config_path,
            six.text_type(e),
        )
        raise jsonschema.ValidationError(msg)

    return cleaned

    Validate provided config dictionary against the provided config schema
    dictionary.
    
st2common/st2common/util/pack.py