← Security advisories

Claude MCP skill CORS misconfiguration — skill CI/CD pipeline integration and build trigger endpoints — SA-SKL-CORS45

SA-SKL-CORS45 documents four CORS misconfiguration patterns in MCP skill registry CI/CD pipeline integration and build trigger endpoints. These endpoints govern how skill publishers connect their repositories to the registry's build infrastructure: reading pipeline configuration, triggering new builds, streaming build log output, and managing the layer cache that dramatically reduces incremental build times. Credential-bearing CORS on the CI configuration read exposes the complete pipeline definition including embedded build secrets, environment variable names, and the trigger tokens used to initiate builds programmatically. Wildcard ACAO on the build trigger endpoint lets any page consume a publisher's monthly build minutes quota by initiating builds for attacker-controlled commits or branches. A timing oracle on the CI logs endpoint reveals whether build logs exist for any skill across organizational boundaries, leaking pipeline activity signals. And credential-bearing CORS on the cache deletion endpoint allows any origin to purge the entire build layer cache using a victim admin session, forcing expensive full rebuilds that consume compute budget and degrade build pipeline throughput.

SA-SKL-CORS45 findings at a glance
CRITICALCORS45-001 — cors({origin:true,credentials:true}) on GET /api/skills/:id/ci/config; any origin reads full CI configuration including build secrets, environment variable names, and pipeline trigger tokens using victim session
HIGHCORS45-002 — ACAO: * on POST /api/skills/:id/ci/trigger; any page triggers CI builds consuming build minutes quota; fix: remove wildcard; require session; CSRF token; requireRole('admin'); per-org build trigger rate limit
MEDIUMCORS45-003 — ACAO origin reflection on GET /api/skills/:id/ci/logs emitted before ownership check; timing oracle reveals CI build log existence across all orgs
CRITICALCORS45-004 — cors({origin:true,credentials:true}) on DELETE /api/skills/:id/ci/cache; any origin purges CI build cache using victim admin session, forcing expensive full rebuilds and degrading build performance

CORS45-001 — Credential-bearing CORS on CI config exposes build secrets and pipeline trigger tokens

The CI configuration endpoint at GET /api/skills/:id/ci/config returns the complete pipeline definition stored in the registry for a given skill: the linked repository URL and branch mapping, the build command sequence, the set of environment variable names defined for the build environment, any embedded build secret references that the pipeline injects at build time, and the pipeline trigger tokens — randomly generated strings that allow external services to initiate a build via a webhook call without requiring full OAuth authentication. When the endpoint is configured with cors({origin:true,credentials:true}), the browser reflects any attacker-supplied Origin and includes credentials in the cross-origin response, granting any page that the victim visits full read access to the entire CI configuration document using the victim's authenticated session.

The pipeline trigger tokens are the most immediately dangerous component of this exposure. A trigger token is semantically equivalent to an unauthenticated build initiation credential: anyone who possesses one can fire a CI build for the associated skill at any time, from any origin, without further authentication. When CORS45-001 delivers trigger tokens to an attacker, the attacker no longer needs the credential-bearing CORS vulnerability to continue the attack — they now hold a durable credential that persists until the publisher rotates it. The attacker can initiate builds silently and repeatedly, consuming build minutes quota in the background, injecting attacker-controlled branch references or commit SHAs, or probing the build environment to discover what secrets are injected at runtime by analyzing the diff between builds.

The environment variable names exposed by CORS45-001 provide a second-order intelligence yield that is frequently underestimated. Even without the actual secret values — which the registry may store externally in a secrets manager and inject at build time without ever surfacing them in the config response — knowing the names of the environment variables tells an attacker exactly what secrets the pipeline depends on: which cloud provider credentials are present, which third-party API integrations are configured, which internal service accounts the build has access to, and what the naming conventions for secret management are within the publishing organization. This reconnaissance directly informs which follow-on attacks are most likely to succeed and which credential categories to target in subsequent phases.

CORS45-001 fix: Replace cors({origin:true,credentials:true}) with an explicit allowlist. Add requireSession before CORS middleware. For authenticated non-owners, return only a boolean indicating whether a CI pipeline is configured — never environment variable names, trigger tokens, build secret references, or pipeline command sequences. Rotate all existing trigger tokens immediately upon discovering this misconfiguration and audit recent build history for unauthorized trigger events.

WRONG
router.get('/skills/:id/ci/config',
  cors({ origin: true, credentials: true }),
  async (req, res) => {
    const config = await db.getCiConfig(req.params.id);
    // returns triggerTokens, envVarNames, buildSecretRefs, pipelineSteps — all sensitive
    res.json(config);
  }
);
RIGHT
router.get('/skills/:id/ci/config',
  requireSession,
  strictCors,
  async (req, res) => {
    const isOwner = await db.isSkillOwner(req.params.id, req.session.orgId);
    if (!isOwner) {
      // non-owners see only public pipeline existence signal — no secrets, no token names
      const hasCI = await db.hasCiConfigured(req.params.id);
      return res.json({ ciConfigured: hasCI });
    }
    const config = await db.getCiConfig(req.params.id);
    res.json(config);
  }
);

