Security¶
Security
Types¶
Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.
-
class
cdp.security.
CertificateId
¶ An internal certificate ID value.
-
class
cdp.security.
MixedContentType
¶ A description of mixed content (HTTP resources on HTTPS pages), as defined by https://www.w3.org/TR/mixed-content/#categories
-
BLOCKABLE
= 'blockable'¶
-
NONE
= 'none'¶
-
OPTIONALLY_BLOCKABLE
= 'optionally-blockable'¶
-
-
class
cdp.security.
SecurityState
¶ The security level of a page or resource.
-
INFO
= 'info'¶
-
INSECURE
= 'insecure'¶
-
NEUTRAL
= 'neutral'¶
-
SECURE
= 'secure'¶
-
UNKNOWN
= 'unknown'¶
-
-
class
cdp.security.
SecurityStateExplanation
(security_state, title, summary, description, mixed_content_type, certificate, recommendations=None)¶ An explanation of an factor contributing to the security state.
-
certificate
= None¶ Page certificate.
-
description
= None¶ Full text explanation of the factor.
-
mixed_content_type
= None¶ The type of mixed content described by the explanation.
-
recommendations
= None¶ Recommendations to fix any issues.
-
security_state
= None¶ Security state representing the severity of the factor being explained.
-
summary
= None¶ Short phrase describing the type of factor.
-
title
= None¶ Title describing the type of factor.
-
-
class
cdp.security.
InsecureContentStatus
(ran_mixed_content, displayed_mixed_content, contained_mixed_form, ran_content_with_cert_errors, displayed_content_with_cert_errors, ran_insecure_content_style, displayed_insecure_content_style)¶ Information about insecure content on the page.
-
contained_mixed_form
= None¶ Always false.
-
displayed_content_with_cert_errors
= None¶ Always false.
-
displayed_insecure_content_style
= None¶ Always set to unknown.
-
displayed_mixed_content
= None¶ Always false.
-
ran_content_with_cert_errors
= None¶ Always false.
-
ran_insecure_content_style
= None¶ Always set to unknown.
-
ran_mixed_content
= None¶ Always false.
-
Commands¶
Each command is a generator function. The return
type Generator[x, y, z]
indicates that the generator
yields arguments of type x
, it must be resumed with
an argument of type y
, and it returns type z
. In
this library, types x
and y
are the same for all
commands, and z
is the return type you should pay attention
to. For more information, see
Getting Started: Commands.
-
cdp.security.
disable
()¶ Disables tracking security state changes.
Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
-
cdp.security.
enable
()¶ Enables tracking security state changes.
Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
-
cdp.security.
handle_certificate_error
(event_id, action)¶ Handles a certificate error that fired a certificateError event.
Deprecated since version 1.3.
Parameters: - event_id (
int
) – The ID of the event. - action (
CertificateErrorAction
) – The action to take on the certificate error.
Deprecated since version 1.3.
Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]- event_id (
-
cdp.security.
set_ignore_certificate_errors
(ignore)¶ Enable/disable whether all certificate errors should be ignored.
EXPERIMENTAL
Parameters: ignore ( bool
) – If true, all certificate errors will be ignored.Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
-
cdp.security.
set_override_certificate_errors
(override)¶ Enable/disable overriding certificate errors. If enabled, all certificate error events need to be handled by the DevTools client and should be answered with
handleCertificateError
commands.Deprecated since version 1.3.
Parameters: override ( bool
) – If true, certificate errors will be overridden.Deprecated since version 1.3.
Return type: Generator
[Dict
[str
,Any
],Dict
[str
,Any
],None
]
Events¶
Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.
-
class
cdp.security.
CertificateError
(event_id, error_type, request_url)¶ There is a certificate error. If overriding certificate errors is enabled, then it should be handled with the
handleCertificateError
command. Note: this event does not fire if the certificate error has been allowed internally. Only one client per target should override certificate errors at the same time.Deprecated since version 1.3.
-
error_type
= None¶ The type of the error.
-
event_id
= None¶ The ID of the event.
-
request_url
= None¶ The url that was requested.
-
-
class
cdp.security.
SecurityStateChanged
(security_state, scheme_is_cryptographic, explanations, insecure_content_status, summary)¶ The security state of the page changed.
-
explanations
= None¶ List of explanations for the security state. If the overall security state is
insecure
orwarning
, at least one corresponding explanation should be included.
-
insecure_content_status
= None¶ Information about insecure content on the page.
-
scheme_is_cryptographic
= None¶ True if the page was loaded over cryptographic transport such as HTTPS.
-
security_state
= None¶ Security state.
-
summary
= None¶ Overrides user-visible description of the state.
-