Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 3.1/Psych 4 compatibility issues #1753

Closed
donoghuc opened this issue Aug 3, 2022 · 3 comments · Fixed by #1758
Closed

Ruby 3.1/Psych 4 compatibility issues #1753

donoghuc opened this issue Aug 3, 2022 · 3 comments · Fixed by #1758

Comments

@donoghuc
Copy link
Contributor

donoghuc commented Aug 3, 2022

WIth the work to support ruby 3 a32f4fd permitted classes were enumerated to read from preserved hosts. This list appears to be incomplete when you have configured ssh for a particular preserved hosts: See below for some classes that are preserved on ssh config in the following snippet:

ssh: !ruby/hash:Beaker::Options::OptionsHash
  :config: true
  :verify_host_key: false
  :auth_methods: &6
  - publickey
  :port: 22
  :forward_agent: true
  :keys: &7
  - id_rsa_acceptance
  - "/Users/cas.donoghue/.ssh/id_rsa-acceptance"
  :user_known_hosts_file: "/Users/cas.donoghue/.ssh/known_hosts"
  :keepalive: true
  :logger: &8 !ruby/object:Logger
    level: 4
    progname: 
    default_formatter: !ruby/object:Logger::Formatter
      datetime_format: 
    formatter: 
    logdev: !ruby/object:Logger::LogDevice
      shift_period_suffix: 
      shift_size: 
      shift_age: 
      filename: 
      dev: !ruby/object:IO {}
      mon_mutex: !ruby/object:Thread::Mutex {}
      mon_mutex_owner_object_id: 70248041560740
      mon_owner: 
      mon_count: 0
  :password_prompt: &9 !ruby/object:Net::SSH::Prompt {}
  :user: root

With beaker 4.35.0 and later when beaker attempts to read a hosts file with ssh config preserved it fails becuase the Logger and Net::SSH classes are not permitted to be safe loaded.

Would you recommend we add those all to the permitted classes list? Or is there some other way we need to handle this (maybe serializing the ssh config in a different way)?

@ekohl
Copy link
Member

ekohl commented Aug 4, 2022

To me the biggest questions is why Beaker serializes so much. It feels to me that it's serializing way too much. For example, a logger? A password prompt? Feels to me that they should be excluded from the file but I don't know beaker well enough to say.

@donoghuc
Copy link
Contributor Author

donoghuc commented Aug 9, 2022

Yeah marshaling the ruby objects to yaml seems... Not ideal. But refactoring that seems like a bit of an endeavor.

@nmburgan
Copy link
Contributor

nmburgan commented Nov 14, 2022

I think #1758 should work until we fix the issue of serializing too much into this file.

@ekohl ekohl closed this as completed Nov 23, 2022
steveax added a commit to steveax/beaker that referenced this issue Dec 13, 2023
This commit adds the PlatformTagContainer class to the
HostsFileParser module so that tests can be re-run. This
class was added to the 5.x series in a previous commit [1]
but was not added to the 4.x branch. For context see issue

[1]: 45f0bf9
[2]: voxpupuli#1753
steveax added a commit to steveax/beaker that referenced this issue Dec 13, 2023
This commit adds the PlatformTagContainer class to the
HostsFileParser module so that tests can be re-run. This
class was added to the 5.x series in a previous commit [1]
but was not added to the 4.x branch. For context see issue
1753 [2].

[1]: 45f0bf9
[2]: voxpupuli#1753
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants