Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reporting and report-only mode. #529

Merged
merged 7 commits into from Oct 13, 2023
Merged

Add reporting and report-only mode. #529

merged 7 commits into from Oct 13, 2023

Conversation

clelland
Copy link
Collaborator

@clelland clelland commented Sep 11, 2023

This is a fairly large change, which adds proper support for reporting and a report-only mode to Permissions Policy. Reporting can be configured for individual features, with a new "report-to" parameter on the header declarations.

The Permissions-Policy-Report-Only header allows a parallel policy to be constructed, which will generate warning reports (with a "Report" disposition) but which will not cause use of the feature to be blocked.


Preview | Diff

This is a fairly large change, which adds proper support for reporting
and a report-only mode to Permissions Policy. Reporting can be configured for
individual features, with a new "report-to" parameter on the header
declarations, or can be configured for all features, using a new "*"
pseudo-feature.

The Permissions-Policy-Report-Only header allows a parallel policy to be
constructed, which will gernerate warning reports (with a "Report" disposition)
but which will not cause use of the feature to be blocked.
Copy link
Member

@domfarolino domfarolino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't made it all the way through yet, but here's a little progress from yesterday's flight.

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@clelland
Copy link
Collaborator Author

clelland commented Oct 6, 2023

FYI, after talking with @arichiv, I've removed the special handling for the * pseudo-feature for now. We can look at adding it at a later date, or perhaps some different mechanism for setting the default endpoint.

9. Otherwise, for each <a>permissions-source-expression</a> |item| in |allowlist|'s <a>expressions</a>:
append the <a lt="serialization of an origin">serialization</a> of it to
|result|.
9. Otherwise, for each <a>permissions-source-expression</a> |item| in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be good to link to [=list/iterate|for each=] (I think that should work)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update all of those, and do a general cleanup pass, in another CL -- there are a lot of for-eaches in here.

index.bs Outdated Show resolved Hide resolved

1. Let |header name| be "<code>Permissions-Policy-Report-Only</code>" if
|report-only| is True, or "<code>Permissions-Policy</code>" otherwise.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lowercase T for "true". Same goes for "False" in other instances below. See https://infra.spec.whatwg.org/#booleans. If the spec does this elsewhere, we can maybe take care of this in a separate PR (or not at all, if you prefer, it isn't a big deal really, just a nit).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will address in a separate cleanup as well. Thanks!

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated
<section>
## <dfn export abstract-op id="report-permissions-policy-violation">Generate report for violation of permissions policy on settings</dfn> ## {#algo-report-permissions-policy-violation}

<div class="algorithm" data-algorithm="report-permissions-policy-violation">
Given a [=feature=] (|feature|), an <a>environment settings object</a>
(|settings|), and an optional string (|group|), this algorithm generates a
<a>report</a> about the <a>violation</a> of the policy for |feature|.
(|settings|), a String (|disposition|), and an optional string (|group|),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One problem here is that we always pass in group, its just sometimes it is the actual value null. In that case, I think we should either:

  • Adjust the callers to not pass it in at all if the string is null (thus taking advantage of the optionality here)
  • Adjust the algorithm to accept a "string-or-null" (commonly seen in HTML Standard) and react to the null case appropriately.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make it mandatory, and react to null; in earlier iterations of reporting, there was no way to configure the group, and so it was effectively always "default" (we actually never called it from this spec, the intention at the time was to call this from other specs instead, and maybe they would choose a different endpoint group).

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
@clelland clelland merged commit 3e1f10d into main Oct 13, 2023
2 checks passed
@clelland clelland deleted the reporting-bis branch October 13, 2023 03:55
github-actions bot added a commit that referenced this pull request Oct 13, 2023
SHA: 3e1f10d
Reason: push, by clelland

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This was referenced Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants