close
Skip to content

enforce authentication in API tests and improve error handling for unauthenticated requests#21558

Merged
adfoster-r7 merged 1 commit into
rapid7:masterfrom
dwelch-r7:fix-api-app-test-stacktrace
Jun 11, 2026
Merged

enforce authentication in API tests and improve error handling for unauthenticated requests#21558
adfoster-r7 merged 1 commit into
rapid7:masterfrom
dwelch-r7:fix-api-app-test-stacktrace

Conversation

@dwelch-r7

Copy link
Copy Markdown
Contributor

Was getting this stacktrace

Msf::WebServices::MetasploitApiApp [-] Error handling request: opts must include a valid :workspace.
    Call Stack:
	 /Users/dwelch/dev/metasploit-framework/lib/msf/util/db_manager.rb:37:in `process_opts_workspace'
	 /Users/dwelch/dev/metasploit-framework/lib/msf/core/db_manager/host.rb:164:in `block in hosts'
	 /Users/dwelch/.rvm/gems/ruby-3.3.8@metasploit-framework/gems/activerecord-7.2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:415:in `with_connection'
	 /Users/dwelch/dev/metasploit-framework/lib/msf/core/db_manager/host.rb:158:in `hosts'

dug into it and it seems like a brittle test that was logging out the error but not causing the test itself to fail, this PR addresses that

Verification steps

  • CI passes
  • The stacktrace does not appear in the CI logs
  • bundle exec rspec spec/api/metasploit_api_app_spec.rb

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Metasploit Kanban Jun 10, 2026
@dwelch-r7
dwelch-r7 force-pushed the fix-api-app-test-stacktrace branch from 7d06bf4 to e799f13 Compare June 10, 2026 16:23
@dwelch-r7
dwelch-r7 force-pushed the fix-api-app-test-stacktrace branch from e799f13 to dd2475b Compare June 10, 2026 16:28
@smcintyre-r7

Copy link
Copy Markdown
Contributor

FWIW, I've also been getting this stack trace a lot lately. Thanks for taking a look into it.

@adfoster-r7
adfoster-r7 merged commit 7d4d33a into rapid7:master Jun 11, 2026
18 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Metasploit Kanban Jun 11, 2026
@adfoster-r7 adfoster-r7 added rn-no-release-notes no release notes bug and removed rn-fix release notes fix labels Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants