Skip to content

Commit 9967cf5

Browse files
committed
Merge
2 parents 052fade + da5ab38 commit 9967cf5

File tree

154 files changed

+2053
-413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+2053
-413
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ build/
1212
*.sum
1313

1414
# Ignore files built when the server is started
15+
/static/css/dartdoc.css
16+
/static/css/dartdoc.css.map
1517
/static/css/style.css
1618
/static/css/style.css.map
1719
/static/js/script.dart.js

CHANGELOG.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ AppEngine version, listed here to ease deployment and troubleshooting.
33

44
## Next Release (replace with git tag when deployed)
55
* Upgraded runtime Dart SDK to `3.5.0-196.0.dev`.
6+
* Upgraded runtimeVersion to `2024.06.11`
7+
8+
## `20240606t114600-all`
69
* Bumped runtimeVersion to `2024.05.30`.
710
* Upgraded pana to `0.22.5`.
811

@@ -110,7 +113,7 @@ AppEngine version, listed here to ease deployment and troubleshooting.
110113
* Upgraded stable Flutter analysis SDK to `3.16.9`.
111114
* Upgraded preview Dart analysis SDK to `3.3.0-279.3.beta`.
112115
* Upgraded preview Flutter analysis SDK to `3.19.0-0.4.pre`.
113-
* Note: started to populare audit log records with extended `agentId` for service accounts.
116+
* Note: started to populate audit log records with extended `agentId` for service accounts.
114117

115118
## `20240201t145300-all`
116119
* Note: temporarily disabled email notification on package published events.
@@ -197,7 +200,7 @@ AppEngine version, listed here to ease deployment and troubleshooting.
197200
* Upgraded pana to `0.21.40`.
198201

199202
## `20231019t115400-all`
200-
* Moved search index building and seach GC jobs into `analyzer` instance.
203+
* Moved search index building and search GC jobs into `analyzer` instance.
201204
* Increased memory on `analyzer` instances to 16G, running two of them.
202205

203206
## `20231018t131100-all`
@@ -252,7 +255,7 @@ AppEngine version, listed here to ease deployment and troubleshooting.
252255
* Upgraded runtime Dart SDK to `3.1.0`.
253256
* Upgraded dependencies.
254257
* Note: `DartdocRun`, `Job` and `ScoreCard` entities will be deleted in Datastore.
255-
* Note: `dartdoc` backend no longer deletes entries from `Configuraiton.dartdocStorageBucketName`.
258+
* Note: `dartdoc` backend no longer deletes entries from `Configuration.dartdocStorageBucketName`.
256259
TODO: delete the bucket after this release becomes obsolete.
257260

258261
## `20230822t112400-all`
@@ -325,7 +328,7 @@ AppEngine version, listed here to ease deployment and troubleshooting.
325328

326329
## `20230606t110900-all`
327330
* Bumped runtimeVersion to `2023.05.31`.
328-
* Note: Dart 3 compatiblity check uses the same SDK as the analysis.
331+
* Note: Dart 3 compatibility check uses the same SDK as the analysis.
329332

330333
## `20230531t083600-all`
331334
* Bumped runtimeVersion to `2023.05.30`.
@@ -1039,7 +1042,7 @@ AppEngine version, listed here to ease deployment and troubleshooting.
10391042
* NOTE: Expected reduction in Job-related API calls.
10401043

10411044
## `20210325t074600-all`
1042-
* Tempoarily disabled youtube integration.
1045+
* Temporarily disabled youtube integration.
10431046

10441047
## `20210324t155000-all`
10451048

@@ -1098,7 +1101,7 @@ AppEngine version, listed here to ease deployment and troubleshooting.
10981101
`delete-expired-consents`, `delete-expired-sessions`,
10991102
`delete-old-jobs`, `delete-old-scorecards`.
11001103
* Removed all usage of `app/static/js/gtag.js` it can be removed after a few
1101-
runtimeVerions when we are no-longer serving old generated dartdoc files.
1104+
runtimeVersions when we are no-longer serving old generated dartdoc files.
11021105

11031106
## `20210203t120700-all`
11041107

@@ -1608,5 +1611,5 @@ AppEngine version, listed here to ease deployment and troubleshooting.
16081611
## `20190306t115839-all`
16091612

