7.7 KiB
eip | title | description | author | discussions-to | status | type | category | created | requires |
---|---|---|---|---|---|---|---|---|---|
5437 | Security Contact Interface | An interface for security notice using asymmetric encryption | Zainan Zhou (@xinbenlv) | https://ethereum-magicians.org/t/erc-interface-for-security-contract/10303 | Draft | Standards Track | ERC | 2022-08-09 | 165 |
Abstract
An interface for security notice using asymmetric encryption. The interface exposes a asymmetric encryption key and a destination of delivery.
Motivation
Currently there is no consistent way to specify an official channel for security researchers to report security issues to smart contract maintainers.
Specification
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
interface IEIP5437 {
/// REQUIRED
function getSecurityContact(uint8 type, bytes memory data) public view
returns (
uint8 type,
bytes memory publicKey,
bytes memory extraData
);
/// OPTIONAL
// TODO consider remove if not needed before finalized
function setSecurityContact(
uint8 type,
bytes memory publicKey,
bytes memory extraData) public;
event SecurityContactChanged(uint8 type, bytes memory publicKeyForEncryption, bytes memory extraData);
/// OPTIONAL
function securityNotify(uint8 type, bytes memory data) public payable;
/// OPTIONAL
event OnSecurityNotification(uint8 type, bytes memory sourceData, uint256 value);
/// OPTIONAL
// TODO consider to make it a separate EIP
function bountyPolicy(uint256 id) public view returns(string, bytes memory extraData);
}
- Compliant interfaces MUST implement the
getSecurityContact
method.
type
is a one byte data with valid range of [0x10, 0x7f]
. The ranges of [0x00, 0x0f]
and [0x80, 0xff]
are reserved for future extension.
The type
indicates the format of the publicKey
and extraData
in the following way
Type | Encryption scheme | extraData |
---|---|---|
0x10 | GnuPG - RSA/3072 | Email address(es) encoded in format of RFC 2822 |
A new version of this table can be proposed by future EIPs by specifying a new type
number.
- The
publicKey
returned fromgetSecurityContact
MUST follow the encryption scheme specified in the table above.
The following is an example of a publicKey
using RSA/3072
generated via GnuPG in an RFC 20 ASCII-encoding of the public key string:
-----BEGIN PGP PUBLIC KEY BLOCK-----
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GeLZH+GnIola5KLO1
+YbsFEchLfLZ27pWGfIbyppvsuQmrHef+J3g6sXybOWDHVYr3Za1fzxQVIbwoIEe
ndKG0bu7ZAi2b/c8uH/wHT5IvtfzHLeSTjDqG8UyLTnaDxHQZIE9JIzWSQ1DSoNC
YrU7CQtL+/HRpiGFHfClaXln8VWkjnUvp+Fg1ZPtE1t/SKddZ7m29Hd9nzUc0OQW
MOA+HDqgA3a9kWbQKSloORq4unft1eu/FCra
=O6Bf
-----END PGP PUBLIC KEY BLOCK-----
-
IF
setSecurityContact
is implemented and a call to it has succeeded in setting a new security contact, an eventSecurityContactChanged
MUST be emitted with the identical passed-in-parameters ofsetSecurityContact
-
It's also RECOMMENDED that an on-chain security notify method
securityNotify
to implemented to receive security notice onchain. If it's implemented and a call has succeeded, it MUST emit anOnSecurityNotification
with identical pass-in-parameter data. -
Compliant interfaces MUST implement EIP-165.
- It's recommended to set a bounty policy via
bountyPolicy
method. Theid = 0
is preserved for a full overview, while other digits are used for different individual bounty policies. The returned string will be URI to content of bounty policies. No particular format of bounty policy is specified.
Rationale
- For simplicity, this EIP specifies a simple GPG scheme with a given encryption scheme and uses email addresses as a contact method. It's possible that future EIPs will specify new encryption schemes or delivery methods.
- This EIP adds an optional method,
setSecurityContact
, to set the security contact, because it might change due to circumstances such as the expiration of the cryptographic keys. - This EIP explicitly marks
securityNotify
aspayable
, in order to allow implementers to set a staking amount to report a security vulnerability. - This EIP allows for future expansion by adding the
bountyPolicy
theextraData
fields. Additional values of these fields may be added in future EIPs.
Backwards Compatibility
Currently, existing solutions such as OpenZeppelin use plaintext in source code
/// @custom:security-contact some-user@some-domain.com
It's recommend that new versions of smart contracts adopt this EIP in addition to the legacy @custom:security-contact
approach.
Security Considerations
Implementors should properly follow security practices required by the encryption scheme to ensure the security of the chosen communication channel. Some best practices are as follows:
- Keep security contact information up-to-date;
- Rotate encryption keys in the period recommended by best practice;
- Regularly monitor the channel to receive notices in a timely manner.
Copyright
Copyright and related rights waived via CC0.