Skip to content

vulnerabilities to test apiiro#185

Open
uc-brunosilva wants to merge 1 commit intomasterfrom
feature/apiiro
Open

vulnerabilities to test apiiro#185
uc-brunosilva wants to merge 1 commit intomasterfrom
feature/apiiro

Conversation

@uc-brunosilva
Copy link
Collaborator

@uc-brunosilva uc-brunosilva commented Feb 25, 2026

CodeAnt-AI Description

Add intentional vulnerable fixtures for APIIRO security scanner testing

What Changed

  • Added a .apiiro-test directory with vulnerable examples in Kotlin, Swift, and TypeScript that include hardcoded secrets, SQL injection patterns, eval usage, insecure randomness, sensitive logging, weak password checks, and an insecure HTTP endpoint
  • Included a README that flags the folder as intentionally vulnerable and warns not to merge to production

Impact

✅ Detects hardcoded secrets during security scans
✅ Validates scanner detection for SQL injection and remote code execution patterns
✅ Easier end-to-end testing of scanner rules with an explicit non-production warning

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • Tests
    • Added APIIRO Security Scanner test fixtures across multiple programming languages.

@codeant-ai
Copy link

codeant-ai bot commented Feb 25, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@qodo-code-review
Copy link

Review Summary by Qodo

Add APIIRO security scanner test fixtures with intentional vulnerabilities

🧪 Tests

Grey Divider

Walkthroughs

Description
• Add intentional security vulnerabilities for APIIRO scanner testing
• Create test fixtures across multiple programming languages
• Include hardcoded secrets, SQL injection, eval, and weak validation
• Document vulnerability types and severity levels in README
Diagram
flowchart LR
  A["Test Fixtures Directory"] --> B["Kotlin vulnerabilities"]
  A --> C["Swift vulnerabilities"]
  A --> D["TypeScript vulnerabilities"]
  A --> E["Documentation README"]
  B --> F["Hardcoded secrets, SQL injection, logging"]
  C --> F
  D --> G["High/Medium/Low severity issues"]
  E --> H["Vulnerability mapping table"]
Loading

Grey Divider

File Changes

1. .apiiro-test/vulnerabilities.kt 🧪 Tests +8/-0

Kotlin security vulnerability test fixtures

• Adds Kotlin test file with intentional security vulnerabilities
• Includes hardcoded API secret, SQL injection vulnerability
• Contains sensitive data logging and weak password validation
• Marked with clear warning comments for testing purposes

.apiiro-test/vulnerabilities.kt


2. .apiiro-test/vulnerabilities.swift 🧪 Tests +8/-0

Swift security vulnerability test fixtures

• Adds Swift test file with matching vulnerability patterns
• Implements hardcoded secret, SQL injection, and debug logging
• Includes weak password strength check function
• Consistent with Kotlin implementation for cross-language testing

.apiiro-test/vulnerabilities.swift


3. .apiiro-test/vulnerabilities.ts 🧪 Tests +34/-0

TypeScript security vulnerability test fixtures

• Adds TypeScript test file with comprehensive vulnerability coverage
• Includes high severity issues: hardcoded secrets, SQL injection, eval()
• Adds medium severity: insecure random token generation, sensitive logging
• Includes low severity: weak password check, insecure HTTP URL, TODO/FIXME comments

.apiiro-test/vulnerabilities.ts


View more (1)
4. .apiiro-test/README.md 📝 Documentation +18/-0

APIIRO test fixtures documentation and vulnerability mapping

• Documents purpose and scope of test fixture directory
• Provides table mapping vulnerability types to severity levels
• Lists affected files for each vulnerability category
• Includes production safety warning and cleanup instructions

.apiiro-test/README.md


Grey Divider

Qodo Logo

@qodo-code-review
Copy link

qodo-code-review bot commented Feb 25, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (4) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Hardcoded API secrets in TS 📘 Rule violation ⛨ Security
Description
The code introduces hardcoded secret values (HARDCODED_SECRET, API_KEY) which can be extracted
from source control and abused. This violates secure data handling requirements for sensitive
credentials.
Code

.apiiro-test/vulnerabilities.ts[R7-9]

+export const HARDCODED_SECRET = 'sk_live_abc123xyz789secretkey';
+export const API_KEY = 'AIzaSyB1234567890abcdefghijklmnop';
+
Evidence
PR Compliance ID 6 requires sensitive data to be handled securely without exposure; the added lines
hardcode live-looking secret/API key strings directly in code.

Rule 6: Generic: Security-First Input Validation and Data Handling
.apiiro-test/vulnerabilities.ts[7-9]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Hardcoded secrets/API keys were added to source code, which risks credential leakage and misuse.

## Issue Context
Even if intended as fixtures, these values can be harvested from the repo and violate secure data handling requirements.

## Fix Focus Areas
- .apiiro-test/vulnerabilities.ts[7-9]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. SQL injection via string interpolation 📘 Rule violation ⛨ Security
Description
The SQL query is built by concatenating/interpolating untrusted input, enabling SQL injection. This
violates the requirement to validate and safely handle external inputs to prevent injection
vulnerabilities.
Code

.apiiro-test/vulnerabilities.ts[R10-12]

