spring-projects / spring-projects/spring-security

SEC-3177: Ability to intercept/handle messages sent to forbidden STOMP queues

Open
#3,349 0 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement type: jira
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

Alex (Migrated from SEC-3177) said:

If I enable websocket and message broker security and a client send a messages to a queue where he has no access the server logs a big error of this kind with the whole stack trace (internal to spring security):

2015-12-18 10:50:05.867 ERROR 24291 --- [nio-9090-exec-1] o.s.w.s.m.StompSubProtocolHandler        : Failed to send client message to application via MessageChannel in session 1. Sending STOMP ERROR to client.

org.springframework.messaging.MessageDeliveryException: Failed to send message to ExecutorSubscribableChannel[clientInboundChannel]; nested exception is org.springframework.security.access.AccessDeniedException: Accesso negato
        at org.springframework.messaging.support.AbstractMessageChannel.send(AbstractMessageChannel.java:127) ~[spring-messaging-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.messaging.support.AbstractMessageChannel.send(AbstractMessageChannel.java:104) ~[spring-messaging-4.2.4.RELEASE.jar:4.2.4.RELEASE]
        at org.springframework.web.socket.messaging.StompSubProtocolHandler.handleMessageFromClient(StompSubProtocolHandler.java:280) ~[spring-websocket-4.2.4.RELEASE.jar:4.2.4.RELEASE]
[...]

I don't want to log all this mess on the server, but I want to log that a certain user has tried this invalid operation, so a method to override this behaviour would be welcome.

If it already there is a way, I've not found how.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at StompSubProtocolHandler.handleMessageFromClient, the entry point shown in the stack trace, and trace how authorization failures from client messages are handled. Done means the behavior can be intercepted or customized so forbidden STOMP queue attempts can be logged without the full server stack trace; the issue does not name a test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
authorization, backend-api-design, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.