Giter VIP home page Giter VIP logo

akismet.net's Introduction

Akismet.Net

Complete and full-featured Akismet client for .NET

Existing libraries don't allow for all of the possible options available in the Akismet API and the source code is not public. This library is meant to fix that.

It is also multi-targeted to support as many applications as possible.

NuGet Status

Meant to be a drop-in replacement for the leading Akismet library with minimal changes so the class names are the same. However some properties have been removed because of redundancy.

Example usage:

var model = new ContactModel();
string ip = Request.Headers["CF-Connecting-IP"] ?? Request.UserHostAddress;
if (String.IsNullOrWhiteSpace(ip))
    ip = Request.ServerVariables["REMOTE_HOST"];
AkismetClient akismet = new AkismetClient("apikeyhere", new Uri("https://www.adamh.us"), "Application Name");
AkismetComment comment = new AkismetComment
{
    CommentAuthor = model.Name,
    CommentAuthorEmail = model.EmailAddress,
    CommentAuthorUrl = "http://www.spamwebsite.com",
    Referrer = Request.UrlReferrer.ToString(),
    UserAgent = Request.UserAgent,
    UserIp = ip,
    CommentContent = model.Message,
    CommentType = AkismentCommentType.ContactForm, // multiple defined values, or use new AkismetCommentType("new-comment-type") for a custom option
    Permalink = "https://www.adamh.us/contact",
    IsTest = "false",
    BlogCharset = "UTF-8",
    BlogLanguage = "en-US",
    CommentDate = DateTime.UtcNow.ToString("s"), // ISO-8601 format
    CommentPostModified = DateTime.UtcNow.ToString("s"), // ISO-8601 format
    UserRole = "administrator",
    RecheckReason = "edit",
    HoneypotFieldName = "honeypot",
    HoneypotFieldValue = "blah"
};

var akismetResult = akismet.Check(comment);
bool isSpam = akismetResult.SpamStatus == SpamStatus.Spam; // Options: Ham, Spam, Unspecified (in the case of an error)

// "invalid" and/or combination of X-akismet-alert-code and X-akismet-alert-msg header values
foreach (string err in akismetResult.Errors)
    Console.WriteLine(err);
    
// Other properties:
//    - ProTip (X-akismet-pro-tip header value, if present)
//    - DebugHelp (X-akismet-debug-help header value, if present)

If HoneypotFieldName and HoneypotFieldValue are supplied then the library will add these two values to the request:

honeypot_field_name=honeypot&honeypot=blah

akismet.net's People

Contributors