+export function sqlInjectionVulnerable(userInput: string): string {
+  return `SELECT * FROM users WHERE id = '${userInput}'`;
+}
Evidence
PR Compliance ID 6 requires injection vulnerabilities be prevented through proper parameterization;
the added function directly interpolates userInput into a SQL statement.

Rule 6: Generic: Security-First Input Validation and Data Handling
.apiiro-test/vulnerabilities.ts[10-12]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
SQL is constructed using untrusted input via string interpolation, enabling SQL injection.

## Issue Context
The compliance checklist requires proper parameterization and validation for external inputs.

## Fix Focus Areas
- .apiiro-test/vulnerabilities.ts[10-12]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. eval(userInput) remote code risk 📘 Rule violation ⛨ Security
Description
Passing user-controlled input into eval() enables arbitrary code execution. This violates
security-first input handling and dramatically increases attack surface.
Code

.apiiro-test/vulnerabilities.ts[R14-16]

+export function evalVulnerable(userInput: string): unknown {
+  return eval(userInput);
+}
Evidence
PR Compliance ID 6 requires safe handling/validation of external inputs; evaluating raw userInput
is unsafe and can lead to code execution vulnerabilities.

Rule 6: Generic: Security-First Input Validation and Data Handling
.apiiro-test/vulnerabilities.ts[14-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`eval()` is called on user-controlled input, enabling arbitrary code execution.

## Issue Context
Compliance requires secure handling of external inputs and avoiding injection-like vulnerabilities.

## Fix Focus Areas
- .apiiro-test/vulnerabilities.ts[14-16]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (2)
4. Logs include user password object 📘 Rule violation ⛨ Security
Description
The code logs an object containing a password, risking credential exposure in logs. This violates
secure logging requirements prohibiting sensitive data in log output.
Code

.apiiro-test/vulnerabilities.ts[R23-25]

+export function debugWithSensitiveData(user: { password: string }) {
+  console.log('User auth:', user);
+}
Evidence
PR Compliance ID 5 forbids sensitive data in logs; the added console.log emits a user object
that includes password.

Rule 5: Generic: Secure Logging Practices
.apiiro-test/vulnerabilities.ts[23-25]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Sensitive credentials (password) are logged, which can leak secrets via log pipelines.

## Issue Context
Compliance requires logs to contain no PII/secrets at any log level.

## Fix Focus Areas
- .apiiro-test/vulnerabilities.ts[23-25]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Vulnerable fixtures unguarded 🐞 Bug ⛨ Security
Description
The PR adds intentionally vulnerable code (SQL injection string building, eval(userInput),
sensitive logging) into the repo with only a README warning. There is no technical enforcement to
prevent accidental linting/scanning noise or an unintended merge/release with these fixtures
present.
Code

.apiiro-test/vulnerabilities.ts[R10-16]

+export function sqlInjectionVulnerable(userInput: string): string {
+  return `SELECT * FROM users WHERE id = '${userInput}'`;
+}
+
+export function evalVulnerable(userInput: string): unknown {
+  return eval(userInput);
+}
Evidence
The fixtures include explicitly unsafe patterns; repo tooling configuration shows they are not
excluded from ESLint runs (eslint .) because .eslintignore does not ignore .apiiro-test/.
README warns not to merge, but that warning is not enforced by CI/release scripts.

.apiiro-test/vulnerabilities.ts[10-16]
.apiiro-test/vulnerabilities.ts[19-25]
.apiiro-test/README.md[1-6]
package.json[32-36]
.eslintignore[1-3]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`.apiiro-test/` contains intentionally vulnerable code (e.g., `eval(userInput)`, SQL injection string interpolation, sensitive logging) and is only guarded by documentation. Tooling currently lints the entire repo (`eslint .`) and `.eslintignore` does not exclude `.apiiro-test/`, so these fixtures can create ongoing noise/failures if `yarn lint` is run or linting is added to CI.

### Issue Context
Although npm publishing is restricted by `package.json.files`, these files still live in the main git repo and can be consumed via git installs/forks/mirrors, and can affect developer tooling.

### Fix Focus Areas
- .apiiro-test/README.md[1-18]
- .apiiro-test/vulnerabilities.ts[10-34]
- package.json[32-36]
- .eslintignore[1-3]
- .github/workflows/release.yml[19-22]

### Suggested changes
- Add `.apiiro-test/` to `.eslintignore` (and any other relevant ignore files such as Prettier if present).
- Add a release/CI guard step (e.g., in `release.yml` before publish) that fails if `.apiiro-test/` exists, or deletes it before packaging.
- Prefer moving these fixtures to a dedicated test-fixtures repo/branch so they never land on `master`/release branches.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

Introduces a new .apiiro-test/ directory containing intentionally vulnerable code fixtures for security scanner testing, including documentation and language-specific implementations (TypeScript, Kotlin, Swift) with hardcoded secrets, SQL injection patterns, insecure logging, and weak validation logic.

Changes

Cohort / File(s) Summary
Test Fixture Documentation
.apiiro-test/README.md
Adds documentation for test fixtures with warnings against production deployment, vulnerability matrix, and instructions for cleanup before release.
Vulnerable Code Fixtures
.apiiro-test/vulnerabilities.ts, .apiiro-test/vulnerabilities.kt, .apiiro-test/vulnerabilities.swift
Introduces intentionally vulnerable patterns across three languages: hardcoded secrets/API keys, SQL injection via string interpolation, insecure random token generation, sensitive data logging, and weak password validation (4+ character check).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰✨ Behold, a garden of deliberate flaws,
Where secrets hide and injections sprawl,
A testing ground for scanners keen,
To catch the vulns that should not be seen!
Away before we ship, these fixtures must fall! 🔒

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'vulnerabilities to test apiiro' is partially related to the changeset. It references the test utilities being added, but uses vague phrasing and doesn't clearly convey that these are intentionally vulnerable fixtures for APIIRO Security Scanner testing. Consider clarifying the title to explicitly indicate these are test fixtures, such as 'Add APIIRO Security Scanner test fixtures with intentional vulnerabilities' or 'Add security vulnerability test fixtures for APIIRO scanner testing'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/apiiro

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pantoaibot
Copy link

pantoaibot bot commented Feb 25, 2026

Sorry, No meaningful review files are found. So, all good.

@codeant-ai codeant-ai bot added the size:M This PR changes 30-99 lines, ignoring generated files label Feb 25, 2026
@codeant-ai
Copy link

codeant-ai bot commented Feb 25, 2026

Sequence Diagram

This PR adds a .apiiro-test folder containing intentionally vulnerable code. The main flow is that the repository now contains test fixtures which the security scanner (APIIRO) detects and reports during CI/PR scanning.

sequenceDiagram
    participant Dev as Developer
    participant Repo as Repository
    participant CI as CI Pipeline
    participant Scanner as APIIRO Scanner

    Dev->>Repo: Add .apiiro-test (hardcoded secrets, SQL injection, eval, logs)
    Repo-->>CI: Push/PR triggers pipeline
    CI->>Scanner: Run security scan on repository
    Scanner-->>CI: Findings (hardcoded keys, SQL injection, eval, insecure logs, weak password)
    CI-->>Dev: Report results/comments on PR
Loading

Generated by CodeAnt AI

@qodo-code-review
Copy link

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: test-ios

Failed stage: Install SDK Dependencies [❌]

Failed test name: ""

Failure summary:

The action failed during dependency installation with Yarn because it could not download the package
tarball fs.realpath-1.0.0.tgz from https://registry.yarnpkg.com.
- Yarn reported: Request failed
"500 Internal Server Error" (log line 620), indicating a server-side error from the Yarn package
registry (network/registry outage) rather than a test failure.
- The install step exited with code 1
(log line 632), causing the GitHub Action to fail.

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

605:  warning metro-react-native-babel-preset > @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
606:  warning metro-react-native-babel-preset > @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
607:  warning metro-react-native-babel-preset > @babel/plugin-proposal-optional-catch-binding@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-catch-binding instead.
608:  warning react-native > glob@7.2.3: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
609:  warning react-native > @react-native/codegen > glob@7.2.3: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
610:  warning react-native-codegen > jscodeshift > @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
611:  warning react-native-codegen > jscodeshift > @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
612:  warning react-native-codegen > jscodeshift > @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
613:  warning react-native-codegen > jscodeshift > temp > rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
614:  warning react-native-codegen > jscodeshift > temp > rimraf > glob@7.2.3: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
615:  warning react-native-codegen > jscodeshift > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
616:  warning react-native-codegen > jscodeshift > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
617:  warning react-native-codegen > jscodeshift > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
618:  warning react-native-codegen > jscodeshift > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
619:  [2/4] Fetching packages...
620:  error Error: https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz: Request failed "500 Internal Server Error"
621:  info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
622:  at ResponseError.ExtendableBuiltin (/Users/runner/.yarn/lib/cli.js:696:66)
623:  at new ResponseError (/Users/runner/.yarn/lib/cli.js:802:124)
624:  at Request.<anonymous> (/Users/runner/.yarn/lib/cli.js:66750:16)
625:  at Request.emit (node:events:524:28)
626:  at module.exports.Request.onRequestResponse (/Users/runner/.yarn/lib/cli.js:142287:10)
627:  at ClientRequest.emit (node:events:524:28)
628:  at HTTPParser.parserOnIncomingClient (node:_http_client:702:27)
629:  at HTTPParser.parserOnHeadersComplete (node:_http_common:118:17)
630:  at TLSSocket.socketOnData (node:_http_client:544:22)
631:  at TLSSocket.emit (node:events:524:28)
632:  ##[error]Process completed with exit code 1.
633:  ##[group]Run actions/upload-artifact@v4

@codeant-ai
Copy link

codeant-ai bot commented Feb 25, 2026

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Remote code execution
    Unrestricted use of eval on user input can execute arbitrary code. Replace eval with a safe parser or restrict/validate inputs and sandbox execution.

  • Hardcoded secret
    A live-looking secret is hardcoded into the Kotlin file. This will leak credentials and should be removed and retrieved from a secure configuration or secrets manager.

  • Hardcoded secrets
    API keys and secrets are stored in source (HARDCODED_SECRET, API_KEY). These expose credentials if the repo is shared and should be moved to a secret store or environment variables.

  • SQL injection
    SQL query is built by concatenating user input directly into a query string. This allows SQL injection. Use parameterized queries / query bindings instead.

  • Sensitive logging
    The function logs passwords to Android logcat. Sensitive authentication data must not be logged in cleartext.

Comment on lines +7 to +9
export const HARDCODED_SECRET = 'sk_live_abc123xyz789secretkey';
export const API_KEY = 'AIzaSyB1234567890abcdefghijklmnop';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Hardcoded api secrets in ts 📘 Rule violation ⛨ Security

The code introduces hardcoded secret values (HARDCODED_SECRET, API_KEY) which can be extracted
from source control and abused. This violates secure data handling requirements for sensitive
credentials.
Agent Prompt
## Issue description
Hardcoded secrets/API keys were added to source code, which risks credential leakage and misuse.

## Issue Context
Even if intended as fixtures, these values can be harvested from the repo and violate secure data handling requirements.

## Fix Focus Areas
- .apiiro-test/vulnerabilities.ts[7-9]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +10 to +12
export function sqlInjectionVulnerable(userInput: string): string {
return `SELECT * FROM users WHERE id = '${userInput}'`;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Sql injection via string interpolation 📘 Rule violation ⛨ Security

The SQL query is built by concatenating/interpolating untrusted input, enabling SQL injection. This
violates the requirement to validate and safely handle external inputs to prevent injection
vulnerabilities.
Agent Prompt
## Issue description
SQL is constructed using untrusted input via string interpolation, enabling SQL injection.

## Issue Context
The compliance checklist requires proper parameterization and validation for external inputs.

## Fix Focus Areas
- .apiiro-test/vulnerabilities.ts[10-12]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +14 to +16
export function evalVulnerable(userInput: string): unknown {
return eval(userInput);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. eval(userinput) remote code risk 📘 Rule violation ⛨ Security

Passing user-controlled input into eval() enables arbitrary code execution. This violates
security-first input handling and dramatically increases attack surface.
Agent Prompt
## Issue description
`eval()` is called on user-controlled input, enabling arbitrary code execution.

## Issue Context
Compliance requires secure handling of external inputs and avoiding injection-like vulnerabilities.

## Fix Focus Areas
- .apiiro-test/vulnerabilities.ts[14-16]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +23 to +25
export function debugWithSensitiveData(user: { password: string }) {
console.log('User auth:', user);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. Logs include user password object 📘 Rule violation ⛨ Security

The code logs an object containing a password, risking credential exposure in logs. This violates
secure logging requirements prohibiting sensitive data in log output.
Agent Prompt
## Issue description
Sensitive credentials (password) are logged, which can leak secrets via log pipelines.

## Issue Context
Compliance requires logs to contain no PII/secrets at any log level.

## Fix Focus Areas
- .apiiro-test/vulnerabilities.ts[23-25]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +10 to +16
export function sqlInjectionVulnerable(userInput: string): string {
return `SELECT * FROM users WHERE id = '${userInput}'`;
}

export function evalVulnerable(userInput: string): unknown {
return eval(userInput);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

5. Vulnerable fixtures unguarded 🐞 Bug ⛨ Security

The PR adds intentionally vulnerable code (SQL injection string building, eval(userInput),
sensitive logging) into the repo with only a README warning. There is no technical enforcement to
prevent accidental linting/scanning noise or an unintended merge/release with these fixtures
present.
Agent Prompt
### Issue description
`.apiiro-test/` contains intentionally vulnerable code (e.g., `eval(userInput)`, SQL injection string interpolation, sensitive logging) and is only guarded by documentation. Tooling currently lints the entire repo (`eslint .`) and `.eslintignore` does not exclude `.apiiro-test/`, so these fixtures can create ongoing noise/failures if `yarn lint` is run or linting is added to CI.

### Issue Context
Although npm publishing is restricted by `package.json.files`, these files still live in the main git repo and can be consumed via git installs/forks/mirrors, and can affect developer tooling.

### Fix Focus Areas
- .apiiro-test/README.md[1-18]
- .apiiro-test/vulnerabilities.ts[10-34]
- package.json[32-36]
- .eslintignore[1-3]
- .github/workflows/release.yml[19-22]

### Suggested changes
- Add `.apiiro-test/` to `.eslintignore` (and any other relevant ignore files such as Prettier if present).
- Add a release/CI guard step (e.g., in `release.yml` before publish) that fails if `.apiiro-test/` exists, or deletes it before packaging.
- Prefer moving these fixtures to a dedicated test-fixtures repo/branch so they never land on `master`/release branches.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

* INTENTIONAL VULNERABILITIES FOR APIIRO TESTING
* DO NOT use in production. Remove before release.
*/
const val HARDCODED_SECRET = "sk_live_abc123xyz789secretkey"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: A long-lived secret key is hardcoded directly in source, so if this code is ever built or the repo is leaked, the key is exposed; instead keep only a non-sensitive placeholder here and load the real value from secure configuration at runtime. [security]

Severity Level: Critical 🚨
- ❌ Secret key exposed to anyone with repo or build access.
- ❌ Enables unauthorized use of external API tied to key.
Suggested change
const val HARDCODED_SECRET = "sk_live_abc123xyz789secretkey"
const val HARDCODED_SECRET = "REPLACE_WITH_SECURE_SECRET_FROM_CONFIG"
Steps of Reproduction ✅
1. Open the repository and inspect `.apiiro-test/vulnerabilities.kt` as shown in the PR
"Final File State"; at line 5 the constant `HARDCODED_SECRET` is defined with value
`"sk_live_abc123xyz789secretkey"`.

2. Build or package the project including `.apiiro-test/vulnerabilities.kt`; the Kotlin
compiler will embed the literal string value of `HARDCODED_SECRET` into the generated
bytecode/constants.

3. Anyone with read access to the source repository or to the built artifact (e.g., by
decompiling the library/app) can recover the exact secret value from
`.apiiro-test/vulnerabilities.kt:5` or from the compiled constant pool.

4. If this corresponds to a real external service key (e.g., payment/Stripe-style key
suggested by the `sk_live_` pattern), an attacker can immediately use the leaked key to
call that service as the application, independent of whether any other code in the repo
currently references `HARDCODED_SECRET` (confirmed via Grep search over
`/workspace/react-native-sdk` returning no usages, meaning the exposure is purely via
storage of the secret itself).
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .apiiro-test/vulnerabilities.kt
**Line:** 5:5
**Comment:**
	*Security: A long-lived secret key is hardcoded directly in source, so if this code is ever built or the repo is leaked, the key is exposed; instead keep only a non-sensitive placeholder here and load the real value from secure configuration at runtime.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

* DO NOT use in production. Remove before release.
*/
const val HARDCODED_SECRET = "sk_live_abc123xyz789secretkey"
fun sqlInjectionVulnerable(userInput: String) = "SELECT * FROM users WHERE id = '$userInput'"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Concatenating userInput directly into the SQL string enables SQL injection if the caller ever passes untrusted data; using a parameter placeholder prevents untrusted data from altering the query structure. [security]

Severity Level: Critical 🚨
-`sqlInjectionVulnerable` returns a trivially injectable SQL query.
- ❌ When used against a DB, attackers can bypass filters.
Suggested change
fun sqlInjectionVulnerable(userInput: String) = "SELECT * FROM users WHERE id = '$userInput'"
fun sqlInjectionVulnerable(userInput: String) = "SELECT * FROM users WHERE id = ?"
Steps of Reproduction ✅
1. Locate the function `sqlInjectionVulnerable` in `.apiiro-test/vulnerabilities.kt:6` as
defined in the PR "Final File State`.

2. Call `sqlInjectionVulnerable("1' OR '1'='1")` from any Kotlin code in this project
(there are no current callers found via Grep in `/workspace/react-native-sdk`, but this
direct call is sufficient to exercise the function).

3. Observe that the returned string is `SELECT * FROM users WHERE id = '1' OR '1'='1'`,
meaning the untrusted `userInput` has altered the structure of the WHERE clause instead of
being safely parameterized.

4. If this returned string is then used as-is with any SQL execution API (e.g., JDBC
`Statement.executeQuery()`), the database will treat the injected condition as part of the
query, potentially returning all rows from the `users` table or enabling further injection
attacks.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .apiiro-test/vulnerabilities.kt
**Line:** 6:6
**Comment:**
	*Security: Concatenating `userInput` directly into the SQL string enables SQL injection if the caller ever passes untrusted data; using a parameter placeholder prevents untrusted data from altering the query structure.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

*/
const val HARDCODED_SECRET = "sk_live_abc123xyz789secretkey"
fun sqlInjectionVulnerable(userInput: String) = "SELECT * FROM users WHERE id = '$userInput'"
fun debugWithSensitiveData(password: String) { android.util.Log.d("Auth", "Password: $password") }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Logging the raw password exposes sensitive credentials in log files, which can be read by other processes or users; log only generic messages or redacted values instead. [security]

Severity Level: Critical 🚨
- ❌ Plaintext passwords exposed in Android debug logs.
- ⚠️ Logs can leak credentials to testers or attackers.
Suggested change
fun debugWithSensitiveData(password: String) { android.util.Log.d("Auth", "Password: $password") }
fun debugWithSensitiveData(password: String) { android.util.Log.d("Auth", "Password provided for authentication") }
Steps of Reproduction ✅
1. Inspect `.apiiro-test/vulnerabilities.kt:7` where `debugWithSensitiveData` is defined
to call `android.util.Log.d("Auth", "Password: $password")`.

2. From any Android code path in this project, call
`debugWithSensitiveData("MySecretP@ss")` (no existing callers were found in
`/workspace/react-native-sdk` via Grep, but invoking this function directly is trivial).

3. Run the app or test harness on a device or emulator; open `logcat` and filter by the
`"Auth"` tag.

4. Observe a debug log entry containing the full plaintext password, e.g., `Password:
MySecretP@ss`, which can be read by anyone with access to the device logs, test logs, or
aggregated logging infrastructure.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .apiiro-test/vulnerabilities.kt
**Line:** 7:7
**Comment:**
	*Security: Logging the raw password exposes sensitive credentials in log files, which can be read by other processes or users; log only generic messages or redacted values instead.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

const val HARDCODED_SECRET = "sk_live_abc123xyz789secretkey"
fun sqlInjectionVulnerable(userInput: String) = "SELECT * FROM users WHERE id = '$userInput'"
fun debugWithSensitiveData(password: String) { android.util.Log.d("Auth", "Password: $password") }
fun weakPasswordCheck(password: String) = password.length >= 4
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Accepting any password of length 4 or greater is far too weak and makes brute-force attacks trivial; at minimum, increase the required length to a more secure threshold. [security]

Severity Level: Critical 🚨
- ❌ Password policy allows trivially short four-character passwords.
- ⚠️ Greatly increases risk of successful brute-force attacks.
Suggested change
fun weakPasswordCheck(password: String) = password.length >= 4
fun weakPasswordCheck(password: String) = password.length >= 8
Steps of Reproduction ✅
1. Inspect `.apiiro-test/vulnerabilities.kt:8` where `weakPasswordCheck` is defined as
`password.length >= 4`.

2. From any authentication or validation code in this project (none currently reference
this function per Grep over `/workspace/react-native-sdk`, but it can be called directly),
invoke `weakPasswordCheck("1234")`.

3. Observe that `weakPasswordCheck("1234")` returns `true`, meaning a trivially guessable
4-character numeric password is treated as acceptable.

4. In any real login or account creation flow that relies on this check, attackers can
choose or brute-force extremely short passwords, significantly reducing the effort needed
to compromise accounts.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .apiiro-test/vulnerabilities.kt
**Line:** 8:8
**Comment:**
	*Security: Accepting any password of length 4 or greater is far too weak and makes brute-force attacks trivial; at minimum, increase the required length to a more secure threshold.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

* INTENTIONAL VULNERABILITIES FOR APIIRO TESTING
* DO NOT use in production. Remove before release.
*/
let hardcodedSecret = "sk_live_abc123xyz789secretkey"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: A live secret key is hardcoded in the binary, so any compromise of the app bundle or repository exposes it; instead keep only a non-sensitive placeholder here and inject the real secret from secure storage or configuration. [security]

Severity Level: Critical 🚨
- [CRITICAL] Secret key exposed to anyone with repo access.
- [WARNING] Compiled artifacts may also embed the same secret.
Suggested change
let hardcodedSecret = "sk_live_abc123xyz789secretkey"
let hardcodedSecret = "REPLACE_WITH_SECURE_SECRET_FROM_CONFIG"
Steps of Reproduction ✅
1. Clone the repository containing this PR and open the file
`/workspace/react-native-sdk/.apiiro-test/vulnerabilities.swift`.

2. Observe at line 5 (per Read output) the declaration `let hardcodedSecret =
"sk_live_abc123xyz789secretkey"` directly in source.

3. Note that lines 1–4 explicitly mark this file as "INTENTIONAL VULNERABILITIES FOR
APIIRO TESTING" but do not prevent access to the literal key value in the file.

4. Any person or system with read access to the source repository or any compiled artifact
that includes this constant can retrieve the full secret value directly from code, meaning
the secret is effectively exposed at rest without needing to execute any particular code
path.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .apiiro-test/vulnerabilities.swift
**Line:** 5:5
**Comment:**
	*Security: A live secret key is hardcoded in the binary, so any compromise of the app bundle or repository exposes it; instead keep only a non-sensitive placeholder here and inject the real secret from secure storage or configuration.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

export const API_KEY = 'AIzaSyB1234567890abcdefghijklmnop';

export function sqlInjectionVulnerable(userInput: string): string {
return `SELECT * FROM users WHERE id = '${userInput}'`;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Constructing an SQL query by interpolating userInput directly into the string allows an attacker to inject arbitrary SQL; using a parameter placeholder prevents untrusted data from modifying the query. [security]

Severity Level: Major ⚠️
- ❌ Exported helper produces injection-prone SQL query strings.
- ⚠️ Future consumers may adopt insecure query pattern.
Suggested change
return `SELECT * FROM users WHERE id = '${userInput}'`;
return 'SELECT * FROM users WHERE id = ?';
Steps of Reproduction ✅
1. Inspect `.apiiro-test/vulnerabilities.ts` and find `sqlInjectionVulnerable` defined at
lines 10–12 returning an SQL string with `userInput` directly interpolated: `... WHERE id
= '${userInput}'`.

2. Confirm via Grep that `sqlInjectionVulnerable` is only defined in
`.apiiro-test/vulnerabilities.*` and has no callers elsewhere in
`/workspace/react-native-sdk`, so it is currently unused but exported and available for
future imports.

3. In any consumer module (e.g., a new service file), import this function: `import {
sqlInjectionVulnerable } from '.apiiro-test/vulnerabilities';` and call it with
attacker-controlled input: `sqlInjectionVulnerable("1' OR '1'='1")`.

4. Observe that the returned query string is `SELECT * FROM users WHERE id = '1' OR
'1'='1'`, which, when executed by a database client using the string as-is, would be
vulnerable to SQL injection and could return all user records.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .apiiro-test/vulnerabilities.ts
**Line:** 11:11
**Comment:**
	*Security: Constructing an SQL query by interpolating `userInput` directly into the string allows an attacker to inject arbitrary SQL; using a parameter placeholder prevents untrusted data from modifying the query.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

}

export function evalVulnerable(userInput: string): unknown {
return eval(userInput);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Passing untrusted userInput directly to eval allows arbitrary JavaScript execution, which is a critical remote code execution risk; using safe parsing (for example JSON parsing) instead avoids running attacker-controlled code. [security]

Severity Level: Critical 🚨
- ❌ Exported helper executes attacker-controlled JavaScript via eval.
- ⚠️ Future adopters may copy unsafe eval pattern.
Suggested change
return eval(userInput);
try {
return JSON.parse(userInput);
} catch {
return userInput;
}
Steps of Reproduction ✅
1. Open `.apiiro-test/vulnerabilities.ts` and locate `evalVulnerable` at lines 14–16,
which directly calls `eval(userInput)` on its argument.

2. Verify with Grep that `evalVulnerable` is only defined in
`.apiiro-test/vulnerabilities.ts` and has no other references in
`/workspace/react-native-sdk`, indicating it is currently unused but exported.

3. In a consumer module (for example, a new handler file), import and call the function
with attacker-controlled data: `evalVulnerable("process.exit(1)")` in Node.js or
`evalVulnerable("alert('xss')")` in a browser context.

4. When that consumer is executed, the `eval` call in `.apiiro-test/vulnerabilities.ts:15`
will execute the supplied string as code, demonstrating arbitrary code execution risk.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .apiiro-test/vulnerabilities.ts
**Line:** 15:15
**Comment:**
	*Security: Passing untrusted `userInput` directly to `eval` allows arbitrary JavaScript execution, which is a critical remote code execution risk; using safe parsing (for example JSON parsing) instead avoids running attacker-controlled code.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎


// ============ MEDIUM SEVERITY ============
export function insecureRandomToken(): string {
return Math.random().toString(36).substring(2);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Using Math.random to generate security tokens produces predictable values that attackers can guess; using a cryptographically secure random source when available greatly reduces the risk of token prediction. [security]

Severity Level: Major ⚠️
- ⚠️ Exported helper suggests non-cryptographic token generation.
- ⚠️ Future security features may inherit weak randomness.
Suggested change
return Math.random().toString(36).substring(2);
const cryptoObj = (globalThis as any).crypto;
if (cryptoObj && typeof cryptoObj.getRandomValues === 'function') {
const array = new Uint32Array(4);
cryptoObj.getRandomValues(array);
return Array.from(array, (value) => value.toString(36)).join('');
}
Steps of Reproduction ✅
1. Inspect `.apiiro-test/vulnerabilities.ts` and find `insecureRandomToken` at lines 19–21
returning `Math.random().toString(36).substring(2)`.

2. Confirm with Grep that `insecureRandomToken` appears only in
`.apiiro-test/vulnerabilities.ts` and is not called elsewhere in
`/workspace/react-native-sdk`, so it is currently unused but exportable.

3. In a consumer module, import and use it as a security token generator, for example
`const token = insecureRandomToken();` for password reset links.

4. Because `Math.random` is not cryptographically secure, an attacker who can observe a
few generated tokens can approximate the PRNG state and significantly narrow the search
space to guess or brute-force other tokens.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .apiiro-test/vulnerabilities.ts
**Line:** 20:20
**Comment:**
	*Security: Using `Math.random` to generate security tokens produces predictable values that attackers can guess; using a cryptographically secure random source when available greatly reduces the risk of token prediction.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

// TODO: Security fix needed
// FIXME: Add validation
export function weakPasswordCheck(password: string): boolean {
return password.length >= 4;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Allowing any password with length at least 4 is extremely weak and makes brute-force attacks easy; increasing the minimum length strengthens password security. [security]

Severity Level: Major ⚠️
- ⚠️ Exported helper encodes extremely weak password policy.
- ⚠️ Future auth features may adopt insecure minimum length.
Suggested change
return password.length >= 4;
return password.length >= 8;
Steps of Reproduction ✅
1. Open `.apiiro-test/vulnerabilities.ts` and locate `weakPasswordCheck` at lines 30–32,
which currently returns `true` for any password with length at least 4.

2. Use Grep to verify `weakPasswordCheck` only appears in `.apiiro-test/vulnerabilities.*`
and is not used in other files, confirming it is exported but not yet part of any
authentication flow.

3. In a hypothetical authentication module, import and rely on `weakPasswordCheck` for
policy enforcement, e.g. `if (!weakPasswordCheck(password)) reject();`.

4. Supply a simple password like `"1234"` or `"test"`, which passes the check (`true`),
demonstrating that the current minimum length allows trivially guessable passwords.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .apiiro-test/vulnerabilities.ts
**Line:** 31:31
**Comment:**
	*Security: Allowing any password with length at least 4 is extremely weak and makes brute-force attacks easy; increasing the minimum length strengthens password security.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

return password.length >= 4;
}

export const INSECURE_URL = 'http://api.example.com/data';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Using plain HTTP for an API endpoint exposes requests to eavesdropping and tampering; switching the URL to HTTPS ensures transport-level encryption. [security]

Severity Level: Major ⚠️
- ⚠️ Exported constant encourages use of non-TLS HTTP endpoint.
- ⚠️ Future HTTP calls may transmit data unencrypted.
Suggested change
export const INSECURE_URL = 'http://api.example.com/data';
export const INSECURE_URL = 'https://api.example.com/data';
Steps of Reproduction ✅
1. Inspect `.apiiro-test/vulnerabilities.ts` and find `INSECURE_URL` at line 34 set to
`http://api.example.com/data`.

2. Verify with Grep that `INSECURE_URL` is only defined in
`.apiiro-test/vulnerabilities.*` and not referenced elsewhere in
`/workspace/react-native-sdk`, so it is currently unused but available for import.

3. In a consumer module, import and use `INSECURE_URL` with `fetch(INSECURE_URL, {
credentials: 'include' })` or a similar HTTP client call to send sensitive data.

4. Because the URL uses plain HTTP, any intermediary on the network path (e.g., local
Wi‑Fi attacker or proxy) can eavesdrop on and tamper with the request and response
traffic.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** .apiiro-test/vulnerabilities.ts
**Line:** 34:34
**Comment:**
	*Security: Using plain HTTP for an API endpoint exposes requests to eavesdropping and tampering; switching the URL to HTTPS ensures transport-level encryption.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
👍 | 👎

@codeant-ai
Copy link

codeant-ai bot commented Feb 25, 2026

CodeAnt AI finished reviewing your PR.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.apiiro-test/README.md (1)

3-18: Add an enforceable release guard in addition to warnings.

Line 3 and Line 18 are clear, but prose alone is easy to miss. Add a CI/pre-release check that fails if .apiiro-test/** is present in release artifacts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.apiiro-test/README.md around lines 3 - 18, Add an enforceable pre-release
guard that fails CI if the .apiiro-test/** pattern is present in release
artifacts: implement a pre-release CI job or script (run in the release
pipeline) that scans the built release artifact list or artifact directory for
the literal ".apiiro-test/**" path pattern and exits non‑zero if any match is
found, referencing the repository artifact names and the README.md notice;
ensure the check runs before merge/packaging and returns a clear failure message
so releases cannot proceed while .apiiro-test remains included.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.apiiro-test/vulnerabilities.ts:
- Around line 14-16: Add a scoped lint suppression for the noGlobalEval rule
immediately above the evalVulnerable function: insert the biome suppression
comment (e.g. /* biome-suppress noGlobalEval */) directly above export function
evalVulnerable(userInput: string): unknown { ... } so the intentional eval usage
is ignored by the linter while keeping the rest of the file checked; remove or
scope the suppression to just this function if your suppression style requires
re-enabling the rule after the function.

---

Nitpick comments:
In @.apiiro-test/README.md:
- Around line 3-18: Add an enforceable pre-release guard that fails CI if the
.apiiro-test/** pattern is present in release artifacts: implement a pre-release
CI job or script (run in the release pipeline) that scans the built release
artifact list or artifact directory for the literal ".apiiro-test/**" path
pattern and exits non‑zero if any match is found, referencing the repository
artifact names and the README.md notice; ensure the check runs before
merge/packaging and returns a clear failure message so releases cannot proceed
while .apiiro-test remains included.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da54230 and 73638f9.

📒 Files selected for processing (4)
  • .apiiro-test/README.md
  • .apiiro-test/vulnerabilities.kt
  • .apiiro-test/vulnerabilities.swift
  • .apiiro-test/vulnerabilities.ts

Comment on lines +14 to +16
export function evalVulnerable(userInput: string): unknown {
return eval(userInput);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Step 1: Locate Biome and package config ==="
fd -H 'biome\.jsonc?$|package\.json$' 2>/dev/null | head -20

echo
echo "=== Step 2: Check Biome configuration for .apiiro-test exclusion ==="
fd -H 'biome\.jsonc?$' 2>/dev/null | while read -r f; do
  echo "--- Found: $f ---"
  cat -n "$f"
  echo
done

echo
echo "=== Step 3: Verify vulnerabilities.ts exists and check current content ==="
if [ -f ".apiiro-test/vulnerabilities.ts" ]; then
  echo "--- .apiiro-test/vulnerabilities.ts ---"
  cat -n ".apiiro-test/vulnerabilities.ts"
else
  echo "File not found at .apiiro-test/vulnerabilities.ts"
fi

Repository: Usercentrics/react-native-sdk

Length of output: 3952


Add scoped suppression to prevent noGlobalEval lint failures.

The .apiiro-test directory is not excluded in biome.json and noGlobalEval is enforced as part of the recommended ruleset. This intentional vulnerability fixture will fail linting in CI. Add the suggested suppression comment:

Required fix
 export function evalVulnerable(userInput: string): unknown {
+  // biome-ignore lint/security/noGlobalEval: intentional vulnerability fixture for scanner testing
   return eval(userInput);
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function evalVulnerable(userInput: string): unknown {
return eval(userInput);
}
export function evalVulnerable(userInput: string): unknown {
// biome-ignore lint/security/noGlobalEval: intentional vulnerability fixture for scanner testing
return eval(userInput);
}
🧰 Tools
🪛 Biome (2.4.4)

[error] 15-15: eval() exposes to security risks and performance issues.

(lint/security/noGlobalEval)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.apiiro-test/vulnerabilities.ts around lines 14 - 16, Add a scoped lint
suppression for the noGlobalEval rule immediately above the evalVulnerable
function: insert the biome suppression comment (e.g. /* biome-suppress
noGlobalEval */) directly above export function evalVulnerable(userInput:
string): unknown { ... } so the intentional eval usage is ignored by the linter
while keeping the rest of the file checked; remove or scope the suppression to
just this function if your suppression style requires re-enabling the rule after
the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant