VYPR
Moderate severityNVD Advisory· Published May 16, 2022· Updated Aug 2, 2024

Improper Access Control in publify/publify

CVE-2022-0574

Description

Improper Access Control in GitHub repository publify/publify prior to 9.2.8.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
publify_coreRubyGems
< 9.2.89.2.8

Affected products

1

Patches

1
0e6c66ac2002

Do not allow comments on Article if not published

https://github.com/publify/publifyMatijs van ZuijlenFeb 13, 2022via ghsa
3 files changed · +29 2
  • publify_core/app/models/article.rb+1 1 modified
    @@ -204,7 +204,7 @@ def notify_user_via_email(user)
       end
     
       def comments_closed?
    -    !(allow_comments? && in_feedback_window?)
    +    !(allow_comments? && published? && in_feedback_window?)
       end
     
       def html_urls
    
  • publify_core/spec/controllers/comments_controller_spec.rb+15 0 modified
    @@ -58,6 +58,21 @@
             expect(response.body).to have_text "content"
           end
         end
    +
    +    it "does not allow commenting if article does not allow comments" do
    +      no_comments = create(:article, allow_comments: false)
    +      expect do
    +        post :create, xhr: true, params: { comment: comment_params,
    +                                           article_id: no_comments.id }
    +      end.not_to change(no_comments.comments, :count)
    +    end
    +
    +    it "does not allow commenting if article is draft" do
    +      draft = create(:article, state: "draft")
    +      expect do
    +        post :create, xhr: true, params: { comment: comment_params, article_id: draft.id }
    +      end.not_to change(draft.comments, :count)
    +    end
       end
     
       describe "#preview" do
    
  • publify_core/spec/models/article_spec.rb+13 1 modified
    @@ -856,8 +856,9 @@
         it "returns only published articles" do
           article = create(:article)
           create(:comment, article: article)
    -      unpublished_article = create(:article, state: "draft")
    +      unpublished_article = create(:article)
           create(:comment, article: unpublished_article)
    +      unpublished_article.update!(state: "draft")
           expect(described_class.published).to eq([article])
           expect(described_class.bestof).to eq([article])
         end
    @@ -955,6 +956,17 @@
         context "when auto_close setting is zero" do
           let(:auto_close_value) { 0 }
     
    +      it "does not allow comments for a draft article" do
    +        art = build :article, state: "draft", blog: blog
    +        assert art.comments_closed?
    +      end
    +
    +      it "does not allow comments for an article that will be published in the future" do
    +        art = build :article, state: "publication_pending",
    +                              published_at: 1.day.from_now, blog: blog
    +        assert art.comments_closed?
    +      end
    +
           it "allows comments for a newly published article" do
             art = build :article, published_at: 1.second.ago, blog: blog
             assert !art.comments_closed?
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

5

News mentions

0

No linked articles in our index yet.