Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
rfc2253 is a parser and formatter for X.500/X.501 distinguished names based on RFC 2253 as used in LDAPv3 and SSL certificates.
This module requires an ES2015 (formerly known as ES6) compatible Map
implementation to be globally available. For older versions of Node.js you may have to use an appropriate shim, e.g. core-js.
npm install rfc2253
git clone https://github.com/foss-haas/rfc2253.git
cd rfc2253
npm install
npm run dist
Parses an RFC 2253 string representation of a distinguished name and returns a DistinguishedName
object.
Arguments
str: string
A UTF-8 encoded distinguished name.
Examples
const str = 'CN=Wayne\\, Bruce,DC=Wayne Enterprises';
let dn = rfc2253.parse(str);
dn.get('DC'); // 'Wayne Enterprises'
str === dn.format(); // true
Formats a DistinguishedName
or RelativeDistinguishedName
instance according to RFC 2253 and returns a UTF-8 encoded string.
Arguments
dn: DistinguishedName or RelativeDistinguishedName
The distinguished name or relative distinguished name to format as a string.
Examples
TODO
Escapes an attribute key or value and returns the escaped string.
Arguments
value: any
The value to escape. If the value is a Buffer
it will be formatted as an octothorpe (#
) followed by the hexadecimal representation of each byte in the buffer. Otherwise the value will be converted to a string and escaped according to RFC 2253.
Examples
rfc2253.escape(' "hello", <world> '); // '\\ \\"hello\\"\\, \\<world\\>\\ '
rfc2253.escape(new Buffer([1,2,3,16,255])); // '#01020310ff'
Represents a distinguished name consisting of zero or more relative distinguished names.
Determines whether the given DistinguishedName
is identical with this DN. Returns true
if both DNs contain the same number of RDNs in the same order and each pair of RDNs shares exactly the same keys and values (regardless of order). Returns false
otherwise.
Arguments
dn: DistinguishedName
Another DistinguishedName
to compare to.
Example
let dn1 = rfc2253.parse(str);
let dn2 = rfc2253.parse(str);
dn1.match(dn2); // true
dn2.match(dn1); // true
Formats this DN according to RFC 2253. Equivalent to passing the DN to the format
function.
Examples
TODO
Converts the DN to a human-readable string representation. Note that RDNs will appear in reverse order.
Examples
TODO
Checks whether a RelativeDistinguishedName
exists for the given offset or whether any of the RDNs has the given key.
Arguments
key: any
If key
is a number, it is the offset of a RelativeDistinguishedName
. Otherwise it is a key in at least one RDN.
Examples
TODO
Returns the RelativeDistinguishedName
at the given offset or looks up the given key and returns the first value.
Arguments
key: any
If key
is a number, it is the offset of a RelativeDistinguishedName
. Otherwise it is a key in at least one RDN.
Examples
let dn = rfc2253.parse('CN=Wayne\\, Bruce,DC=Wayne Enterprises');
dn.get('DC'); // 'Wayne Enterprises'
let rdn = dn.get(0); // <RelativeDistinguishedName>
rdn.get('CN'); // 'Wayne, Bruce'
Sets the given offset to the given RelativeDistinguishedName
or sets the given key to the given value.
If the key does not yet exist on any of the RDNs, a new RelativeDistinguishedName
will be created for the given key and value and appended to the DN.
Arguments
key: any
If key
is a number, it is the offset of the RelativeDistinguishedName
. Otherwise it is the key in a RelativeDistinguishedName
.
value: any
If key
is a number, this is the RelativeDistinguishedName
the given offset will be set to. Otherwise this is the value the key will be set to.
Examples
TODO
TODO
TODO
TODO
TODO
TODO
Returns the number of RDNs that are part of this DN. Also available as the size
property.
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
Returns the number of attributes of this RDN. Also available as the size
property.
The MIT/Expat license. For more information, see http://foss-haas.mit-license.org/ or the accompanying LICENSE file.
FAQs
LDAPv3 Distinguished Name parser and formatter.
The npm package rfc2253 receives a total of 1,597 weekly downloads. As such, rfc2253 popularity was classified as popular.
We found that rfc2253 demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.