Commit graph

19 commits

Author SHA1 Message Date
gbrodman
2b12ca42f5 Use the registrar client ID and abuse email address in Spec11
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=244899045
2019-04-26 23:45:07 -04:00
gbrodman
9f979790e4 Use stream-collect rather than transformValues in Spec11 collection
As it turns out, using Maps::transformValues does not allow us to change the
resulting map--calling Map::put throws an UnsupportedOperationException. As a
result, we have to do this roundabout stream-collect to do a group-by.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=244852373
2019-04-26 23:41:55 -04:00
gbrodman
565c4bcf50 Use a multimap to index the Spec11 threat matches
Collecting by key leads to exceptions if there are multiple client IDs with the
same email address (if we group by client ID in the pipeline). Using
Multimaps::index means that if we're grouping by email, all matches with the
same email get concatenated together

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=242858112
2019-04-11 14:58:08 -04:00
gbrodman
d16f3ae590 Continue Spec11 emails even if one fails
One failure should not stop the rest from sending.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=241760092
2019-04-05 11:44:49 -04:00
gbrodman
c174c86437 Skip emailing registrars with a null or empty email address
Obviously this is a bad thing and would fail if it ever happened. If this does occur, we will send a warning email.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=240977242
2019-03-29 16:20:47 -04:00
shicong
bc3bdc7347 Upgrade the version of google/errorprone plug-in
This CL upgraded google/errorprone plug-in to 2.3.3 and resolved
some warnings detected from the plug-in.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=238047862
2019-03-20 14:25:28 -04:00
gbrodman
50e0a9b532 Refactor common email sending utility
The main thrust of this is to create a common POJO that contains email content in a simple way, then have one class that converts that to an email and sends it. Any class that uses email should only have to deal with creating that POJO.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=237883643
2019-03-20 14:25:28 -04:00
guyben
927e8bbd73 Move LocalDate injection to the Actions themselves
We want to make it clear what query (or POST) inputs the user needs to / can give for each Action. That means moving all the @Injects of these parameters to the Actions themselves instead of injecting them in "hidden" indirect dependencies.

This has the extra benefit of allowing these indirect dependencies to work for JSON Actions as well, since the "regular" way we @Inject parameters can corrupt the POST JSON data.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=232540758
2019-02-06 17:52:16 -05:00
gbrodman
6e0b8f2cfd Pass the date field in to the Spec11 Soy template
The daily template is the only one that needs it but we can always pass it in without issue.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=231295089
2019-01-31 13:57:30 -05:00
guyben
a4f85c33c0 Add the App Engine service used in the Action definition
Our goal is to be able to address every Action by looking at the class itself, and to make it clearer at a glance what you need to access the Action's endpoint

Currently, we can know from the @Action annotation:
- the endpoint path
- the Method needed
- the authentication level needed

This CL adds the service where the Action is hosted, which also translates to the URL.

NOTE - currently we don't have any Action hosted on multiple services. I don't think we will ever need it (since they do the same thing no matter which service they are on, so why host it twice?), but if we do we'll have to update the code to allow it.

The next step after this is to make sure all the @Parameters are defined on the Action itself, and then we will be able to craft access to the endpoint programatically (or at least verify at run-time we crafted a correct URL)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=229375735
2019-01-17 18:59:16 -05:00
gbrodman
f017798162 Add diff logic and send daily Spec11 emails with new threats
For each registrar, the daily email will only include threats that did not appear
in the prior run's email.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=228889972
2019-01-14 16:20:04 -05:00
jianglai
ea154a8378 Refactor threat emails for daily+monthly usage
Eventually the Publish action will control daily/monthly sending and provide
the correct threats to email. The goal of this PR is to entirely separate
the "sending email" functionality from the "parsing threat matches"
functionality.

The PublishAction will figure out if the monthly emails should be sent out,
then will ask the Spec11ThreatMatchesParser for the monthly threats (if
appropriate) and the new threat matches for today. It will then pass those
matches and the appropriate email subject+body to the email utils class,
whose only job is to format and send the emails.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224869643
2018-12-12 13:22:34 -05:00
jianglai
305b1edc85 Switch all added usages of java.time to be joda.time
This is for consistency, mostly the LocalDate fields added in []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224525451
2018-12-12 13:22:34 -05:00
jianglai
ec26e3a96a Run the Spec11 pipeline daily without sending emails
Add a sendSpec11Email parameter that allows us to only send the email on
one run per month. Next, we will compute the diffs between the daily runs
and send daily emails with those diffs.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224404653
2018-12-12 13:22:34 -05:00
mcilwain
f59005ad35 Fix sender email address for invoicing alerts
It was failing to send alert emails because the email address it was
constructing did not have permission through GAE to send emails. This switches
it over to using the send from email address already in use elsewhere in the app
that does successfully send emails.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219812019
2018-11-02 14:50:52 -04:00
jianglai
476759e861 Update Spec 11 emails body and add a bcc address.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217150650
2018-10-17 11:51:28 -04:00
larryruili
f36c72cca0 Deploy spec11 reporting to production
This turns on spec11 reporting in production by adding it to the cron.xml, generating the report and sending an e-mail with a list of all problematic registrations to the associated registrar on the 2nd of each month at 15:00Z (11am EST)

This also tweaks the e-mail template a bit according to suggestions from Bruno.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213031440
2018-09-14 21:31:34 -04:00
larryruili
c5e6eae555 Add Spec11 registrar emailing mechanism
This adds the terminal step of the Spec11 pipeline- processing the output of
the Beam pipeline to send an e-mail to each registrar informing them of
identified 'bad urls.'

This also factors out methods common between invoicing (which uses similar beam pipeline tools) and spec11 to the common superpackage ReportingModule + ReportingUtils classes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=210932496
2018-09-08 00:06:53 -04:00
larryruili
33ee7de457 Add GenerateSpec11Action and SafeBrowsing evaluation
This adds actual subdomain verification via the SafeBrowsing API to the Spec11
pipeline, as well as on-the-fly KMS decryption via the GenerateSpec11Action to
securely store our API key in source code.

Testing the interaction becomes difficult due to serialization requirements, and will be significantly expanded in the next cl. For now, it verifies basic end-to-end pipeline behavior.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=208092942
2018-08-10 13:46:48 -04:00