con un clic
network-traffic-annotations
// Guide for writing and managing Network Traffic Annotations in Chromium. Use this skill when adding or updating code that makes network requests.
// Guide for writing and managing Network Traffic Annotations in Chromium. Use this skill when adding or updating code that makes network requests.
Add missing LINT.IfChange(...) / LINT.ThenChange(...) guards to enums in C++/Java and XML to keep them in sync. Trigger this skill ONLY when a contributor explicitly asks to add lint guards or synchronize enums using LINT guards.
Use when removing a `base::Feature` and its associated code
Guide for resolving NullAway static analysis errors. Best practices for: - Passing ObservableSupplier/Supplier<@Nullable T> - Dereferencing potentially @Nullable values - Adding @NullMarked to Java code
Identify and safely remove expired Chromium histograms (dead metrics/technical debt). Use this skill when a contributor asks to clean up metrics, fix code health issues related to histograms, remove obsolete code, or work on a histogram cleanup task.
Orchestrator for the "Code Health Hub" framework. Trigger only when the user refers to the Hub or asks to see "available cleanup tasks" within the Chromium technical debt reduction system.
How to identify and fix Java memory leaks in Android Chrome using LeakCanary traces.
| name | network-traffic-annotations |
| description | Guide for writing and managing Network Traffic Annotations in Chromium. Use this skill when adding or updating code that makes network requests. |
Network traffic annotations provide transparency into Chrome’s network communication by documenting the intent, payload, and control mechanisms of each network request.
Add annotations at the most rational point of origin for a request. This is typically where:
When adding a network annotation, you MUST follow these steps in sequence:
auditor.py scriptEach annotation is defined using
net::DefineNetworkTrafficAnnotation("unique_id", R"(...)"). The second
argument is a text-encoded NetworkTrafficAnnotation protobuffer, as defined in
chrome/browser/privacy/traffic_annotation.proto.
To determine the annotation's contents, start by reading the source code of the file the annotation is in. If you need more information, or you are unsure what to enter for a particular field, you MUST ask the user for more information before proceeding.
chrome/browser/privacy/traffic_annotation.proto).GOOGLE_OWNED_SERVICE for Google endpointsWEBSITE for a website the user is visitingOTHER for any other endpoint
OTHER, explain it in the destination_other string field.contacts is a
repeated field.YYYY-MM-DD format. Use today's
date, e.g. using the date command.YES or NO.subProto1 { ... } so auditor.py can parse them. You can find
policy definitions in components/policy/resources/templates/policies.yaml
and components/policy/resources/templates/policy_definitions/.The traffic annotation MUST contain either chrome_policy or
policy_exception_justification, but not both.
constexpr net::NetworkTrafficAnnotationTag traffic_annotation =
net::DefineNetworkTrafficAnnotation("...", R"(
semantics {
sender: "..."
description: "..."
trigger: "..."
destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER
data: "..."
user_data {
type: ...
}
last_reviewed: "YYYY-MM-DD"
internal {
contacts {
email: "..."
}
contacts {
email: "..."
}
}
}
policy {
cookies_allowed: NO/YES
setting: "..."
chrome_policy {
[POLICY_NAME] {
[POLICY_NAME]: ...
}
}
policy_exception_justification: "..."
}
)");
After adding or updating an annotation, you MUST verify it using the
auditor.py script. Explain to the user what you're about to do, and why you're
doing it.
You MUST ask the user which directory to use as the build path before proceeding.
Ensure you have a fresh build of the chrome target. For instance with
autoninja -C out/<build_path> chrome, replacing out/<build_path> with the
build path.
Use the same build_path where you just built chrome.
vpython3 tools/traffic_annotation/scripts/auditor/auditor.py --build-path=out/<build_path>
The auditor.py script cannot run under these conditions. If any of these
conditions are true, auditor.py will fail with an explanation of why. If any
of these are tru, you MUST abort immediately and inform the user:
If you abort, the user has two options:
auditor.py locally.Inform the user of their options, and don't do anything else.
The auditor will inform you if you need to update
tools/traffic_annotation/summary/annotations.xml or grouping.xml.
For new annotations, auditor.py creates an entry in annotations.xml. The
entry is populated with a "default" list of target platforms, which may or may
not be accurate.
<item id="..." ... os_list="linux,windows,android,chromeos" ... />
Update os_list to match the actual list of target platforms. It should be
based on BUILD.gn files; or, if you can't figure it out from BUILD.gn files, ask
the user directly.
The only valid platforms for os_list are:
macOS and iOS are not a valid platforms in this context. If the user mentions macOS or iOS, just ignore it.