Skip to content

Commit

Permalink
🔊 indicator messages around BAD_REQUEST
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Jun 11, 2024
1 parent d0adbe1 commit 153a837
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.commonhaus.automation.admin.github.CommonhausDatastore;
import org.commonhaus.automation.admin.github.CommonhausDatastore.UpdateEvent;

import io.quarkus.logging.Log;
import io.quarkus.security.Authenticated;

@Path("/member/aliases")
Expand All @@ -49,9 +50,11 @@ public Response getAliases(@DefaultValue("false") @QueryParam("refresh") boolean
return Response.status(Response.Status.NOT_FOUND).build();
}
if (!user.status().mayHaveEmail()) {
Log.infof("getAliases|%s User is not eligible for email", user.login());
return Response.status(Response.Status.FORBIDDEN).build();
}
if (!ctx.validAttestation(ID)) {
Log.errorf("getAliases|%s %s is an invalid attestation id", user.login(), ID);
return Response.status(Response.Status.BAD_REQUEST).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class MemberAttestationResource {
@Produces("application/json")
public Response updateAttestation(AttestationPost post) {
if (!ctx.validAttestation(post.id())) {
Log.errorf("updateAttestation|%s: %s is an invalid attestation id", session.login(), post.id());
return Response.status(Response.Status.BAD_REQUEST).build();
}
try {
Expand Down Expand Up @@ -75,6 +76,8 @@ public Response updateAttestation(AttestationPost post) {
@Produces("application/json")
public Response updateAttestations(List<AttestationPost> postList) {
if (postList.stream().anyMatch(x -> !ctx.validAttestation(x.id()))) {
Log.errorf("updateAttestations|%s: Request includes an invalid attestation id",
session.login(), postList.stream().map(AttestationPost::id).toList());
return Response.status(Response.Status.BAD_REQUEST).build();
}

Expand Down
4 changes: 2 additions & 2 deletions cf-admin-bot/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
quarkus.log.level=INFO
quarkus.log.min-level=TRACE
quarkus.log.category."org.commonhaus".level=DEBUG
quarkus.log.category."io.quarkus.oidc".level=DEBUG
quarkus.log.category."io.quarkus.oidc".level=INFO
quarkus.log.category."io.quarkiverse".level=TRACE
quarkus.log.category."io.quarkus.cache".level=DEBUG
quarkus.log.category."io.quarkus.cache".level=INFO
quarkus.log.category."org.kohsuke.github".level=DEBUG
quarkus.log.category."org.kohsuke.github.GitHubClient".level=INFO
quarkus.log.category."jdk.event.security".level=WARN
Expand Down

0 comments on commit 153a837

Please sign in to comment.