PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: martinohmann/hcl-rs (rust)

Issue:
Error when trying to parse comments starting with `//`
Despite the copious signage, I was brave (foolish?) enough to try out `hcl-edit`.

I'm happy to report that it did exactly what I wanted it to and would have been easier than the alternatives. So, thank you!

I did find one issue where `hcl-edit` doesn't correctly parse comments starting with `//`:

```
Error:    --> HCL parse error in line 112, column 51
    |
112 |   ami                  = "ami-5f6495430e7781fe5" // Ubuntu 20.04 LTS
    |                                                   ^---
    |
    = invalid expression; expected `"`, `[`, `{`, `-`, `!`, `(`, `_`, `<`, letter or digit
```

I was able to work around this for my use case by just using `#` for the comments.

Pull request:
fix(parser): handle `/` ambiguity in expression parser
Fixes #188

Patch:
diff --git a/crates/hcl-edit/src/parser/expr.rs b/crates/hcl-edit/src/parser/expr.rs
index bb49182..ad078f7 100644
--- a/crates/hcl-edit/src/parser/expr.rs
+++ b/crates/hcl-edit/src/parser/expr.rs
@@ -54,6 +54,8 @@ pub(super) fn expr_inner<'i, 's>(
                     // argument of a function call, do not mistakenly parse it as a traversal
                     // operator.
                     b".." => return Ok((input, ())),
+                    // This is a comment start, do not mistakenly parse a binary division operator.
+                    b"//" | b"/*" => return Ok((input, ())),
                     // Traversal operator.
                     //
                     // Note: after the traversal is consumed, the loop is entered again to consume


Test patch:
diff --git a/crates/hcl-edit/src/parser/tests.rs b/crates/hcl-edit/src/parser/tests.rs
index 66185c5..8274e30 100644
--- a/crates/hcl-edit/src/parser/tests.rs
+++ b/crates/hcl-edit/src/parser/tests.rs
@@ -84,6 +84,8 @@ fn roundtrip_body() {
                   heredoc
                 EOT
         "#},
+        "ami = \"ami-5f6495430e7781fe5\" // Ubuntu 20.04 LTS\n",
+        "ami = \"ami-5f6495430e7781fe5\" /* Ubuntu 20.04 LTS */\n",
     ];
 
     let tests = testdata::load().unwrap();
Repository: tipsy/javalin (kotlin)

Issue:
CORS `IndexOutOfBoundsException` when you pass an `Origin` without a `.`
**Actual behavior (the bug)**
I get a `java.lang.IndexOutOfBoundsException: Index: 1, Size: 1` exception when using the `CorsPlugin` and pass in header `https://exactxcom`. This is due to `CorsUtils` `originsMatch` method line 139, - see the split: `clientOrigin.host.split('.', limit = 2)[1]`

**Expected behavior**
Need to allow for a client host without a full stop.

**To Reproduce**
Enable Cors plugin, pass in an origin header like `https://single` see the fireworks.

**Additional context**

Pull request:
This fixes the Exception as described in #2104.

Will do another PR soon to rewrite it using the JDK's URI class.

Fixes #2104

Patch:
diff --git a/javalin/src/main/java/io/javalin/plugin/bundled/CorsUtils.kt b/javalin/src/main/java/io/javalin/plugin/bundled/CorsUtils.kt
index 1662f1540..0015e7590 100644
--- a/javalin/src/main/java/io/javalin/plugin/bundled/CorsUtils.kt
+++ b/javalin/src/main/java/io/javalin/plugin/bundled/CorsUtils.kt
@@ -135,6 +135,10 @@ internal object CorsUtils {
         if (!serverOrigin.host.startsWith("*.")) {
             return false
         }
+        // the above lines imply a requirement of at least one dot in the origin header sent by the client
+        if ('.' !in clientOrigin.host) {
+            return false
+        }
         val serverHostBase = serverOrigin.host.removePrefix("*.")
         val clientHostBase = clientOrigin.host.split('.', limit = 2)[1]
 


Test patch:
diff --git a/javalin/src/test/java/io/javalin/TestCors.kt b/javalin/src/test/java/io/javalin/TestCors.kt
index 95c603d1e..b7308807c 100644
--- a/javalin/src/test/java/io/javalin/TestCors.kt
+++ b/javalin/src/test/java/io/javalin/TestCors.kt
@@ -427,6 +427,23 @@ class TestCors {
                 .isEqualTo(HttpStatus.METHOD_NOT_ALLOWED)
             assertThat(getResponse.header(ACCESS_CONTROL_ALLOW_ORIGIN)).isEqualTo("https://example.com")
         }
+
+        @Test
+        fun `GH-2104 client sends dotless origin - wildcard configured`() = TestUtil.test(Javalin.create { cfg ->
+            cfg.bundledPlugins.enableCors { cors ->
+                cors.addRule {
+                    it.allowHost("*.example.com")
+                }
+            }
+        }) { app, http ->
+            app.get("/") { it.result("Hello") }
+
+            val response = http.get("/", mapOf(ORIGIN to "https://single"))
+            assertThat(response.status)
+                .describedAs("get status code")
+                .isEqualTo(HttpStatus.BAD_REQUEST)
+            assertThat(response.header(ACCESS_CONTROL_ALLOW_ORIGIN)).isEmpty()
+        }
     }
 
     @Nested