Skip to content

[JENKINS-42969] Computer.addAction will throw UnsupportedOperationException #21962

@jenkins-infra-bot

Description

@jenkins-infra-bot

The fix of JENKINS-39555 (in 2.30) reverted some of the code introduced in JENKINS-39404, to fix some regressions there. Unfortunately it failed to revert one of the simplifications that was legitimately made in JENKINS-39404 to code originally introduced in JENKINS-18224: so now Computer.addAction is again inherited from Actionable, but will not work since getActions is an immutable list.

Probably no one noticed this before because no one was trying to call Computer.addAction, but egutierrez noticed that yesterday's security release of ssh-slaves by mc1arke introduced code which does, and which causes a failure in TrustHostKeyActionTest.testSubmitNotAuthorised when run against 2.32.3:

java.lang.UnsupportedOperationException
	at java.util.Collections$UnmodifiableCollection.add(Collections.java:1055)
	at hudson.model.Actionable.addAction(Actionable.java:134)
	at hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy.verify(ManuallyTrustedKeyVerificationStrategy.java:70)

Originally reported by jglick, imported from: Computer.addAction will throw UnsupportedOperationException
  • assignee: jglick
  • status: Resolved
  • priority: Critical
  • component(s): core
  • label(s): 2.46.2-fixed, regression
  • resolution: Fixed
  • resolved: 2017-03-23T16:05:04+00:00
  • votes: 1
  • watchers: 5
  • imported: 2025-11-24
Raw content of original issue

The fix of JENKINS-39555 (in 2.30) reverted some of the code introduced in JENKINS-39404, to fix some regressions there. Unfortunately it failed to revert one of the simplifications that was legitimately made in JENKINS-39404 to code originally introduced in JENKINS-18224: so now Computer.addAction is again inherited from Actionable, but will not work since getActions is an immutable list.

Probably no one noticed this before because no one was trying to call Computer.addAction, but egutierrez noticed that yesterday's security release of ssh-slaves by mc1arke introduced code which does, and which causes a failure in TrustHostKeyActionTest.testSubmitNotAuthorised when run against 2.32.3:

java.lang.UnsupportedOperationException
	at java.util.Collections$UnmodifiableCollection.add(Collections.java:1055)
	at hudson.model.Actionable.addAction(Actionable.java:134)
	at hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy.verify(ManuallyTrustedKeyVerificationStrategy.java:70)

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions