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 MixedContentType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
A description of mixed content (HTTP resources on HTTPS pages), as defined by https://www.w3.org/TR/mixed-content/#categories
- BLOCKABLE = 'blockable'#
- OPTIONALLY_BLOCKABLE = 'optionally-blockable'#
- NONE = 'none'#
- class SecurityState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
The security level of a page or resource.
- UNKNOWN = 'unknown'#
- NEUTRAL = 'neutral'#
- INSECURE = 'insecure'#
- SECURE = 'secure'#
- INFO = 'info'#
- INSECURE_BROKEN = 'insecure-broken'#
- class CertificateSecurityState(protocol, key_exchange, cipher, certificate, subject_name, issuer, valid_from, valid_to, certificate_has_weak_signature, certificate_has_sha1_signature, modern_ssl, obsolete_ssl_protocol, obsolete_ssl_key_exchange, obsolete_ssl_cipher, obsolete_ssl_signature, key_exchange_group=None, mac=None, certificate_network_error=None)[source]#
Details about the security state of the page certificate.
-
valid_from:
TimeSinceEpoch# Certificate valid from date.
-
valid_to:
TimeSinceEpoch# Certificate valid to (expiration) date
-
valid_from:
- class SafetyTipStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
- BAD_REPUTATION = 'badReputation'#
- LOOKALIKE = 'lookalike'#
- class SafetyTipInfo(safety_tip_status, safe_url=None)[source]#
-
safety_tip_status:
SafetyTipStatus# Describes whether the page triggers any safety tips or reputation warnings. Default is unknown.
-
safety_tip_status:
- class VisibleSecurityState(security_state, security_state_issue_ids, certificate_security_state=None, safety_tip_info=None)[source]#
Security state information about the page.
-
security_state:
SecurityState# The security level of the page.
-
certificate_security_state:
Optional[CertificateSecurityState] = None# Security state details about the page certificate.
-
safety_tip_info:
Optional[SafetyTipInfo] = None# The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown.
-
security_state:
- class SecurityStateExplanation(security_state, title, summary, description, mixed_content_type, certificate, recommendations=None)[source]#
An explanation of an factor contributing to the security state.
-
security_state:
SecurityState# Security state representing the severity of the factor being explained.
-
mixed_content_type:
MixedContentType# The type of mixed content described by the explanation.
-
security_state:
- class 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)[source]#
Information about insecure content on the page.
-
ran_insecure_content_style:
SecurityState# Always set to unknown.
-
displayed_insecure_content_style:
SecurityState# Always set to unknown.
-
ran_insecure_content_style:
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.
- handle_certificate_error(event_id, action)[source]#
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.
- Return type:
Deprecated since version 1.3.
- set_ignore_certificate_errors(ignore)[source]#
Enable/disable whether all certificate errors should be ignored.
- set_override_certificate_errors(override)[source]#
Enable/disable overriding certificate errors. If enabled, all certificate error events need to be handled by the DevTools client and should be answered with
handleCertificateErrorcommands.Deprecated since version 1.3.
- Parameters:
override (
bool) – If true, certificate errors will be overridden.- Return type:
Deprecated since version 1.3.
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 CertificateError(event_id, error_type, request_url)[source]#
There is a certificate error. If overriding certificate errors is enabled, then it should be handled with the
handleCertificateErrorcommand. 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.
- class VisibleSecurityStateChanged(visible_security_state)[source]#
EXPERIMENTAL
The security state of the page changed.
-
visible_security_state:
VisibleSecurityState# Security state information about the page.
-
visible_security_state:
- class SecurityStateChanged(security_state, scheme_is_cryptographic, explanations, insecure_content_status, summary)[source]#
The security state of the page changed. No longer being sent.
Deprecated since version 1.3.
-
security_state:
SecurityState# Security state.
-
scheme_is_cryptographic:
bool# True if the page was loaded over cryptographic transport such as HTTPS.
-
explanations:
List[SecurityStateExplanation]# Previously a list of explanations for the security state. Now always empty.
-
insecure_content_status:
InsecureContentStatus# Information about insecure content on the page.
-
security_state: