<commit_before>#!/bin/bash

# Copyright 2021 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

# Visit a URL on the vuln worker.

set -e

source devtools/lib.sh || { echo "Are you at repo root?"; exit 1; }

env=$1
path=$2

case $env in
  dev)
    svc_acct=<EMAIL>
    oauth_client_id=55665122702-tk2rogkaalgru7pqibvbltqs7geev8j5.apps.googleusercontent.com
    url=https://dev-vuln-worker-ku6ias4ydq-uc.a.run.app
    ;;
  prod)
    svc_acct=<EMAIL>
    oauth_client_id=117187402928-nl3u0qo5l2c2hhsuf2qj8irsfb3l6hfc.apps.googleusercontent.com
    url=TDB
    ;;
  *) die "usage: $0 (dev | prod)"
esac

tok=$(gcloud --impersonate-service-account $svc_acct auth print-identity-token --audiences $oauth_client_id  --include-email)

curl -H "Authorization: Bearer $tok" $url/$path
<commit_msg>devtools: do POST for update<commit_after>#!/bin/bash

# Copyright 2021 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

# Visit a URL on the vuln worker.

set -e

source devtools/lib.sh || { echo "Are you at repo root?"; exit 1; }

env=$1
path=$2

case $env in
  dev)
    svc_acct=<EMAIL>
    oauth_client_id=55665122702-tk2rogkaalgru7pqibvbltqs7geev8j5.apps.googleusercontent.com
    url=https://dev-vuln-worker-ku6ias4ydq-uc.a.run.app
    ;;
  prod)
    svc_acct=impersonate-for-iap@go-discovery.iam.gserviceaccount.com
    oauth_client_id=117187402928-nl3u0qo5l2c2hhsuf2qj8irsfb3l6hfc.apps.googleusercontent.com
    url=TDB
    ;;
  *) die "usage: $0 (dev | prod)"
esac

tok=$(gcloud --impersonate-service-account $svc_acct auth print-identity-token --audiences $oauth_client_id  --include-email)

if [[ $path = update* ]]; then
  args="-X POST"
fi

curl $args -i -H "Authorization: Bearer $tok" $url/$path

{'fraction_non_alphanumeric': 0.11814795103778605, 'fraction_numerical': 0.050026609898882385, 'mean_word_length': 3.8958333333333335, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6576599', 'n_tokens_mistral': 795, 'n_tokens_neox': 745, 'n_words': 173}