CORS45-002 — Wildcard ACAO on build trigger endpoint exhausts build minutes quota

The build trigger endpoint POST /api/skills/:id/ci/trigger initiates a CI build for the specified skill. With ACAO: *, any page holding the victim's Bearer token can POST to this endpoint and trigger builds against any skill in the registry. The quota exhaustion vector is direct: MCP skill registry build infrastructure allocates a monthly or rolling-window budget of build minutes per organization, enforced to prevent free-tier accounts from abusing compute resources and to bill paid accounts accurately. Each triggered build consumes minutes from this budget until the organization's quota is exhausted, at which point all CI builds are blocked until the quota window resets or the organization upgrades their plan.

The build trigger endpoint is particularly attractive for quota exhaustion because builds are typically long-duration operations — a full skill build that installs dependencies, runs tests, and packages the skill binary may take five to fifteen minutes. An attacker who chains CORS45-002 against a single victim admin session can fire dozens of builds in rapid succession before any rate limiting kicks in, consuming the organization's entire monthly build minutes budget within seconds of wall clock time while minutes of compute time continue accruing across all the queued builds. The result is a complete blockage of legitimate CI operations for the remainder of the quota window, forcing the organization to either pay for an emergency quota increase or halt all skill development work.

Beyond quota exhaustion, the wildcard ACAO on the trigger endpoint creates a cross-organization build injection risk when combined with insufficient branch or commit validation. If the endpoint accepts an attacker-supplied ref parameter specifying which branch or commit to build, an attacker can instruct the CI system to build from a branch that contains attacker-controlled code — either through a repository that the attacker has write access to (if repository access controls are not independently verified at build time) or by exploiting a branch name that the registry incorrectly resolves. Even if the build itself is sandboxed, build output logs may contain sensitive runtime information that the organization did not intend to expose outside the build environment, and the build output artifact may be published to a package registry if post-build publishing steps are part of the pipeline definition.

CORS45-002 fix: Remove wildcard. Require session. Require CSRF token. Add requireRole('admin'). Validate that the target skill belongs to the requesting org. Enforce a per-org build trigger rate limit — for example, a maximum of ten manual triggers per hour — in addition to the monthly minutes quota. Validate the ref parameter against the list of branches on the linked repository and reject refs that do not correspond to known branches at request time. Emit an audit log entry for every triggered build.

// WRONG — wildcard; anyone with a Bearer token can exhaust build quota and inject build refs
router.post('/skills/:id/ci/trigger',
  cors({ origin: '*' }),
  async (req, res) => {
    await ci.triggerBuild(req.params.id, req.body.ref);
    res.json({ ok: true });
  }
);

// RIGHT — allowlist + session + CSRF + admin role + ownership + ref validation + rate limit
router.post('/skills/:id/ci/trigger',
  requireSession,
  requireRole('admin'),
  strictCors,
  verifyCsrfToken,
  async (req, res) => {
    const skill = await db.getSkill(req.params.id);
    if (!skill || skill.orgId !== req.session.orgId) {
      return res.status(403).json({ error: 'forbidden' });
    }

    // validate ref against repository branches — reject unknown refs
    const validRef = await ci.isValidRef(skill.repoUrl, req.body.ref);
    if (!validRef) {
      return res.status(400).json({ error: 'invalid or unknown ref' });
    }

    // enforce per-org manual trigger rate limit
    const recentTriggers = await db.countRecentTriggers(req.session.orgId, { windowMinutes: 60 });
    const org = await db.getOrg(req.session.orgId);
    if (recentTriggers >= org.maxTriggersPerHour) {
      return res.status(429).json({ error: 'build trigger rate limit exceeded' });
    }

    // enforce monthly build minutes quota
    const minutesUsed = await db.getBuildMinutesUsed(req.session.orgId);
    if (minutesUsed >= org.monthlyBuildMinutesQuota) {
      return res.status(429).json({ error: 'monthly build minutes quota exhausted' });
    }

    const build = await ci.triggerBuild(req.params.id, req.body.ref);
    await audit.log('ci_build_triggered', {
      skillId: req.params.id,
      ref: req.body.ref,
      buildId: build.id,
      triggeredBy: req.session.userId
    });
    res.json({ buildId: build.id, status: build.status });
  }
);

Defense in depth for build triggers: In addition to CORS controls, require that manual build triggers generate a build provenance record linking the triggering user identity to the resulting artifact. This ensures that if an unauthorized trigger does occur — whether through CORS45-002, a stolen trigger token from CORS45-001, or a compromised admin account — the build artifact chain of custody is broken and downstream consumers can detect that a build was initiated outside normal CI automation.

