Skip to content

Commit

Permalink
Merge pull request #13 from privacysandbox/hsuri
Browse files Browse the repository at this point in the history
Updating README
  • Loading branch information
suriheemanshu authored Jul 11, 2024
2 parents 1ea53f2 + efaeadd commit b8289c5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 62 deletions.
16 changes: 10 additions & 6 deletions header-validation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

The Attribution Reporting Header Validation tool validates the header responses related to Attribution Reporting API. This document shows how to set up and run the tool.

## Setup

```sh
npm install && npm run build && npm run test
```

Interactive form is deployed at: https://privacysandbox.github.io/measurement-simulation/validate-headers

Select the type of response you want to validate:
Expand All @@ -16,6 +10,16 @@ Select the type of response you want to validate:

`Validation Result` section shows any errors or warnings if your data is invalid.

## Local Setup

Run the following command from the `header-validation` sub-directory:

```sh
npm install && npm run build && npm run test
```

Ensure that the above command runs successfully. Now, open `validate-headers.html` on your web browser and you should be able to validate your header spec locally.

## Feedback

If you have any feedback while using the Header Validation tool, please
Expand Down
54 changes: 14 additions & 40 deletions header-validation/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@ const {validateTrigger} = require('./validate_trigger');
const validationForm = document.getElementById('validation-form');
const inputTextbox = document.getElementById('input-text');
const headerOptions = validationForm.elements.namedItem('header');
const featureLookbackWindowFilter = validationForm.elements.namedItem('feature-lookback-window-filter');
const featureTriggerDataMatching = validationForm.elements.namedItem('feature-trigger-data-matching');
const featureCoarseEventReportDestinations = validationForm.elements.namedItem('feature-coarse-event-report-destination');
const featureSharedSourceDebugKey = validationForm.elements.namedItem('feature-shared-source-debug-key');
const featureXNA = validationForm.elements.namedItem('feature-xna');
const featureSharedFilterDataKeys = validationForm.elements.namedItem('feature-shared-filter-data-keys');
const featurePreinstallCheck = validationForm.elements.namedItem('feature-preinstall-check');
const featureAttributionScopes = validationForm.elements.namedItem('feature-attribution-scopes');
const featureAggregationCoordinatorOrigin = validationForm.elements.namedItem('feature-aggregation-coordinator-origin');
const featureSourceRegistrationTimeOptionalForAggReports = validationForm.elements.namedItem('feature-source-registration-time-optional-for-agg-reports');
const featureTriggerContextId = validationForm.elements.namedItem('feature-trigger-context-id');
const featureEnableUpdateTriggerHeaderLimit = validationForm.elements.namedItem('feature-enable-update-trigger-header-limit');
const featureEnableReinstallReattribution = validationForm.elements.namedItem('feature-enable-reinstall-reattribution');
const copyButton = document.getElementById('linkify');
const errorList = document.getElementById('errors');
const warningList = document.getElementById('warnings');
Expand All @@ -35,19 +22,6 @@ async function copyLink() {
url.search = '';
url.searchParams.set('header', headerOptions.value);
url.searchParams.set('json', inputTextbox.value);
url.searchParams.set('feature-lookback-window-filter', featureLookbackWindowFilter.checked.toString());
url.searchParams.set('feature-trigger-data-matching', featureTriggerDataMatching.checked.toString());
url.searchParams.set('feature-coarse-event-report-destination', featureCoarseEventReportDestinations.checked.toString());
url.searchParams.set('feature-shared-source-debug-key', featureSharedSourceDebugKey.checked.toString());
url.searchParams.set('feature-xna', featureXNA.checked.toString());
url.searchParams.set('feature-shared-filter-data-keys', featureSharedFilterDataKeys.checked.toString());
url.searchParams.set('feature-preinstall-check', featurePreinstallCheck.checked.toString());
url.searchParams.set('feature-attribution-scopes', featureAttributionScopes.checked.toString());
url.searchParams.set('feature-aggregation-coordinator-origin', featureAggregationCoordinatorOrigin.checked.toString());
url.searchParams.set('feature-source-registration-time-optional-for-agg-reports', featureSourceRegistrationTimeOptionalForAggReports.checked.toString());
url.searchParams.set('feature-trigger-context-id', featureTriggerContextId.checked.toString());
url.searchParams.set('feature-enable-update-trigger-header-limit', featureEnableUpdateTriggerHeaderLimit.checked.toString());
url.searchParams.set('feature-enable-reinstall-reattribution', featureEnableReinstallReattribution.checked.toString());
await navigator.clipboard.writeText(url.toString());
}

Expand All @@ -67,19 +41,19 @@ function populateUIList(element, items) {
function validate() {
// Fetch Flag Values
let flagValues = {};
flagValues['feature-lookback-window-filter'] = featureLookbackWindowFilter.checked;
flagValues['feature-trigger-data-matching'] = featureTriggerDataMatching.checked;
flagValues['feature-coarse-event-report-destination'] = featureCoarseEventReportDestinations.checked;
flagValues['feature-shared-source-debug-key'] = featureSharedSourceDebugKey.checked;
flagValues['feature-xna'] = featureXNA.checked;
flagValues['feature-shared-filter-data-keys'] = featureSharedFilterDataKeys.checked;
flagValues['feature-preinstall-check'] = featurePreinstallCheck.checked;
flagValues['feature-attribution-scopes'] = featureAttributionScopes.checked;
flagValues['feature-aggregation-coordinator-origin'] = featureAggregationCoordinatorOrigin.checked;
flagValues['feature-source-registration-time-optional-for-agg-reports'] = featureSourceRegistrationTimeOptionalForAggReports.checked;
flagValues['feature-trigger-context-id'] = featureTriggerContextId.checked;
flagValues['feature-enable-update-trigger-header-limit'] = featureEnableUpdateTriggerHeaderLimit.checked;
flagValues['feature-enable-reinstall-reattribution'] = featureEnableReinstallReattribution.checked;
flagValues['feature-lookback-window-filter'] = true;
flagValues['feature-trigger-data-matching'] = true;
flagValues['feature-coarse-event-report-destination'] = true;
flagValues['feature-shared-source-debug-key'] = true;
flagValues['feature-xna'] = true;
flagValues['feature-shared-filter-data-keys'] = true;
flagValues['feature-preinstall-check'] = true;
flagValues['feature-attribution-scopes'] = false;
flagValues['feature-aggregation-coordinator-origin'] = true;
flagValues['feature-source-registration-time-optional-for-agg-reports'] = false;
flagValues['feature-trigger-context-id'] = false
flagValues['feature-enable-update-trigger-header-limit'] = false;
flagValues['feature-enable-reinstall-reattribution'] = true;
flagValues['max_attribution_filters'] = 50;
flagValues['max_bytes_per_attribution_filter_string'] = 25;
flagValues['max_values_per_attribution_filter'] = 50;
Expand All @@ -97,7 +71,7 @@ function validate() {
flagValues["max_report_states_per_source_registration"] = (1n << 32n) - 1n;
flagValues["max_trigger_context_id_string_length"] = 64;
flagValues["max_bucket_threshold"] = (1n << 32n) - 1n;
flagValues["max_filter_maps_per_filter_set"] = 5;
flagValues["max_filter_maps_per_filter_set"] = 20;
flagValues["max_aggregate_keys_per_trigger_registration"] = 50;
flagValues["max_sum_of_aggregate_values_per_source"] = 65536;
flagValues["max_aggregate_deduplication_keys_per_registration"] = 50;
Expand Down
17 changes: 1 addition & 16 deletions header-validation/validate-headers.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,6 @@ <h1>Attribution Reporting Header Validation</h1>
<!--Header Type-->
<p><label><input type=radio name=header value=source checked><code>Attribution-Reporting-Register-Source</code></label>
<p><label><input type=radio name=header value=trigger><code>Attribution-Reporting-Register-Trigger</code></label>
<!--Additional Feature Selection-->
<p>Flags
<p><label><input type=checkbox name=feature-lookback-window-filter>Measurement Enable Lookback Window Filter</label>
<p><label><input type=checkbox name=feature-trigger-data-matching checked>Measurement Enable Trigger Data Matching</label>
<p><label><input type=checkbox name=feature-coarse-event-report-destination checked>Measurement Coarse Event Report Destination</label>
<p><label><input type=checkbox name=feature-shared-source-debug-key checked>Measurement Enable Shared Source Debug Key</label>
<p><label><input type=checkbox name=feature-xna>Measurement Enable XNA</label>
<p><label><input type=checkbox name=feature-shared-filter-data-keys checked>Measurement Enable Shared Filter Data Keys (XNA)</label>
<p><label><input type=checkbox name=feature-preinstall-check>Measurement Enable Preinstall Check</label>
<p><label><input type=checkbox name=feature-attribution-scopes>Measurement Enable Attribution Scopes</label>
<p><label><input type=checkbox name=feature-aggregation-coordinator-origin checked>Measurement Aggregation Coordinator Origin</label>
<p><label><input type=checkbox name=feature-source-registration-time-optional-for-agg-reports>Measurement Source Registration Time Optional For Aggregate Reports</label>
<p><label><input type=checkbox name=feature-trigger-context-id>Measurement Enable Trigger Context Id</label>
<p><label><input type=checkbox name=feature-enable-update-trigger-header-limit>Measurement Enable Update Trigger Header Limit</label>
<p><label><input type=checkbox name=feature-enable-reinstall-reattribution>Measurement Enable Reinstall Reattribution</label>
</fieldset>

<!--Output Results-->
Expand All @@ -61,4 +46,4 @@ <h1>Attribution Reporting Header Validation</h1>

<!--Load Webpage Script-->
<script src="./dist/main.js"></script>
</body>
</body>

0 comments on commit b8289c5

Please sign in to comment.