You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While #758 lays some great groundwork for a fresh new CLI, there is afaict. still no support for highly dynamic features such as HTMLProofer::Runner#before_request. I need before_request to add authorization headers for specific external URLs.
The reason I would like support for before_request in the CLI is because I would like to stop using HTMLProofer as a Ruby Gem and instead move to the HTMLProofer GitHub Action. Until the GitHub Action supports before_request, I can't move away from the Ruby Gem.
Perhaps a binding-scoped eval would provide enough security and flexibility? Bound to the request object, something like this should be possible to implement without sacrificing security too much, imho:
htmlproofer --before_request="options[:headers]['Authorization'] = 'Bearer ' + env['GITHUB_TOKEN'] if URI(base_url).host.match('github\.(com|io)$')"
I think env would have to be exposed, so it's probably better to create a new object that exposes the Request object alongside ENV and a few other useful things. In GitHub Actions, I suppose it's possible to interpolate GITHUB_TOKEN like so:
While #758 lays some great groundwork for a fresh new CLI, there is afaict. still no support for highly dynamic features such as
HTMLProofer::Runner#before_request
. I needbefore_request
to add authorization headers for specific external URLs.The reason I would like support for
before_request
in the CLI is because I would like to stop using HTMLProofer as a Ruby Gem and instead move to the HTMLProofer GitHub Action. Until the GitHub Action supportsbefore_request
, I can't move away from the Ruby Gem.Perhaps a
binding
-scopedeval
would provide enough security and flexibility? Bound to therequest
object, something like this should be possible to implement without sacrificing security too much, imho:htmlproofer --before_request="options[:headers]['Authorization'] = 'Bearer ' + env['GITHUB_TOKEN'] if URI(base_url).host.match('github\.(com|io)$')"
I think
env
would have to be exposed, so it's probably better to create a new object that exposes theRequest
object alongsideENV
and a few other useful things. In GitHub Actions, I suppose it's possible to interpolateGITHUB_TOKEN
like so:Thoughts?
The text was updated successfully, but these errors were encountered: