Shopify / Shopify/tapioca

Cannot use the `append_content_security_policy_directives` method in `ApplicationController`

Open
#2,445 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help-wanted
Dominant language
Ruby
Stars
873
Forks
164
Avg merge
4d 27m
Merged PRs (30d)
9

Description

The append_content_security_policy_directives from SecureHeaders can be referenced in ApplicationController as follows:

class ApplicationController < ActionController::Base
  def foo
    append_content_security_policy_directives(xxxx)
  end
end

However, Sorbet seems unable to find append_content_security_policy_directives.

Method append_content_security_policy_directives does not exist on ApplicationController

By the way, the method is generated in RBI as follows:

# sorbet/rbi/gems/secure_headers@7.1.0.rbi
module SecureHeaders
  def append_content_security_policy_directives(additions); end
  # ...
end

Therefore, it's possible that ActionController and SecureHeaders are not linked correctly.

Contributor guide

No contributing guide indexed for this repository

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 by reviewing the generated sorbet/rbi/gems/secure_headers@7.1.0.rbi and the ApplicationController usage described in the issue. Trace how SecureHeaders is included or extended in ActionController and how Tapioca links those declarations. Done means Sorbet recognizes append_content_security_policy_directives when called from ApplicationController, with coverage for the reported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.