forked from snxraven/p2ns
update docs
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
const state = require('../infrastructure/state');
|
||||
const { logDebug, logInfo } = require('../infrastructure/logger');
|
||||
const { logDebug, logInfo, logError } = require('../infrastructure/logger');
|
||||
const { getAllEntries, autoVoteForDomain, invalidateEntriesCache, parseClaimValue, safeRemoveClaim } = require('./core');
|
||||
const { trackDomainEvent } = require('../maintenance/metrics');
|
||||
const { getPersistentPublicKey } = require('../infrastructure/utils');
|
||||
const { getInternalDomains } = require('../plugins/plugin-handler');
|
||||
// Initialize reserved IPs set if not already present
|
||||
if (!state.reservedIPs) {
|
||||
state.reservedIPs = new Set(['127.0.0.1']);
|
||||
@@ -14,6 +15,14 @@ async function addDomain(domain, hash, ssl = false) {
|
||||
if (!claimant) {
|
||||
throw new Error('Cannot add domain: persistent public key not available');
|
||||
}
|
||||
|
||||
// Check if domain is internal - internal domains cannot be claimed
|
||||
const internalDomains = await getInternalDomains();
|
||||
if (internalDomains.includes(domain)) {
|
||||
logError('Domains', `SECURITY: Attempted to claim internal domain '${domain}' by ${claimant}. Internal domains are reserved for local use only.`);
|
||||
throw new Error(`Cannot claim internal domain: ${domain}. Internal domains are reserved for local use only.`);
|
||||
}
|
||||
|
||||
const claimKey = `claim:${domain}:${claimant}`;
|
||||
const timestamp = Date.now();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user