ahwm avatar dependabot[bot] avatar mend-bolt-for-github[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

akismet.net's Issues

FIX: Missed Spam/False Positives in breakdown

Missed Spam is always 0 using this client, even when the raw call is not. This is most likely a deserialization error due to the underscore in these property names.

{
    "spam": 91,
    "ham": 40,
    "missed_spam": 14,
    "false_positives": 0,
    "accuracy": "89.31",
    "breakdown": {
        "2021-03": {
            "spam": "16",
            "ham": "12",
            "missed_spam": "1",
            "false_positives": "0",
            "da": "2021-03-01"
        },
        "2021-04": {
            "spam": "13",
            "ham": "7",
            "missed_spam": "2",
            "false_positives": "0",
            "da": "2021-04-01"
        },
        "2021-05": {
            "spam": "28",
            "ham": "6",
            "missed_spam": "5",
            "false_positives": "0",
            "da": "2021-05-01"
        },
        "2021-06": {
            "spam": "19",
            "ham": "10",
            "missed_spam": "3",
            "false_positives": "0",
            "da": "2021-06-01"
        },
        "2021-07": {
            "spam": "15",
            "ham": "5",
            "missed_spam": "3",
            "false_positives": "0",
            "da": "2021-07-01"
        }
    },
    "time_saved": 4845
}

coverlet.collector.3.0.2.nupkg: 1 vulnerabilities (highest severity is: 7.5)

Vulnerable Library - coverlet.collector.3.0.2.nupkg

Coverlet is a cross platform code coverage library for .NET, with support for line, branch and metho...

Library home page: https://api.nuget.org/packages/coverlet.collector.3.0.2.nupkg

Path to dependency file: /Akismet.Tests/Akismet.Tests.csproj

Path to vulnerable library: /home/wss-scanner/.nuget/packages/coverlet.collector/3.0.2/coverlet.collector.3.0.2.nupkg

Vulnerabilities

CVE Severity CVSS Dependency Type Fixed in (coverlet.collector.3.0.2.nupkg version) Remediation Possible**
CVE-2024-21907 High 7.5 coverlet.collector.3.0.2.nupkg Direct Newtonsoft.Json - 13.0.1

**In some cases, Remediation PR cannot be created automatically for a vulnerability despite the availability of remediation

Details

CVE-2024-21907

Vulnerable Library - coverlet.collector.3.0.2.nupkg

Coverlet is a cross platform code coverage library for .NET, with support for line, branch and metho...

Library home page: https://api.nuget.org/packages/coverlet.collector.3.0.2.nupkg

Path to dependency file: /Akismet.Tests/Akismet.Tests.csproj

Path to vulnerable library: /home/wss-scanner/.nuget/packages/coverlet.collector/3.0.2/coverlet.collector.3.0.2.nupkg

Dependency Hierarchy:

  • coverlet.collector.3.0.2.nupkg (Vulnerable Library)

Found in base branch: main

Vulnerability Details

Newtonsoft.Json before version 13.0.1 is affected by a mishandling of exceptional conditions vulnerability. Crafted data that is passed to the JsonConvert.DeserializeObject method may trigger a StackOverflow exception resulting in denial of service. Depending on the usage of the library, an unauthenticated and remote attacker may be able to cause the denial of service condition.

Publish Date: 2024-01-03

URL: CVE-2024-21907

CVSS 3 Score Details (7.5)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: None
    • Integrity Impact: None
    • Availability Impact: High

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: GHSA-5crp-9r3c-p9vr

Release Date: 2024-01-03

Fix Resolution: Newtonsoft.Json - 13.0.1

Step up your Open Source Security Game with Mend here

netstandard.library.1.6.1.nupkg: 2 vulnerabilities (highest severity is: 7.5)

Vulnerable Library - netstandard.library.1.6.1.nupkg

Path to dependency file: /Akismet.Tests/Akismet.Tests.csproj

Path to vulnerable library: /home/wss-scanner/.nuget/packages/system.text.regularexpressions/4.3.0/system.text.regularexpressions.4.3.0.nupkg

Found in HEAD commit: 7d4eb0cf8c64cf6a8d0437c645077c083c55f89b

Vulnerabilities

CVE Severity CVSS Dependency Type Fixed in (netstandard.library.1.6.1.nupkg version) Remediation Possible**
CVE-2019-0820 High 7.5 system.text.regularexpressions.4.3.0.nupkg Transitive N/A*
CVE-2018-8292 Medium 5.5 system.net.http.4.3.0.nupkg Transitive N/A*

*For some transitive vulnerabilities, there is no version of direct dependency with a fix. Check the "Details" section below to see if there is a version of transitive dependency where vulnerability is fixed.

**In some cases, Remediation PR cannot be created automatically for a vulnerability despite the availability of remediation

Details

CVE-2019-0820

Vulnerable Library - system.text.regularexpressions.4.3.0.nupkg

Provides the System.Text.RegularExpressions.Regex class, an implementation of a regular expression e...

Library home page: https://api.nuget.org/packages/system.text.regularexpressions.4.3.0.nupkg

Path to dependency file: /Akismet.Tests/Akismet.Tests.csproj

Path to vulnerable library: /home/wss-scanner/.nuget/packages/system.text.regularexpressions/4.3.0/system.text.regularexpressions.4.3.0.nupkg

Dependency Hierarchy:

  • netstandard.library.1.6.1.nupkg (Root Library)
    • system.xml.xdocument.4.3.0.nupkg
      • system.xml.readerwriter.4.3.0.nupkg
        • system.text.regularexpressions.4.3.0.nupkg (Vulnerable Library)

Found in HEAD commit: 7d4eb0cf8c64cf6a8d0437c645077c083c55f89b

Found in base branch: main

Vulnerability Details

A denial of service vulnerability exists when .NET Framework and .NET Core improperly process RegEx strings, aka '.NET Framework and .NET Core Denial of Service Vulnerability'. This CVE ID is unique from CVE-2019-0980, CVE-2019-0981.
Mend Note: After conducting further research, Mend has determined that CVE-2019-0820 only affects environments with versions 4.3.0 and 4.3.1 only on netcore50 environment of system.text.regularexpressions.nupkg.

Publish Date: 2019-05-16

URL: CVE-2019-0820

CVSS 3 Score Details (7.5)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: None
    • Integrity Impact: None
    • Availability Impact: High

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: GHSA-cmhx-cq75-c4mj

Release Date: 2019-05-16

Fix Resolution: System.Text.RegularExpressions - 4.3.1

Step up your Open Source Security Game with Mend here

CVE-2018-8292

Vulnerable Library - system.net.http.4.3.0.nupkg

Provides a programming interface for modern HTTP applications, including HTTP client components that allow applications to consume web services over HTTP and HTTP components that can be used by both clients and servers for parsing HTTP headers.

Library home page: https://api.nuget.org/packages/system.net.http.4.3.0.nupkg

Path to dependency file: /Akismet.Tests/Akismet.Tests.csproj

Path to vulnerable library: /home/wss-scanner/.nuget/packages/system.net.http/4.3.0/system.net.http.4.3.0.nupkg

Dependency Hierarchy:

  • netstandard.library.1.6.1.nupkg (Root Library)
    • system.net.http.4.3.0.nupkg (Vulnerable Library)

Found in HEAD commit: 7d4eb0cf8c64cf6a8d0437c645077c083c55f89b

Found in base branch: main

Vulnerability Details

An information disclosure vulnerability exists in .NET Core when authentication information is inadvertently exposed in a redirect, aka ".NET Core Information Disclosure Vulnerability." This affects .NET Core 2.1, .NET Core 1.0, .NET Core 1.1, PowerShell Core 6.0.

Publish Date: 2018-10-10

URL: CVE-2018-8292

CVSS 3 Score Details (5.5)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Local
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: None
    • Integrity Impact: None
    • Availability Impact: High

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Release Date: 2018-10-10

Fix Resolution: System.Net.Http - 4.3.4;Microsoft.PowerShell.Commands.Utility - 6.1.0-rc.1

Step up your Open Source Security Game with Mend here

microsoft.windows.compatibility.5.0.0.nupkg: 3 vulnerabilities (highest severity is: 8.1)

Vulnerable Library - microsoft.windows.compatibility.5.0.0.nupkg

Path to dependency file: /Akismet.Tests/Akismet.Tests.csproj

Path to vulnerable library: /home/wss-scanner/.nuget/packages/system.data.sqlclient/4.8.1/system.data.sqlclient.4.8.1.nupkg

Found in HEAD commit: 7d4eb0cf8c64cf6a8d0437c645077c083c55f89b

Vulnerabilities

CVE Severity CVSS Dependency Type Fixed in (microsoft.windows.compatibility.5.0.0.nupkg version) Remediation Possible**
CVE-2021-24112 High 8.1 system.drawing.common.5.0.0.nupkg Transitive N/A*
CVE-2022-34716 Medium 5.9 system.security.cryptography.xml.5.0.0.nupkg Transitive N/A*
CVE-2022-41064 Medium 5.8 system.data.sqlclient.4.8.1.nupkg Transitive N/A*

*For some transitive vulnerabilities, there is no version of direct dependency with a fix. Check the "Details" section below to see if there is a version of transitive dependency where vulnerability is fixed.

**In some cases, Remediation PR cannot be created automatically for a vulnerability despite the availability of remediation

Details

CVE-2021-24112

Vulnerable Library - system.drawing.common.5.0.0.nupkg

Provides access to GDI+ graphics functionality.

Commonly Used Types:
System.Drawing.Bitmap
System.D...

Library home page: https://api.nuget.org/packages/system.drawing.common.5.0.0.nupkg

Path to dependency file: /Akismet.Tests/Akismet.Tests.csproj

Path to vulnerable library: /home/wss-scanner/.nuget/packages/system.drawing.common/5.0.0/system.drawing.common.5.0.0.nupkg

Dependency Hierarchy:

  • microsoft.windows.compatibility.5.0.0.nupkg (Root Library)
    • system.data.oledb.5.0.0.nupkg
      • system.diagnostics.performancecounter.5.0.0.nupkg
        • system.configuration.configurationmanager.5.0.0.nupkg
          • system.security.permissions.5.0.0.nupkg
            • system.windows.extensions.5.0.0.nupkg
              • system.drawing.common.5.0.0.nupkg (Vulnerable Library)

Found in HEAD commit: 7d4eb0cf8c64cf6a8d0437c645077c083c55f89b

Found in base branch: main

Vulnerability Details

.NET Core Remote Code Execution Vulnerability

Publish Date: 2021-02-25

URL: CVE-2021-24112

CVSS 3 Score Details (8.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: High
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: High
    • Integrity Impact: High
    • Availability Impact: High

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: GHSA-rxg9-xrhp-64gj

Release Date: 2021-02-25

Fix Resolution: System.Drawing.Common - 4.7.2,5.0.3

Step up your Open Source Security Game with Mend here

CVE-2022-34716

Vulnerable Library - system.security.cryptography.xml.5.0.0.nupkg

Provides classes to support the creation and validation of XML digital signatures. The classes in th...

Library home page: https://api.nuget.org/packages/system.security.cryptography.xml.5.0.0.nupkg

Path to dependency file: /Akismet.Tests/Akismet.Tests.csproj

Path to vulnerable library: /home/wss-scanner/.nuget/packages/system.security.cryptography.xml/5.0.0/system.security.cryptography.xml.5.0.0.nupkg

Dependency Hierarchy:

  • microsoft.windows.compatibility.5.0.0.nupkg (Root Library)
    • system.servicemodel.primitives.4.7.0.nupkg
      • system.private.servicemodel.4.7.0.nupkg
        • system.security.cryptography.xml.5.0.0.nupkg (Vulnerable Library)

Found in HEAD commit: 7d4eb0cf8c64cf6a8d0437c645077c083c55f89b

Found in base branch: main

Vulnerability Details

Microsoft is releasing this security advisory to provide information about a vulnerability in .NET Core 3.1 and .NET 6.0. An information disclosure vulnerability exists in .NET Core 3.1 and .NET 6.0 that could lead to unauthorized access of privileged information.

Affected software

  • Any .NET 6.0 application running on .NET 6.0.7 or earlier.
  • Any .NET Core 3.1 applicaiton running on .NET Core 3.1.27 or earlier.

Patches

Publish Date: 2022-08-09

URL: CVE-2022-34716

CVSS 3 Score Details (5.9)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: High
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: High
    • Integrity Impact: None
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: GHSA-2m65-m22p-9wjw

Release Date: 2022-08-09

Fix Resolution: Microsoft.AspNetCore.App.Runtime.linux-arm - 3.1.28,6.0.8;Microsoft.AspNetCore.App.Runtime.linux-arm64 - 3.1.28,6.0.8;Microsoft.AspNetCore.App.Runtime.linux-musl-arm - 3.1.28,6.0.8;Microsoft.AspNetCore.App.Runtime.linux-musl-arm64 - 3.1.28,6.0.8;Microsoft.AspNetCore.App.Runtime.linux-musl-x64 - 3.1.28,6.0.8;Microsoft.AspNetCore.App.Runtime.linux-x64 - 3.1.28,6.0.8;Microsoft.AspNetCore.App.Runtime.osx-x64 - 3.1.28,6.0.8;Microsoft.AspNetCore.App.Runtime.win-arm - 3.1.28,6.0.8;Microsoft.AspNetCore.App.Runtime.win-arm64 - 3.1.28,6.0.8;Microsoft.AspNetCore.App.Runtime.win-x64 - 3.1.28,6.0.8;Microsoft.AspNetCore.App.Runtime.win-x86 - 3.1.28,6.0.8;System.Security.Cryptography.Xml - 4.7.1,6.0.1

Step up your Open Source Security Game with Mend here

CVE-2022-41064

Vulnerable Library - system.data.sqlclient.4.8.1.nupkg

Provides the data provider for SQL Server. These classes provide access to versions of SQL Server an...

Library home page: https://api.nuget.org/packages/system.data.sqlclient.4.8.1.nupkg

Path to dependency file: /Akismet.Tests/Akismet.Tests.csproj

Path to vulnerable library: /home/wss-scanner/.nuget/packages/system.data.sqlclient/4.8.1/system.data.sqlclient.4.8.1.nupkg

Dependency Hierarchy:

  • microsoft.windows.compatibility.5.0.0.nupkg (Root Library)
    • system.data.sqlclient.4.8.1.nupkg (Vulnerable Library)

Found in HEAD commit: 7d4eb0cf8c64cf6a8d0437c645077c083c55f89b

Found in base branch: main

Vulnerability Details

.NET Framework Information Disclosure Vulnerability
Mend Note: Converted from WS-2022-0377, on 2022-11-10.

Publish Date: 2022-11-09

URL: CVE-2022-41064

CVSS 3 Score Details (5.8)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Adjacent
    • Attack Complexity: High
    • Privileges Required: Low
    • User Interaction: None
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: High
    • Integrity Impact: None
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: GHSA-8g2p-5pqh-5jmc

Release Date: 2022-11-09

Fix Resolution: Microsoft.Data.SqlClient - 1.1.4,2.1.2;System.Data.SqlClient - 4.8.5

Step up your Open Source Security Game with Mend here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.