16101613
* Run `app/bin/tools/backfill_packageversions.dart` to backfill `PubSpec`
1611-
entities in datastore (these entitites are not in use yet).
1614+
entities in datastore (these entities are not in use yet).
16121615
* Bumped runtimeVersion to `2019.03.05`.

app/lib/account/agent.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void checkAgentParam(String value) {
106106
/// * A user using the `pub` client.
107107
/// * A user using the `pub.dev` UI.
108108
/// * A GCP service account may authenticate using an OIDC `id_token`,
109-
/// * A Github Action may authenticate using an OIDC `id_token`.
109+
/// * A GitHub Action may authenticate using an OIDC `id_token`.
110110
abstract class AuthenticatedAgent {
111111
/// The unique identifier of the agent.
112112
/// Must pass the [looksLikeUserIdOrServiceAgent] check.
@@ -116,7 +116,7 @@ abstract class AuthenticatedAgent {
116116
/// * For automated publishing we use [KnownAgents] identifiers.
117117
String get agentId;
118118

119-
/// The formatted identfier of the agent, which may be publicly visible
119+
/// The formatted identifier of the agent, which may be publicly visible
120120
/// in logs and audit records.
121121
///
122122
/// Examples:
@@ -129,7 +129,7 @@ abstract class AuthenticatedAgent {
129129
String? get email;
130130
}
131131

132-
/// Holds the authenticated Github Action information.
132+
/// Holds the authenticated GitHub Action information.
133133
///
134134
/// The [agentId] has the following format: `service:github-actions:<repositoryOwnerId>/<repositoryId>`
135135
class AuthenticatedGithubAction implements AuthenticatedAgent {

app/lib/account/backend.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Future<AuthenticatedAgent?> _tryAuthenticateServiceAgent(String token) async {
162162
idToken.payload.aud.single !=
163163
activeConfiguration.externalServiceAudience) {
164164
throw AssertionError(
165-
'authProvider.tryAuthenticateAsServiceToken should not return a parsed token with audience missmatch.');
165+
'authProvider.tryAuthenticateAsServiceToken should not return a parsed token with audience mismatch.');
166166
}
167167

168168
if (idToken.payload.iss == GitHubJwtPayload.issuerUrl) {

app/lib/account/consent_backend.dart

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,13 @@ class ConsentBackend {
6060
InvalidInputException.checkUlid(consentId, 'consentId');
6161
final c = await _lookupAndCheck(consentId, user);
6262
final action = _actions[c.kind]!;
63-
final invitingUserEmail =
64-
(await accountBackend.getEmailOfUserId(c.fromUserId!))!;
63+
final fromAgent = c.fromAgent!;
64+
late String invitingUserEmail;
65+
if (looksLikeUserId(fromAgent)) {
66+
invitingUserEmail = (await accountBackend.getEmailOfUserId(fromAgent))!;
67+
} else {
68+
invitingUserEmail = fromAgent;
69+
}
6570
return api.Consent(
6671
titleText: action.renderInviteTitleText(invitingUserEmail, c.args!),
6772
descriptionHtml: action.renderInviteHtml(
@@ -106,7 +111,6 @@ class ConsentBackend {
106111
required String kind,
107112
required List<String> args,
108113
required AuditLogRecord auditLogRecord,
109-
required bool createdBySiteAdmin,
110114
}) async {
111115
return retry(() async {
112116
// First check for existing consents with identical dedupId.
@@ -138,7 +142,7 @@ class ConsentBackend {
138142
email: email,
139143
kind: kind,
140144
args: args,
141-
createdBySiteAdmin: createdBySiteAdmin,
145+
createdBySiteAdmin: activeAgent is SupportAgent,
142146
);
143147
await _db.commit(inserts: [
144148
consent,
@@ -154,7 +158,6 @@ class ConsentBackend {
154158
required User activeUser,
155159
required String packageName,
156160
required String uploaderEmail,
157-
bool createdBySiteAdmin = false,
158161
}) async {
159162
return await _invite(
160163
activeAgent: agent,
@@ -167,7 +170,6 @@ class ConsentBackend {
167170
package: packageName,
168171
uploaderEmail: uploaderEmail,
169172
),
170-
createdBySiteAdmin: createdBySiteAdmin,
171173
);
172174
}
173175

@@ -186,7 +188,6 @@ class ConsentBackend {
186188
args: [publisherId, contactEmail],
187189
auditLogRecord: await AuditLogRecord.publisherContactInvited(
188190
user: user, publisherId: publisherId, contactEmail: contactEmail),
189-
createdBySiteAdmin: false,
190191
);
191192
}
192193

@@ -196,7 +197,6 @@ class ConsentBackend {
196197
required User activeUser,
197198
required String publisherId,
198199
required String invitedUserEmail,
199-
bool createdBySiteAdmin = false,
200200
}) async {
201201
return await _invite(
202202
activeAgent: authenticatedAgent,
@@ -209,7 +209,6 @@ class ConsentBackend {
209209
publisherId: publisherId,
210210
memberEmail: invitedUserEmail,
211211
),
212-
createdBySiteAdmin: createdBySiteAdmin,
213212
);
214213
}
215214

@@ -330,19 +329,16 @@ class _PackageUploaderAction extends ConsentAction {
330329
Future<void> onAccept(Consent consent) async {
331330
final packageName = consent.args![0];
332331
final createdBySiteAdmin = consent.createdBySiteAdmin ?? false;
333-
final fromUserId = consent.fromUserId!;
334-
final fromUserEmail = (await accountBackend.getEmailOfUserId(fromUserId))!;
335332
final currentUser = await requireAuthenticatedWebUser();
336333
if (currentUser.email?.toLowerCase() != consent.email?.toLowerCase()) {
337334
throw NotAcceptableException(
338335
'Current user and consent user does not match.');
339336
}
340337

341338
await packageBackend.confirmUploader(
342-
fromUserId,
343-
fromUserEmail,
344339
packageName,
345340
currentUser.user,
341+
consentRequestFromAgent: consent.fromAgent!,
346342
consentRequestCreatedBySiteAdmin: createdBySiteAdmin,
347343
);
348344
}
@@ -352,7 +348,7 @@ class _PackageUploaderAction extends ConsentAction {
352348
final packageName = consent.args![0];
353349
await withRetryTransaction(dbService, (tx) async {
354350
tx.insert(await AuditLogRecord.uploaderInviteRejected(
355-
fromUserId: consent.fromUserId,
351+
fromAgent: consent.fromAgent,
356352
package: packageName,
357353
uploaderEmail: user?.email ?? consent.email!,
358354
userId: user?.userId,
@@ -365,7 +361,7 @@ class _PackageUploaderAction extends ConsentAction {
365361
final packageName = consent.args![0];
366362
await withRetryTransaction(dbService, (tx) async {
367363
tx.insert(await AuditLogRecord.uploaderInviteExpired(
368-
fromUserId: consent.fromUserId,
364+
fromAgent: consent.fromAgent,
369365
package: packageName,
370366
uploaderEmail: consent.email!,
371367
));
@@ -408,7 +404,7 @@ class _PublisherContactAction extends ConsentAction {
408404
await publisherBackend.updateContactWithVerifiedEmail(
409405
publisherId,
410406
contactEmail,
411-
consentRequestFromUserId: consent.fromUserId!,
407+
consentRequestFromAgent: consent.fromAgent!,
412408
consentRequestCreatedBySiteAdmin: consent.createdBySiteAdmin ?? false,
413409
);
414410
}
@@ -418,7 +414,7 @@ class _PublisherContactAction extends ConsentAction {
418414
final publisherId = consent.args![0];
419415
await withRetryTransaction(dbService, (tx) async {
420416
tx.insert(await AuditLogRecord.publisherContactInviteRejected(
421-
fromUserId: consent.fromUserId,
417+
fromAgent: consent.fromAgent,
422418
publisherId: publisherId,
423419
contactEmail: consent.email!,
424420
userEmail: user?.email,
@@ -432,7 +428,7 @@ class _PublisherContactAction extends ConsentAction {
432428
final publisherId = consent.args![0];
433429
await withRetryTransaction(dbService, (tx) async {
434430
tx.insert(await AuditLogRecord.publisherContactInviteExpired(
435-
fromUserId: consent.fromUserId,
431+
fromAgent: consent.fromAgent,
436432
publisherId: publisherId,
437433
contactEmail: consent.email!,
438434
));
@@ -488,7 +484,7 @@ class _PublisherMemberAction extends ConsentAction {
488484
await publisherBackend.inviteConsentGranted(
489485
publisherId,
490486
currentUser.userId,
491-
consentRequestFromUserId: consent.fromUserId!,
487+
consentRequestFromAgent: consent.fromAgent!,
492488
consentRequestCreatedBySiteAdmin: consent.createdBySiteAdmin ?? false,
493489
);
494490
}
@@ -498,7 +494,7 @@ class _PublisherMemberAction extends ConsentAction {
498494
final publisherId = consent.args![0];
499495
await withRetryTransaction(dbService, (tx) async {
500496
tx.insert(await AuditLogRecord.publisherMemberInviteRejected(
501-
fromUserId: consent.fromUserId,
497+
fromAgent: consent.fromAgent,
502498
publisherId: publisherId,
503499
memberEmail: user?.email ?? consent.email!,
504500
userId: user?.userId,
@@ -511,7 +507,7 @@ class _PublisherMemberAction extends ConsentAction {
511507
final publisherId = consent.args![0];
512508
await withRetryTransaction(dbService, (tx) async {
513509
tx.insert(await AuditLogRecord.publisherMemberInviteExpired(
514-
fromUserId: consent.fromUserId,
510+
fromAgent: consent.fromAgent,
515511
publisherId: publisherId,
516512
memberEmail: consent.email!,
517513
));

app/lib/account/default_auth_provider.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ abstract class BaseAuthProvider extends AuthProvider {
462462
/// do is to attempt authentication as both kinds of tokens. However, in
463463
/// practice Google oauth2 `access_token`s starts with `'ya29.'` and do not
464464
/// match the regular expression for JWTs. Thus, we can avoid significant
465-
/// overhead by trying the most likley approach first.
465+
/// overhead by trying the most likely approach first.
466466
bool _isLikelyAccessToken(String token) {
467467
// access_tokens starts with 'ya29.'
468468
if (token.startsWith('ya29.')) {

app/lib/account/session_cookie.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ ClientSessionCookieStatus parseClientSessionCookies(
6868
/// Create a set of HTTP headers that clears a session cookie.
6969
///
7070
/// If clearing the session cookie, remember that the most important part is to
71-
/// invalidate the serverside session. The user might be logging out because
71+
/// invalidate the server side session. The user might be logging out because
7272
/// the local session store was compromised.
7373
Map<String, Object> clearSessionCookies() {
7474
return {

app/lib/admin/actions/actions.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import '../../shared/exceptions.dart';
6+
import 'create_moderation_case.dart';
67
import 'create_publisher.dart';
8+
import 'delete_moderation_case.dart';
79
import 'delete_publisher.dart';
810
import 'merge_moderated_package_into_existing.dart';
911
import 'moderate_package.dart';
@@ -15,10 +17,12 @@ import 'package_version_retraction.dart';
1517
import 'publisher_block.dart';
1618
import 'publisher_members_list.dart';
1719
import 'remove_package_from_publisher.dart';
20+
import 'resolve_moderation_case.dart';
1821
import 'send_email.dart';
1922
import 'task_bump_priority.dart';
2023
import 'tool_execute.dart';
2124
import 'tool_list.dart';
25+
import 'update_moderation_case.dart';
2226
import 'uploader_count_report.dart';
2327
import 'user_info.dart';
2428

@@ -73,7 +77,9 @@ final class AdminAction {
7377
}
7478

7579
static List<AdminAction> actions = [
80+
createModerationCase,
7681
createPublisher,
82+
deleteModerationCase,
7783
deletePublisher,
7884
mergeModeratedPackageIntoExisting,
7985
moderatePackage,
@@ -85,10 +91,12 @@ final class AdminAction {
8591
publisherBlock,
8692
publisherMembersList,
8793
removePackageFromPublisher,
94+
resolveModerationCase,
8895
sendEmail,
8996
taskBumpPriority,
9097
toolExecute,
9198
toolList,
99+
updateModerationCase,
92100
uploaderCountReport,
93101
userInfo,
94102
];

0 commit comments

Comments
 (0)