
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Helper functions to syntactically validate strings according to RFC 3987.
Helper functions to parse and validate the syntax of terms defined in RFC 3987 — the IETF standard for Internationalized Resource Identifiers (IRIs).
The goal of rfc3987-syntax
is to provide a lightweight, permissively licensed Python module for validating that strings conform to the ABNF grammar defined in RFC 3987. These helpers are:
🧠 Note: This project focuses on syntax validation only. RFC 3987 specifies additional semantic rules (e.g., Unicode normalization, BiDi constraints, percent-encoding requirements) that must be enforced separately.
rfc3987-syntax
is licensed under the MIT License, which allows reuse in both open source and commercial software.
This project:
rfc3987
Python package (GPL-licensed)lark
, licensed under MIT⚠️ This project is not affiliated with or endorsed by the authors of RFC 3987 or the
rfc3987
Python package.
Please cite this software in accordance with the enclosed CITATION.cff file.
The grammar and parser enforce only the ABNF syntax defined in RFC 3987. The following are not validated and must be handled separately for full compliance:
::
, max segments)ChatGPT 40 was used during the original development process. Errors may exist due to this assistance. Additional review, testing, and bug fixes by human experts is welcome.
pip install rfc3987-syntax
from rfc3987_syntax import RFC3987_SYNTAX_TERMS
print("Supported terms:")
for term in RFC3987_SYNTAX_TERMS:
print(term)
from rfc3987_syntax import is_valid_syntax
if is_valid_syntax(term='iri', value='http://github.com'):
print("✓ Valid IRI syntax")
if not is_valid_syntax(term='iri', value='bob'):
print("✗ Invalid IRI syntax")
if not is_valid_syntax(term='iri_reference', value='bob'):
print("✓ Valid IRI-reference syntax")
from rfc3987_syntax import is_valid_syntax_iri
from rfc3987_syntax import is_valid_syntax_iri_reference
if is_valid_syntax_iri('http://github.com'):
print("✓ Valid IRI syntax")
if not is_valid_syntax_iri('bob'):
print("✗ Invalid IRI syntax")
if is_valid_syntax_iri_reference('bob'):
print("✓ Valid IRI-reference syntax")
from rfc3987_syntax import parse
ptree: ParseTree = parse(term="iri", value="http://github.com")
print(ptree)
This grammar was derived from:
[RFC 3987 – Internationalized Resource Identifiers (IRIs)]
→ Defines IRI syntax and extensions to URI (e.g. Unicode characters, ucschar
)
→ https://datatracker.ietf.org/doc/html/rfc3987
[RFC 3986 – Uniform Resource Identifier (URI): Generic Syntax)]
→ Provides reusable components like scheme
, authority
, ipv4address
, etc.
→ https://datatracker.ietf.org/doc/html/rfc3986
📝 When
RFC 3986
is listed as the source, it is used in accordance with RFC 3987, which explicitly references it for foundational elements.
Rule/Component | Source | Notes |
---|---|---|
iri | RFC 3987 | Top-level IRI rule |
iri_reference | RFC 3987 | Top-level IRI Reference rule |
absolute_iri | RFC 3987 | Top-level Absolute IRI rule |
scheme | RFC 3986 | Referenced by RFC 3987 §2.2 |
ihier_part | RFC 3987 | IRI-specific hierarchy |
irelative_ref | RFC 3987 | IRI-specific relative ref |
irelative_part | RFC 3987 | IRI-specific relative part |
iauthority | RFC 3986 | Standard URI authority |
ipath_abempty | RFC 3986 | Path format variant |
ipath_absolute | RFC 3986 | Absolute path |
ipath_noscheme | RFC 3986 | Path disallowing scheme prefix |
ipath_rootless | RFC 3986 | Used in non-scheme contexts |
iquery | RFC 3987 | Query extension to URI |
ifragment | RFC 3987 | Fragment extension to URI |
ipchar , isegment | RFC 3986 | Path characters and segments |
isegment_nz_nc | RFC 3987 | IRI-specific path constraint |
iunreserved | RFC 3987 | Includes ucschar |
ucschar , iprivate | RFC 3987 | Unicode support |
sub_delims | RFC 3986 | Reserved characters |
ip_literal | RFC 3986 | IPv6 or IPvFuture in [] |
ipv6address | RFC 3986 | Expanded forms only |
ipvfuture | RFC 3986 | Forward-compatible |
ipv4address | RFC 3986 | Dotted-decimal IPv4 |
ls32 | RFC 3986 | Final 32 bits of IPv6 |
h16 , dec_octet | RFC 3986 | Hex and decimal chunks |
port | RFC 3986 | Optional numeric |
pct_encoded | RFC 3986 | Percent encoding (e.g. %20 ) |
alpha , digit , hexdig | RFC 3986 | Character classes |
FAQs
Helper functions to syntactically validate strings according to RFC 3987.
We found that rfc3987-syntax demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.