CORS45-003 — Timing oracle on CI logs endpoint reveals build log existence across all orgs

The CI build logs endpoint GET /api/skills/:id/ci/logs reflects the Origin header in the Access-Control-Allow-Origin response before the ownership check executes. When a skill has CI builds with associated log output, the server executes a query to fetch the most recent log entries — a pagination query that joins across the builds and log_lines tables and is measurably slower than the immediate 404 path returned when no logs exist for the requested skill ID. The latency difference between these two paths is cross-origin observable via performance.now() timing in the browser's navigation timing API, even though the response body is never accessible cross-origin due to the CORS credential requirements on the actual log content endpoint.

The timing oracle created by CORS45-003 is valuable for competitive reconnaissance even though it does not expose log content. A skill with CI build logs has an active development pipeline — the organization is making regular commits, running builds, and iterating on the skill. For a private skill whose existence the publishing organization has not publicly announced, the presence of build logs confirms that the skill is under active development and not simply a placeholder registration. An attacker systematically probing skill IDs can build a map of which private skills have active CI pipelines, distinguish dormant registrations from actively developed products, and time social engineering or other attacks against organizations that are in a high-development-activity phase when they are most likely to be distracted by feature work.

The oracle also leaks cross-organizational build activity in a compound way when combined with CORS45-001. If the attacker first uses CORS45-001 to read the full CI configuration for skills they own access to — establishing the structure of skill ID namespacing and build cadence patterns in the registry — they can then use CORS45-003 to probe skill IDs they do not own and infer which private skills are receiving CI activity at what rate. Organizations that build on predictable cadences (daily automated builds, weekly release pipeline runs) leak their development rhythm through the oracle, allowing an attacker to predict future build windows and time other attacks to coincide with periods of elevated build activity when the CI infrastructure is under load.

CORS45-003 fix: Move CORS middleware after auth and ownership enforcement. Include orgId in the WHERE clause joining builds to skills so unauthorized skill IDs follow the same code path as nonexistent ones. Apply a minimum-latency strategy — for example, await new Promise(r => setTimeout(r, Math.max(0, 50 - elapsed))) — to normalize 403 and 404 response times to a constant floor. Never emit the ACAO header for requests that fail authorization checks, so the browser cannot distinguish a CORS-blocked preflight from a genuine 403.

WRONG
router.get('/skills/:id/ci/logs',
  cors({ origin: true }), // reflects Origin BEFORE ownership is checked — timing oracle
  async (req, res) => {
    const skill = await db.getSkill(req.params.id);
    if (!skill || skill.orgId !== req.session?.orgId) {
      return res.status(403).json({ error: 'forbidden' });
    }
    const logs = await db.getCiLogs(req.params.id); // slow path: joins builds + log_lines
    res.json(logs);
  }
);
RIGHT
router.get('/skills/:id/ci/logs',
  requireSession,
  async (req, res) => {
    const start = Date.now();

    // auth and ownership enforced BEFORE CORS middleware runs
    const skill = await db.getSkillForOrg(req.params.id, req.session.orgId);
    if (!skill) {
      // normalize latency: add floor delay so 403 and 404 paths are indistinguishable
      const elapsed = Date.now() - start;
      await new Promise(r => setTimeout(r, Math.max(0, 50 - elapsed)));
      // do NOT set ACAO header on unauthorized responses
      return res.status(403).json({ error: 'forbidden' });
    }

    // apply CORS only after ownership is confirmed
    strictCors(req, res, async () => {
      const logs = await db.getCiLogs(req.params.id);
      res.json(logs);
    });
  }
);

CORS45-004 — Credential-bearing CORS on cache delete forces full rebuilds and degrades build performance

The CI build cache deletion endpoint DELETE /api/skills/:id/ci/cache uses cors({origin:true,credentials:true}). Build layer caches store the intermediate build artifacts from previous successful runs — installed dependency trees, compiled intermediate files, downloaded base images, and resolved package lock states — so that subsequent builds can skip the expensive steps that produced those artifacts and only recompute what has actually changed. For skills with large dependency graphs or complex multi-stage build pipelines, the cache can represent hours of cumulative compute time; individual builds with a warm cache complete in minutes while cold builds without cache can require thirty to sixty minutes of compute time and consume a substantial portion of the monthly build minutes budget in a single run.

An attacker who tricks an org admin into visiting a malicious page can silently delete the CI build cache for any or all skills in the organization. The operational consequence triggers immediately on the next CI run: every pending or newly triggered build executes a full cold build from scratch, consuming the maximum possible build minutes rather than the incremental minutes a warm build would use. For organizations that run CI on every commit across multiple active skill repositories, a cache purge timed to coincide with a high-commit-frequency period — a release sprint, a dependency upgrade that touches many skills simultaneously, a hotfix pushed across all services — can exhaust the monthly build minutes quota in a single cache-cold build wave, blocking all subsequent CI for the remainder of the quota window.

