Skip to content
20 changes: 11 additions & 9 deletions src/keria/app/agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from ..peer import exchanging as keriaexchanging
from .specing import AgentSpecResource
from ..core import authing, longrunning, httping
from ..core.authing import Authenticater
from ..core.authing import SignedHeaderAuthenticator
from ..core.keeping import RemoteManager
from ..db import basing

Expand Down Expand Up @@ -152,8 +152,8 @@ def setupDoers(config: KERIAServerConfig):
"""
Sets up the HIO coroutines the KERIA agent server is composed of including three HTTP servers for a KERIA agent server:
1. Boot server for bootstrapping agents. Signify calls this with a signed inception event.
2. Admin server for administrative tasks like creating agents.
3. HTTP server for all other agent operations.
2. Admin server for any Signify client related actions after bootstrapping.
3. HTTP server for all other external agents send KERI events or messages for interactions.
"""
agency = Agency(
name=config.name,
Expand All @@ -173,7 +173,8 @@ def setupDoers(config: KERIAServerConfig):
'signature',
'signature-input',
'signify-resource',
'signify-timestamp'
'signify-timestamp',
'signify-receiver'
]
bootApp = falcon.App(middleware=falcon.CORSMiddleware(
allow_origins='*', allow_credentials='*',
Expand All @@ -188,14 +189,15 @@ def setupDoers(config: KERIAServerConfig):
bootApp.add_route("/health", HealthEnd())

# Create Authenticater for verifying signatures on all requests
authn = Authenticater(agency=agency)
authn = SignedHeaderAuthenticator(agency=agency)

app = falcon.App(middleware=falcon.CORSMiddleware(
allow_origins='*', allow_credentials='*',
expose_headers=allowed_cors_headers))
app = falcon.App(
middleware=falcon.CORSMiddleware(allow_origins='*', allow_credentials='*', expose_headers=allowed_cors_headers),
request_type=authing.ModifiableRequest
)
if config.cors:
app.add_middleware(middleware=httping.HandleCORS())
app.add_middleware(authing.SignatureValidationComponent(agency=agency, authn=authn, allowed=["/agent"]))
app.add_middleware(authing.AuthenticationMiddleware(agency=agency, authn=authn, allowed=["/agent"]))
app.req_options.media_handlers.update(media.Handlers())
app.resp_options.media_handlers.update(media.Handlers())

Expand Down
7 changes: 4 additions & 3 deletions src/keria/app/aiding.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@


def loadEnds(app, agency, authn):
groupEnd = AgentResourceEnd(agency=agency, authn=authn)
app.add_route("/agent/{caid}", groupEnd)
agentEnd = AgentResourceEnd(agency=agency, authn=authn)
app.add_route("/agent/{caid}", agentEnd)

aidsEnd = IdentifierCollectionEnd()
app.add_route("/identifiers", aidsEnd)
Expand Down Expand Up @@ -245,7 +245,8 @@ def on_put(self, req, rep, caid):
ctrlHab = agent.hby.habByName(caid, ns="agent")
ctrlHab.rotate(serder=rot, sigers=[core.Siger(qb64=sig) for sig in sigs])

if not self.authn.verify(req):
# @TODO - foconnor: Not sure if this should be here - Signify is not signing headers for passcode rotation.
if not self.authn.inbound(req):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pfeairheller Passcode rotation (PUT /agent/{caid}) in Signify doesn't use signed headers (just has a signed body), like the rest of the /agent endpoints, so perhaps this shouldn't be checking for signed headers here. If not, I can update Signify to use the correct fetch, and adjust this to accept ESSR if needed.

Any idea @rodolfomiranda?

raise falcon.HTTPForbidden(description="invalid signature on request")

sxlt = body["sxlt"]
Expand Down
Loading