CORS45-004 is particularly insidious because it produces no immediately visible error. The cache deletion itself succeeds silently, and the organization only discovers the attack when the next builds begin running significantly longer than expected and the build minutes dashboard shows anomalous consumption. By the time engineering is investigating the slowdown, the cache-cold build wave may already have consumed a large fraction of the monthly quota. The attack is deniable as an infrastructure issue — cache invalidation due to a base image update or a registry maintenance event — and without an audit log that records which user or session initiated the cache deletion and from what origin, the organization has no forensic basis to distinguish an attack from a legitimate administrative action.

CORS45-004 fix: Replace cors({origin:true,credentials:true}) with an explicit allowlist. Add requireSession, requireRole('admin'), and skill ownership verification. Require CSRF token. Emit a detailed audit log entry including the session user ID, source IP, User-Agent, and timestamp. Send an in-app notification to all org admins when a cache deletion occurs so they can confirm it was intentional and immediately retrigger warm builds for affected skills if the deletion was unauthorized.

WRONG
router.delete('/skills/:id/ci/cache',
  cors({ origin: true, credentials: true }),
  async (req, res) => {
    await ci.purgeBuildCache(req.params.id);
    res.json({ ok: true });
  }
);
RIGHT
router.delete('/skills/:id/ci/cache',
  requireSession,
  requireRole('admin'),
  strictCors,
  verifyCsrfToken,
  async (req, res) => {
    const skill = await db.getSkill(req.params.id);
    if (!skill || skill.orgId !== req.session.orgId) {
      return res.status(403).json({ error: 'forbidden' });
    }

    const cacheStats = await ci.getBuildCacheStats(req.params.id);
    await ci.purgeBuildCache(req.params.id);

    // emit detailed audit log — cache purges require full forensic trail
    await audit.log('ci_cache_purged', {
      skillId: req.params.id,
      orgId: req.session.orgId,
      purgingUserId: req.session.userId,
      cacheAgeSeconds: cacheStats.ageSeconds,
      cacheSizeBytes: cacheStats.sizeBytes,
      estimatedRebuildMinutes: cacheStats.estimatedColdBuildMinutes
    });

    // notify all org admins so they can confirm and respond if unauthorized
    const admins = await db.getOrgAdmins(req.session.orgId);
    for (const admin of admins) {
      await notifications.send(admin.userId, 'ci_cache_purged', {
        skillId: req.params.id,
        skillName: skill.name,
        purgedBy: req.session.userId,
        estimatedRebuildMinutes: cacheStats.estimatedColdBuildMinutes
      });
    }

    res.json({
      ok: true,
      estimatedRebuildMinutes: cacheStats.estimatedColdBuildMinutes
    });
  }
);

Soft-delete cache as a safer default: Rather than immediately purging build cache on delete, consider a soft-delete pattern that marks cache entries as invalidated but retains them for a short recovery window (for example, 30 minutes). If the deletion is confirmed as unauthorized, an org admin can restore the cache entries before the next scheduled build runs, entirely avoiding the cold-build compute cost. Hard deletion should require explicit confirmation of a soft-delete intent and should still emit the same audit log and notification events.

Detect SA-SKL-CORS45 in your registry

SkillAudit scans for credential-bearing CORS reflection on CI configuration endpoints, wildcard ACAO on build trigger operations, middleware ordering that emits CORS before auth on log endpoints, and unauthenticated cache deletion paths — across all CI/CD pipeline integration and build trigger sub-routers in your MCP skill registry codebase.

Scan your registry
FindingSeverityEndpointImpact
CORS45-001CRITICALGET /api/skills/:id/ci/configFull CI configuration exfiltration including build secrets, environment variable names, and pipeline trigger tokens
CORS45-002HIGHPOST /api/skills/:id/ci/triggerBuild minutes quota exhaustion; attacker-controlled build ref injection bypassing repository integrity checks
CORS45-003MEDIUMGET /api/skills/:id/ci/logsTiming oracle reveals CI build log existence across all orgs for active pipeline enumeration
CORS45-004CRITICALDELETE /api/skills/:id/ci/cacheCI build cache purged via victim admin session; cold rebuild wave exhausts build minutes quota; no audit trail

See also: SA-SKL-CORS44 (rate limiting and quota enforcement CORS patterns) and SA-SKL-CORS43 (notification and alert subscription CORS patterns) for related quota exhaustion and credential exposure chains that compound with CI/CD pipeline CORS misconfigurations in multi-stage attacks against MCP skill registry infrastructure.